Re: [PATCH v1 2/2] iio: light: acpi-als: Convert ACPI driver to a platform one
From: Jonathan Cameron
Date: Sat Mar 07 2026 - 07:20:23 EST
On Thu, 5 Mar 2026 09:10:49 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> On Wed, Mar 04, 2026 at 07:33:14PM +0100, Rafael J. Wysocki wrote:
> > From: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>
> >
> > In all cases in which a struct acpi_driver is used for binding a driver
> > to an ACPI device object, a corresponding platform device is created by
> > the ACPI core and that device is regarded as a proper representation of
> > underlying hardware. Accordingly, a struct platform_driver should be
> > used by driver code to bind to that device. There are multiple reasons
> > why drivers should not bind directly to ACPI device objects [1].
> >
> > Overall, it is better to bind drivers to platform devices than to their
> > ACPI companions, so convert the ACPI ambient light sensor driver to a
> > platform one.
> >
> > After this change, the subordinate IIO device will be registered under
> > the platform device used for driver binding instead of its ACPI
> > companion.
> >
> > While this is not expected to alter functionality, it changes sysfs
> > layout and so it will be visible to user space.
>
> ...
>
> > -static struct acpi_driver acpi_als_driver = {
> > - .name = "acpi_als",
> > - .class = ACPI_ALS_CLASS,
> > - .ids = acpi_als_device_ids,
> > - .ops = {
> > - .add = acpi_als_add,
> > - .remove = acpi_als_remove,
> > +static struct platform_driver acpi_als_driver = {
> > + .probe = acpi_als_probe,
> > + .remove = acpi_als_remove,
> > + .driver = {
> > + .name = "acpi_als",
> > + .acpi_match_table = acpi_als_device_ids,
> > },
> > };
>
> >
>
> You can also drop this unneeded blank line.
>
> > -module_acpi_driver(acpi_als_driver);
> > +module_platform_driver(acpi_als_driver);
>
> Anyways, LGTM,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Tweaked and applied to the testing branch of iio.git.
Thanks,
Jonathan
>