Message ID | 20241024191200.229894-22-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | iio: Clean up acpi_match_device() use cases | expand |
On Thu, 24 Oct 2024 22:05:10 +0300 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > The complexity of config guards needed for ACPI_PTR() is not worthwhile > for the small amount of saved data. This example was doing it correctly > but I am proposing dropping this so as to reduce chance of cut and paste > where it is done wrong. Also drop now unneeded linux/acpi.h include and > added linux/mod_devicetable.h for struct acpi_device_id definition. > > Reviewed-by: Hans de Goede <hdegoede@redhat.com> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> I made one trivial tweak. > --- > drivers/iio/light/isl29018.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c > index 526ee5619d26..56e1c915af64 100644 > --- a/drivers/iio/light/isl29018.c > +++ b/drivers/iio/light/isl29018.c > @@ -8,17 +8,18 @@ > * Copyright (c) 2010, NVIDIA Corporation. > */ > > -#include <linux/module.h> > #include <linux/i2c.h> > #include <linux/err.h> > +#include <linux/mod_devicetable.h> > +#include <linux/module.h> > #include <linux/mutex.h> > #include <linux/delay.h> > #include <linux/regmap.h> > #include <linux/regulator/consumer.h> > #include <linux/slab.h> > + > #include <linux/iio/iio.h> > #include <linux/iio/sysfs.h> > -#include <linux/acpi.h> > > #define ISL29018_CONV_TIME_MS 100 > > @@ -819,15 +820,13 @@ static int isl29018_resume(struct device *dev) > static DEFINE_SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend, > isl29018_resume); > > -#ifdef CONFIG_ACPI > static const struct acpi_device_id isl29018_acpi_match[] = { > {"ISL29018", isl29018}, > {"ISL29023", isl29023}, > {"ISL29035", isl29035}, > - {}, > + {} > }; > MODULE_DEVICE_TABLE(acpi, isl29018_acpi_match); > -#endif > > static const struct i2c_device_id isl29018_id[] = { > {"isl29018", isl29018}, > @@ -841,14 +840,14 @@ static const struct of_device_id isl29018_of_match[] = { > { .compatible = "isil,isl29018", }, > { .compatible = "isil,isl29023", }, > { .compatible = "isil,isl29035", }, > - { }, > + {} { } is my preference where possible. I'm not going to modify the others as would involve fixing up spacing in lots of code not otherwise touched, but I put the space back here to simplify a future 'tidy up' patch a tiny bit. Jonathan > }; > MODULE_DEVICE_TABLE(of, isl29018_of_match); > > static struct i2c_driver isl29018_driver = { > .driver = { > .name = "isl29018", > - .acpi_match_table = ACPI_PTR(isl29018_acpi_match), > + .acpi_match_table = isl29018_acpi_match, > .pm = pm_sleep_ptr(&isl29018_pm_ops), > .of_match_table = isl29018_of_match, > },
diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c index 526ee5619d26..56e1c915af64 100644 --- a/drivers/iio/light/isl29018.c +++ b/drivers/iio/light/isl29018.c @@ -8,17 +8,18 @@ * Copyright (c) 2010, NVIDIA Corporation. */ -#include <linux/module.h> #include <linux/i2c.h> #include <linux/err.h> +#include <linux/mod_devicetable.h> +#include <linux/module.h> #include <linux/mutex.h> #include <linux/delay.h> #include <linux/regmap.h> #include <linux/regulator/consumer.h> #include <linux/slab.h> + #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> -#include <linux/acpi.h> #define ISL29018_CONV_TIME_MS 100 @@ -819,15 +820,13 @@ static int isl29018_resume(struct device *dev) static DEFINE_SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend, isl29018_resume); -#ifdef CONFIG_ACPI static const struct acpi_device_id isl29018_acpi_match[] = { {"ISL29018", isl29018}, {"ISL29023", isl29023}, {"ISL29035", isl29035}, - {}, + {} }; MODULE_DEVICE_TABLE(acpi, isl29018_acpi_match); -#endif static const struct i2c_device_id isl29018_id[] = { {"isl29018", isl29018}, @@ -841,14 +840,14 @@ static const struct of_device_id isl29018_of_match[] = { { .compatible = "isil,isl29018", }, { .compatible = "isil,isl29023", }, { .compatible = "isil,isl29035", }, - { }, + {} }; MODULE_DEVICE_TABLE(of, isl29018_of_match); static struct i2c_driver isl29018_driver = { .driver = { .name = "isl29018", - .acpi_match_table = ACPI_PTR(isl29018_acpi_match), + .acpi_match_table = isl29018_acpi_match, .pm = pm_sleep_ptr(&isl29018_pm_ops), .of_match_table = isl29018_of_match, },