diff mbox series

[10/23] iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h include

Message ID 20200628123654.32830-11-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 June 28, 2020, 12:36 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Allows use of driver with ACPI PRP0001 base binding.
Mostly this is about trying to avoid cut and paste of this into new
drivers (it is a frequent review comment) rather than any
thought that this driver might get used on an ACPI platform.

The mod_devicetable.h include is to encourage best practice of including
any header directly used within the code (here for of_match_id)

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jacopo Mondi <jacopo@jmondi.org>
---
 drivers/iio/adc/max11100.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jacopo Mondi June 29, 2020, 7:28 a.m. UTC | #1
Hi Jonathan,
On Sun, Jun 28, 2020 at 01:36:41PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Allows use of driver with ACPI PRP0001 base binding.
> Mostly this is about trying to avoid cut and paste of this into new
> drivers (it is a frequent review comment) rather than any
> thought that this driver might get used on an ACPI platform.
>
> The mod_devicetable.h include is to encourage best practice of including
> any header directly used within the code (here for of_match_id)
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  drivers/iio/adc/max11100.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/max11100.c b/drivers/iio/adc/max11100.c
> index 57734f9742f6..77fcee1dddf7 100644
> --- a/drivers/iio/adc/max11100.c
> +++ b/drivers/iio/adc/max11100.c
> @@ -9,6 +9,7 @@
>  #include <linux/delay.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> +#include <linux/mod_devicetable.h>

If we want to keep the inclusion order alphabetically sorted,
shouldn't mod_devicetable. come before module.h ?

That apart:
Acked-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
   j

>  #include <linux/regulator/consumer.h>
>  #include <linux/spi/spi.h>
>
> @@ -161,7 +162,7 @@ MODULE_DEVICE_TABLE(of, max11100_ids);
>  static struct spi_driver max11100_driver = {
>  	.driver = {
>  		.name	= "max11100",
> -		.of_match_table = of_match_ptr(max11100_ids),
> +		.of_match_table = max11100_ids,
>  	},
>  	.probe		= max11100_probe,
>  	.remove		= max11100_remove,
> --
> 2.27.0
>
Jonathan Cameron July 4, 2020, 5:19 p.m. UTC | #2
On Mon, 29 Jun 2020 09:28:09 +0200
Jacopo Mondi <jacopo@jmondi.org> wrote:

> Hi Jonathan,
> On Sun, Jun 28, 2020 at 01:36:41PM +0100, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > Allows use of driver with ACPI PRP0001 base binding.
> > Mostly this is about trying to avoid cut and paste of this into new
> > drivers (it is a frequent review comment) rather than any
> > thought that this driver might get used on an ACPI platform.
> >
> > The mod_devicetable.h include is to encourage best practice of including
> > any header directly used within the code (here for of_match_id)
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Jacopo Mondi <jacopo@jmondi.org>
> > ---
> >  drivers/iio/adc/max11100.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/adc/max11100.c b/drivers/iio/adc/max11100.c
> > index 57734f9742f6..77fcee1dddf7 100644
> > --- a/drivers/iio/adc/max11100.c
> > +++ b/drivers/iio/adc/max11100.c
> > @@ -9,6 +9,7 @@
> >  #include <linux/delay.h>
> >  #include <linux/kernel.h>
> >  #include <linux/module.h>
> > +#include <linux/mod_devicetable.h>  
> 
> If we want to keep the inclusion order alphabetically sorted,
> shouldn't mod_devicetable. come before module.h ?

I have no idea what the 'convention' on ordering of
underscores in the kernel is, so I did

git grep -A1 module\.h -- drivers/ | grep mod_devicetable\.h | wc
 116     232    7798
git grep -B1 module\.h -- drivers/ | grep mod_devicetable\.h | wc
 52     104    3694

Which I think means we have almost twice as many cases of
it being after module.h as before.  Still I'm going to cynically
decide to not care :)

> 
> That apart:
> Acked-by: Jacopo Mondi <jacopo@jmondi.org>
> 
Thanks,

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to poke at it.

Jonathan

> Thanks
>    j
> 
> >  #include <linux/regulator/consumer.h>
> >  #include <linux/spi/spi.h>
> >
> > @@ -161,7 +162,7 @@ MODULE_DEVICE_TABLE(of, max11100_ids);
> >  static struct spi_driver max11100_driver = {
> >  	.driver = {
> >  		.name	= "max11100",
> > -		.of_match_table = of_match_ptr(max11100_ids),
> > +		.of_match_table = max11100_ids,
> >  	},
> >  	.probe		= max11100_probe,
> >  	.remove		= max11100_remove,
> > --
> > 2.27.0
> >
diff mbox series

Patch

diff --git a/drivers/iio/adc/max11100.c b/drivers/iio/adc/max11100.c
index 57734f9742f6..77fcee1dddf7 100644
--- a/drivers/iio/adc/max11100.c
+++ b/drivers/iio/adc/max11100.c
@@ -9,6 +9,7 @@ 
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/regulator/consumer.h>
 #include <linux/spi/spi.h>
 
@@ -161,7 +162,7 @@  MODULE_DEVICE_TABLE(of, max11100_ids);
 static struct spi_driver max11100_driver = {
 	.driver = {
 		.name	= "max11100",
-		.of_match_table = of_match_ptr(max11100_ids),
+		.of_match_table = max11100_ids,
 	},
 	.probe		= max11100_probe,
 	.remove		= max11100_remove,