Re: [PATCH v3 2/9] firmware: arm_scmi: Extend transport driver macro to support ACPI
Jonathan Cameron <[email protected]>
| Newsgroups | org.infradead.lists.linux-arm-kernel,org.kernel.vger.arm-scmi |
|---|---|
| Organization | Qualcomm |
| Message-ID | <[email protected]> |
On Thu, 13 Aug 2026 12:32:57 +0100 Sudeep Holla <[email protected]> wrote: > Extend the SCMI transport driver helper to support ACPI-based systems. > Introduce an internal helper macro that accepts both OF and ACPI match > tables, and expose two wrappers: > > - DEFINE_SCMI_TRANSPORT_DRIVER(...) for DT/OF transports > - DEFINE_SCMI_ACPI_TRANSPORT_DRIVER(...) for ACPI transports > > For ACPI, set the generated platform_driver .acpi_match_table via > ACPI_PTR(). ACPI_PTR() is often more trouble that it is worth because of need to guard the tables if they turn up in code where ACPI might not be present. Now if someone fancied doing the work to make it work like pm_ptr() then that would nicer. That one lets the compiler both see the stuff beyond the pointer, but also do dead code removal on it later. Anyhow, doesn't actually matter either way here because you only use that with a non NULL pointer in a driver that is ACPI only. If you really want to do it, maybe pair with of_match_ptr() but that one is even worse as maybe some will be having fun with SCMI and PRP0001. Anyhow, random diversion aside, it makes no difference in practice. > The ACPI wrapper relies on the firmware-node propagation > provided by the preceding change so fwnode lookups on the spawned > platform device see the correct firmware description. > > Keep existing DT users unchanged while allowing transports to be probed > using struct acpi_device_id tables on ACPI platforms. > > Signed-off-by: Sudeep Holla <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> > --- > drivers/firmware/arm_scmi/common.h | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h > index cc7d11c3c1f3..0b896171faa2 100644 > --- a/drivers/firmware/arm_scmi/common.h > +++ b/drivers/firmware/arm_scmi/common.h > @@ -9,6 +9,7 @@ > #ifndef _SCMI_COMMON_H > #define _SCMI_COMMON_H > > +#include <linux/acpi.h> > #include <linux/bitfield.h> > #include <linux/completion.h> > #include <linux/device.h> > @@ -615,7 +616,8 @@ struct scmi_transport_supplier __supplier = { \ > .th.supplier_put = scmi_transport_supplier_put, \ > } > > -#define DEFINE_SCMI_TRANSPORT_DRIVER(__tag, __drv, __desc, __match, __core_ops)\ > +#define __DEFINE_SCMI_TRANSPORT_DRIVER(__tag, __drv, __desc, __of_match, \ > + __acpi_match, __core_ops) \ > static void __tag##_dev_free(void *data) \ > { \ > struct platform_device *spdev = data; \ > @@ -679,11 +681,18 @@ err_mem: \ > static struct platform_driver __drv = { \ > .driver = { \ > .name = #__tag "_transport", \ > - .of_match_table = __match, \ > + .of_match_table = __of_match, \ > + .acpi_match_table = ACPI_PTR(__acpi_match), \ > }, \ > .probe = __tag##_probe, \ > } > > +#define DEFINE_SCMI_TRANSPORT_DRIVER(__tag, __drv, __desc, __match, __core_ops)\ > + __DEFINE_SCMI_TRANSPORT_DRIVER(__tag, __drv, __desc, __match, NULL, __core_ops) > + > +#define DEFINE_SCMI_ACPI_TRANSPORT_DRIVER(__tag, __drv, __desc, __match, __core_ops)\ > + __DEFINE_SCMI_TRANSPORT_DRIVER(__tag, __drv, __desc, NULL, __match, __core_ops) > + > void scmi_notification_instance_data_set(const struct scmi_handle *handle, > void *priv); > void *scmi_notification_instance_data_get(const struct scmi_handle *handle); >