diff mbox series

[v2,5/5] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h

Message ID 20200721171444.825099-6-jic23@kernel.org (mailing list archive)
State New, archived
Headers show
Series iio:adc more of_match_ptr and similar removal | expand

Commit Message

Jonathan Cameron July 21, 2020, 5:14 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

This driver cannot be instantiated from ACPI due to it's use of
syscon_regmap_lookup_by_phandle() but in the interests of clearing
this anti pattern out of IIO, let us switch to an explicit
check in kconfig and remove the protections on the of_match_table
The switch of header is because we only use of_device_id
in here and that is defined in mod_devicetable.h not of.h.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
---
 * Use Kconfig change to make it explicit you can build the driver
   without OF, but it won't do anything terribly useful.
 drivers/iio/adc/Kconfig         | 2 +-
 drivers/iio/adc/bcm_iproc_adc.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Andy Shevchenko July 21, 2020, 6:34 p.m. UTC | #1
On Tue, Jul 21, 2020 at 8:16 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> This driver cannot be instantiated from ACPI due to it's use of
> syscon_regmap_lookup_by_phandle() but in the interests of clearing
> this anti pattern out of IIO, let us switch to an explicit
> check in kconfig and remove the protections on the of_match_table

Kconfig

> The switch of header is because we only use of_device_id
> in here and that is defined in mod_devicetable.h not of.h.

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

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
> ---
>  * Use Kconfig change to make it explicit you can build the driver
>    without OF, but it won't do anything terribly useful.
>  drivers/iio/adc/Kconfig         | 2 +-
>  drivers/iio/adc/bcm_iproc_adc.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index 66d9cc073157..f495d01a79b9 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -340,7 +340,7 @@ config AXP288_ADC
>
>  config BCM_IPROC_ADC
>         tristate "Broadcom IPROC ADC driver"
> -       depends on ARCH_BCM_IPROC || COMPILE_TEST
> +       depends on (ARCH_BCM_IPROC && OF) || COMPILE_TEST
>         depends on MFD_SYSCON
>         default ARCH_BCM_CYGNUS
>         help
> diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
> index 936da32faa9d..44e1e53ada72 100644
> --- a/drivers/iio/adc/bcm_iproc_adc.c
> +++ b/drivers/iio/adc/bcm_iproc_adc.c
> @@ -4,7 +4,7 @@
>   */
>
>  #include <linux/module.h>
> -#include <linux/of.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/io.h>
>  #include <linux/clk.h>
>  #include <linux/mfd/syscon.h>
> @@ -617,7 +617,7 @@ static struct platform_driver iproc_adc_driver = {
>         .remove = iproc_adc_remove,
>         .driver = {
>                 .name   = "iproc-static-adc",
> -               .of_match_table = of_match_ptr(iproc_adc_of_match),
> +               .of_match_table = iproc_adc_of_match,
>         },
>  };
>  module_platform_driver(iproc_adc_driver);
> --
> 2.27.0
>
Jonathan Cameron Aug. 9, 2020, 2:05 p.m. UTC | #2
On Tue, 21 Jul 2020 21:34:48 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Tue, Jul 21, 2020 at 8:16 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > This driver cannot be instantiated from ACPI due to it's use of
> > syscon_regmap_lookup_by_phandle() but in the interests of clearing
> > this anti pattern out of IIO, let us switch to an explicit
> > check in kconfig and remove the protections on the of_match_table  
> 
> Kconfig
> 
> > The switch of header is because we only use of_device_id
> > in here and that is defined in mod_devicetable.h not of.h.  
> 
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to poke at it.

Thanks,

Jonathan

> 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
> > ---
> >  * Use Kconfig change to make it explicit you can build the driver
> >    without OF, but it won't do anything terribly useful.
> >  drivers/iio/adc/Kconfig         | 2 +-
> >  drivers/iio/adc/bcm_iproc_adc.c | 4 ++--
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> > index 66d9cc073157..f495d01a79b9 100644
> > --- a/drivers/iio/adc/Kconfig
> > +++ b/drivers/iio/adc/Kconfig
> > @@ -340,7 +340,7 @@ config AXP288_ADC
> >
> >  config BCM_IPROC_ADC
> >         tristate "Broadcom IPROC ADC driver"
> > -       depends on ARCH_BCM_IPROC || COMPILE_TEST
> > +       depends on (ARCH_BCM_IPROC && OF) || COMPILE_TEST
> >         depends on MFD_SYSCON
> >         default ARCH_BCM_CYGNUS
> >         help
> > diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
> > index 936da32faa9d..44e1e53ada72 100644
> > --- a/drivers/iio/adc/bcm_iproc_adc.c
> > +++ b/drivers/iio/adc/bcm_iproc_adc.c
> > @@ -4,7 +4,7 @@
> >   */
> >
> >  #include <linux/module.h>
> > -#include <linux/of.h>
> > +#include <linux/mod_devicetable.h>
> >  #include <linux/io.h>
> >  #include <linux/clk.h>
> >  #include <linux/mfd/syscon.h>
> > @@ -617,7 +617,7 @@ static struct platform_driver iproc_adc_driver = {
> >         .remove = iproc_adc_remove,
> >         .driver = {
> >                 .name   = "iproc-static-adc",
> > -               .of_match_table = of_match_ptr(iproc_adc_of_match),
> > +               .of_match_table = iproc_adc_of_match,
> >         },
> >  };
> >  module_platform_driver(iproc_adc_driver);
> > --
> > 2.27.0
> >  
> 
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 66d9cc073157..f495d01a79b9 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -340,7 +340,7 @@  config AXP288_ADC
 
 config BCM_IPROC_ADC
 	tristate "Broadcom IPROC ADC driver"
-	depends on ARCH_BCM_IPROC || COMPILE_TEST
+	depends on (ARCH_BCM_IPROC && OF) || COMPILE_TEST
 	depends on MFD_SYSCON
 	default ARCH_BCM_CYGNUS
 	help
diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
index 936da32faa9d..44e1e53ada72 100644
--- a/drivers/iio/adc/bcm_iproc_adc.c
+++ b/drivers/iio/adc/bcm_iproc_adc.c
@@ -4,7 +4,7 @@ 
  */
 
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
 #include <linux/io.h>
 #include <linux/clk.h>
 #include <linux/mfd/syscon.h>
@@ -617,7 +617,7 @@  static struct platform_driver iproc_adc_driver = {
 	.remove	= iproc_adc_remove,
 	.driver	= {
 		.name	= "iproc-static-adc",
-		.of_match_table = of_match_ptr(iproc_adc_of_match),
+		.of_match_table = iproc_adc_of_match,
 	},
 };
 module_platform_driver(iproc_adc_driver);