Re: [PATCH v2 3/5] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections

Andy Shevchenko
2020-07-21T18:31:55Z

On Tue, Jul 21, 2020 at 8:16 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> I'm trying to clean this (now) anti-pattern out of IIO to avoid
> cut and paste into new drivers.
>
> Also add an include of mod_devicetable.h as the driver directly uses
> struct of_device_id which is defined in there.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>
> v1->v2
> * Drop reference to PRP0001 etc in this one as it has valid ACPI
> IDs.
>
> drivers/iio/adc/ti-adc108s102.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/ti-adc108s102.c b/drivers/iio/adc/ti-adc108s102.c
> index 9b9b27415c93..183b2245e89b 100644
> --- a/drivers/iio/adc/ti-adc108s102.c
> +++ b/drivers/iio/adc/ti-adc108s102.c
> @@ -20,6 +20,7 @@
> #include <linux/iio/trigger_consumer.h>
> #include <linux/interrupt.h>
> #include <linux/module.h>
> +#include <linux/mod_devicetable.h>
> #include <linux/property.h>
> #include <linux/regulator/consumer.h>
> #include <linux/spi/spi.h>
> @@ -299,13 +300,11 @@ static int adc108s102_remove(struct spi_device *spi)
> return 0;
> }
>
> -#ifdef CONFIG_OF
> static const struct of_device_id adc108s102_of_match[] = {
> { .compatible = "ti,adc108s102" },
> { }
> };
> MODULE_DEVICE_TABLE(of, adc108s102_of_match);
> -#endif
>
> #ifdef CONFIG_ACPI
> static const struct acpi_device_id adc108s102_acpi_ids[] = {
> @@ -324,7 +323,7 @@ MODULE_DEVICE_TABLE(spi, adc108s102_id);
> static struct spi_driver adc108s102_driver = {
> .driver = {
> .name = "adc108s102",
> - .of_match_table = of_match_ptr(adc108s102_of_match),
> + .of_match_table = adc108s102_of_match,
> .acpi_match_table = ACPI_PTR(adc108s102_acpi_ids),
> },
> .probe = adc108s102_probe,
> --
> 2.27.0
>

--
With Best Regards,
Andy Shevchenko