Skip to contentSkip to conversation

iio:adc more of_match_ptr and similar removal

PATCH Applied Jonathan Cameron 8 participants 68 messages Jun 28, 2020 – Jul 4, 2020

Subsystems (7)

v1 of 3 Applied Latest is v3 →

lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

cover iio:adc more of_match_ptr and similar removal

From: Jonathan Cameron <[email protected]>

Continuation of slow process to try and remove use of of_match_ptr to supress asignment of the of_device_id table when !CONFIG_OF.

Usual argument that it prevents ACPI being used with these drivers via PRP0001 in DSDT. Perhaps more usefully we are cutting down on the number of places it can be cut and paste from into new drivers.

This is just the low hanging fruit. I'm not yet sure if it makes sense to expend the effort to use generic firmware properties etc for some of the remaining drivers as it is unlikely they'll ever be used with anything other than device tree. There are 4 current ADC drivers in this more complex category.

Jonathan Cameron (23):
iio:adc:lpc32xx: Drop of_match_ptr protection iio:adc:axp20x: Convert from OF to generic fw / device properties iio:adc:hi8435: Drop unused of_gpio.h header iio:adc:hi8435: Drop of_match_ptr protection. iio:adc:max1363: Drop of_match_ptr and use generic
device_get_match_data
iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h iio:adc:cpcap-adc: Drop of_match_ptr protection and use
device_get_match_data
iio:adc:ltc2497 drop of_match_ptr protection iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h
include
iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections iio:adc:mcp320x: Drop CONFIG_OF and of_match_ptr protections iio:adc:mcp3422: remove CONFIG_OF and of_match_ptr protections iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections iio:adc:ti-adc084s021: drop of_match_ptr protection iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections iio:adc:ti-adc128s052: drop of_match_ptr protection iio:adc:ti-adc161s626: Drop of_match_ptr protection. iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections. iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to
mod_devicetable.h
iio:adc:ingenic: drop of_match_ptr protection and include
mod_devicetable.h

 drivers/iio/adc/axp20x_adc.c       | 10 +++++-----
 drivers/iio/adc/bcm_iproc_adc.c    |  4 ++--
 drivers/iio/adc/cpcap-adc.c        | 22 ++++++----------------
 drivers/iio/adc/hi8435.c           |  6 ++----
 drivers/iio/adc/ingenic-adc.c      |  5 ++---
 drivers/iio/adc/lpc32xx_adc.c      |  5 ++---
 drivers/iio/adc/ltc2496.c          |  4 ++--
 drivers/iio/adc/ltc2497.c          |  4 ++--
 drivers/iio/adc/max1027.c          |  5 ++---
 drivers/iio/adc/max11100.c         |  3 ++-
 drivers/iio/adc/max1118.c          |  7 ++-----
 drivers/iio/adc/max1363.c          | 11 ++++-------
 drivers/iio/adc/mcp320x.c          |  5 ++---
 drivers/iio/adc/mcp3422.c          |  6 ++----
 drivers/iio/adc/sd_adc_modulator.c |  5 +++--
 drivers/iio/adc/ti-adc081c.c       |  6 ++----
 drivers/iio/adc/ti-adc0832.c       |  7 ++-----
 drivers/iio/adc/ti-adc084s021.c    |  3 ++-
 drivers/iio/adc/ti-adc108s102.c    |  5 ++---
 drivers/iio/adc/ti-adc128s052.c    |  3 ++-
 drivers/iio/adc/ti-adc161s626.c    |  3 ++-
 drivers/iio/adc/ti-tlc4541.c       |  5 ++---
 22 files changed, 54 insertions(+), 80 deletions(-)
Signature · 1 line
2.27.0
author maintainer
#1 lore raw

PATCH 1/23 iio:adc:lpc32xx: Drop of_match_ptr protection

From: Jonathan Cameron <[email protected]>

Whilst is unlikely anyone will be using this part with an ACPI PRP0001 based binding any time soon, we are getting a lot of cut and pasting of this pattern so I am looking to remove it entirely from IIO.

In this case CONFIG_OF protections also removed and mod_devicetable.h include added given direct use of struct of_device_id.

---
 drivers/iio/adc/lpc32xx_adc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/lpc32xx_adc.c +2 -3
index bc2712a48844..b56ce15255cf 100644
@@ -14,6 +14,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 
@@ -209,19 +210,17 @@ static int lpc32xx_adc_probe(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id lpc32xx_adc_match[] = {
 	{ .compatible = "nxp,lpc3220-adc" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, lpc32xx_adc_match);
-#endif
 
 static struct platform_driver lpc32xx_adc_driver = {
 	.probe		= lpc32xx_adc_probe,
 	.driver		= {
 		.name	= LPC32XXAD_NAME,
-		.of_match_table = of_match_ptr(lpc32xx_adc_match),
+		.of_match_table = lpc32xx_adc_match,
 	},
 };
 
Signature · 1 line
2.27.0
#2 lore raw

Re: [PATCH 01/23] iio:adc:lpc32xx: Drop of_match_ptr protection

Quoted 10 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Whilst is unlikely anyone will be using this part with an ACPI PRP0001 based binding any time soon, we are getting a lot of cut and pasting of this pattern so I am looking to remove it entirely from IIO.

In this case CONFIG_OF protections also removed and mod_devicetable.h include added given direct use of struct of_device_id.

Yes, it also fixes indirect inclusion of of.h.
LGTM!

Quoted 43 lines
---
 drivers/iio/adc/lpc32xx_adc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/lpc32xx_adc.c +1 -0
index bc2712a48844..b56ce15255cf 100644
@@ -14,6 +14,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 
 
 #include <linux/platform_device.h>

#include <linux/regulator/consumer.h>

drivers/iio/adc/lpc32xx_adc.c +1 -4
@@ -209,19 +210,17 @@ static int lpc32xx_adc_probe(struct platform_device *pdev)
        return 0;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id lpc32xx_adc_match[] = {
        { .compatible = "nxp,lpc3220-adc" },
        {},
 };
 MODULE_DEVICE_TABLE(of, lpc32xx_adc_match);
-#endif
 
 static struct platform_driver lpc32xx_adc_driver = {
        .probe          = lpc32xx_adc_probe,
        .driver         = {
                .name   = LPC32XXAD_NAME,
-               .of_match_table = of_match_ptr(lpc32xx_adc_match),
+               .of_match_table = lpc32xx_adc_match,
        },
 };
 
--

2.27.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#3 lore raw

Re: [PATCH 01/23] iio:adc:lpc32xx: Drop of_match_ptr protection

Quoted 8 lines · On Tue, 30 Jun 2020 10:01:29 +0300 Andy Shevchenko <[email protected]>…
Quoted 7 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Whilst is unlikely anyone will be using this part with an ACPI PRP0001 based binding any time soon, we are getting a lot of cut and pasting of this pattern so I am looking to remove it entirely from IIO.

Quoted 7 lines
Quoted 3 lines

In this case CONFIG_OF protections also removed and mod_devicetable.h include added given direct use of struct of_device_id.

Yes, it also fixes indirect inclusion of of.h.
LGTM!

Thanks, added RB as per cover letter reply.

Applied to the togreg branch of iio.git and pushed out as testing to see if I missed anything.

Thanks,

Jonathan

Quoted 45 lines
Quoted 43 lines
---
 drivers/iio/adc/lpc32xx_adc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/lpc32xx_adc.c +1 -0
index bc2712a48844..b56ce15255cf 100644
@@ -14,6 +14,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>  
 
 
 #include <linux/platform_device.h>

#include <linux/regulator/consumer.h>

drivers/iio/adc/lpc32xx_adc.c +1 -4
@@ -209,19 +210,17 @@ static int lpc32xx_adc_probe(struct platform_device *pdev)
        return 0;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id lpc32xx_adc_match[] = {
        { .compatible = "nxp,lpc3220-adc" },
        {},
 };
 MODULE_DEVICE_TABLE(of, lpc32xx_adc_match);
-#endif
 
 static struct platform_driver lpc32xx_adc_driver = {
        .probe          = lpc32xx_adc_probe,
        .driver         = {
                .name   = LPC32XXAD_NAME,
-               .of_match_table = of_match_ptr(lpc32xx_adc_match),
+               .of_match_table = lpc32xx_adc_match,
        },
 };
 
--

2.27.0

author maintainer
#4 lore raw

PATCH 2/23 iio:adc:axp20x: Convert from OF to generic fw / device properties

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Whilst fairly unlikely anyone will ever use this driver with anything other than DT, we are trying to move IIO over to the generic interfaces where easy to do so.

In this case this involved moving to generic check on presence of fw_node, generic device_get_match_data and dropping the of_match_ptr protection. Also relevant header changes to have property.h and mod_devicetable.h only.

---
 drivers/iio/adc/axp20x_adc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/iio/adc/axp20x_adc.c +5 -5
index 798ff2d89691..b678f897d983 100644
@@ -9,10 +9,10 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/property.h>
 #include <linux/regmap.h>
 #include <linux/thermal.h>
 
@@ -670,7 +670,7 @@ static int axp20x_probe(struct platform_device *pdev)
 	info->regmap = axp20x_dev->regmap;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
-	if (!pdev->dev.of_node) {
+	if (!dev_fwnode(&pdev->dev)) {
 		const struct platform_device_id *id;
 
 		id = platform_get_device_id(pdev);
@@ -678,7 +678,7 @@ static int axp20x_probe(struct platform_device *pdev)
 	} else {
 		struct device *dev = &pdev->dev;
 
-		info->data = (struct axp_data *)of_device_get_match_data(dev);
+		info->data = (struct axp_data *)device_get_match_data(dev);
 	}
 
 	indio_dev->name = platform_get_device_id(pdev)->name;
@@ -742,7 +742,7 @@ static int axp20x_remove(struct platform_device *pdev)
 static struct platform_driver axp20x_adc_driver = {
 	.driver = {
 		.name = "axp20x-adc",
-		.of_match_table = of_match_ptr(axp20x_adc_of_match),
+		.of_match_table = axp20x_adc_of_match,
 	},
 	.id_table = axp20x_adc_id_match,
 	.probe = axp20x_probe,
Signature · 1 line
2.27.0
#5 lore raw

Re: [PATCH 02/23] iio:adc:axp20x: Convert from OF to generic fw / device properties

Quoted 8 lines · Jonathan Cameron

Whilst fairly unlikely anyone will ever use this driver with anything other than DT, we are trying to move IIO over to the generic interfaces where easy to do so.

In this case this involved moving to generic check on presence of fw_node, generic device_get_match_data and dropping the of_match_ptr protection. Also relevant header changes to have property.h and mod_devicetable.h only.

...

drivers/iio/adc/axp20x_adc.c static int axp20x_probe(struct platform_device *pdev) · line 681

Quoted 2 lines
drivers/iio/adc/axp20x_adc.c +1 -1
-               info->data = (struct axp_data *)of_device_get_match_data(dev);
+               info->data = (struct axp_data *)device_get_match_data(dev);

Casting is not needed, but if you remove it it reveals a hidden const qualifier drop.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#6 lore raw

Re: [PATCH 02/23] iio:adc:axp20x: Convert from OF to generic fw / device properties

Quoted 11 lines · On Sun, 28 Jun 2020 20:43:50 +0300 Andy Shevchenko <[email protected]>…
Quoted 8 lines · Jonathan Cameron

Whilst fairly unlikely anyone will ever use this driver with anything other than DT, we are trying to move IIO over to the generic interfaces where easy to do so.

In this case this involved moving to generic check on presence of fw_node, generic device_get_match_data and dropping the of_match_ptr protection. Also relevant header changes to have property.h and mod_devicetable.h only.

Quoted 8 lines

...

drivers/iio/adc/axp20x_adc.c static int axp20x_probe(struct platform_device *pdev) · line 681

Quoted 2 lines
drivers/iio/adc/axp20x_adc.c +1 -1
-               info->data = (struct axp_data *)of_device_get_match_data(dev);
+               info->data = (struct axp_data *)device_get_match_data(dev);  

Casting is not needed, but if you remove it it reveals a hidden const qualifier drop.

Doh. I should have noticed the odd cast..

Will fix up. Making info->data a const as well will tidy that up.

Thanks,

Jonathan

author maintainer
#7 lore raw

PATCH 3/23 iio:adc:hi8435: Drop unused of_gpio.h header

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

I guess this is a left over from some earlier cleanup. Not used currently.

Cc Nikita Yushchenko <[email protected]>
Cc Vladimir Barinov <[email protected]>
---
 drivers/iio/adc/hi8435.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/hi8435.c +0 -1
index 127e78243233..235374ec7bab 100644
@@ -17,7 +17,6 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
-#include <linux/of_gpio.h>
 #include <linux/spi/spi.h>
 #include <linux/gpio/consumer.h>
 
Signature · 1 line
2.27.0
author maintainer
#8 lore raw

Re: [PATCH 03/23] iio:adc:hi8435: Drop unused of_gpio.h header

Quoted 8 lines · On Sun, 28 Jun 2020 13:36:34 +0100 Jonathan Cameron <[email protected]> wrote:

From: Jonathan Cameron <[email protected]>

I guess this is a left over from some earlier cleanup. Not used currently.

Cc Nikita Yushchenko <[email protected]>
Cc Vladimir Barinov <[email protected]>

Applied to the togreg branch of iio.git and pushed out as testing to see if I missed anything.

Thanks,

Jonathan

Quoted 16 lines
---
 drivers/iio/adc/hi8435.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iio/adc/hi8435.c +0 -1
index 127e78243233..235374ec7bab 100644
@@ -17,7 +17,6 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
-#include <linux/of_gpio.h>
 #include <linux/spi/spi.h>
 #include <linux/gpio/consumer.h>
 
author maintainer
#9 lore raw

PATCH 4/23 iio:adc:hi8435: Drop of_match_ptr protection.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Allows use of ACPI with PRP0001 and is generally something we are trying to avoid having people cut and paste into new drivers without thinking about it.

Cc Vladimir Barinov <[email protected]>
Cc Nikita Yushchenko <[email protected]>
---
 drivers/iio/adc/hi8435.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/hi8435.c +2 -3
index 235374ec7bab..074c30970465 100644
@@ -15,8 +15,7 @@
 #include <linux/iio/triggered_event.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 #include <linux/gpio/consumer.h>
 
@@ -539,7 +538,7 @@ MODULE_DEVICE_TABLE(spi, hi8435_id);
 static struct spi_driver hi8435_driver = {
 	.driver	= {
 		.name		= DRV_NAME,
-		.of_match_table	= of_match_ptr(hi8435_dt_ids),
+		.of_match_table	= hi8435_dt_ids,
 	},
 	.probe		= hi8435_probe,
 	.id_table	= hi8435_id,
Signature · 1 line
2.27.0
author maintainer Applied
#10 lore raw

Re: [PATCH 04/23] iio:adc:hi8435: Drop of_match_ptr protection.

Quoted 9 lines · On Sun, 28 Jun 2020 13:36:35 +0100 Jonathan Cameron <[email protected]> wrote:

From: Jonathan Cameron <[email protected]>

Allows use of ACPI with PRP0001 and is generally something we are trying to avoid having people cut and paste into new drivers without thinking about it.

Cc Vladimir Barinov <[email protected]>
Cc Nikita Yushchenko <[email protected]>

Applied.

Thanks,

Jonathan

Quoted 27 lines
---
 drivers/iio/adc/hi8435.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/hi8435.c +2 -3
index 235374ec7bab..074c30970465 100644
@@ -15,8 +15,7 @@
 #include <linux/iio/triggered_event.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 #include <linux/gpio/consumer.h>
 
@@ -539,7 +538,7 @@ MODULE_DEVICE_TABLE(spi, hi8435_id);
 static struct spi_driver hi8435_driver = {
 	.driver	= {
 		.name		= DRV_NAME,
-		.of_match_table	= of_match_ptr(hi8435_dt_ids),
+		.of_match_table	= hi8435_dt_ids,
 	},
 	.probe		= hi8435_probe,
 	.id_table	= hi8435_id,
author maintainer
#11 lore raw

PATCH 5/23 iio:adc:max1363: Drop of_match_ptr and use generic device_get_match_data

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Allows driver to use ACPI PRP0001 binding and there was no particular advantage in having the protections in this driver.

Mostly this part of an effort to remove as many OF specific bits of handling from IIO and use the generic forms where possible.

---
 drivers/iio/adc/max1363.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/iio/adc/max1363.c +4 -7
index d8da5da74b77..420e2ec154fc 100644
@@ -22,8 +22,8 @@
 #include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
+#include <linux/mod_devicetable.h>
+#include <linux/property.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -1529,8 +1529,6 @@ static irqreturn_t max1363_trigger_handler(int irq, void *p)
 	return IRQ_HANDLED;
 }
 
-#ifdef CONFIG_OF
-
 #define MAX1363_COMPATIBLE(of_compatible, cfg) {		\
 			.compatible = of_compatible,		\
 			.data = &max1363_chip_info_tbl[cfg],	\
@@ -1578,7 +1576,6 @@ static const struct of_device_id max1363_of_match[] = {
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, max1363_of_match);
-#endif
 
 static int max1363_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
@@ -1613,7 +1610,7 @@ static int max1363_probe(struct i2c_client *client,
 	/* this is only used for device removal purposes */
 	i2c_set_clientdata(client, indio_dev);
 
-	st->chip_info = of_device_get_match_data(&client->dev);
+	st->chip_info = device_get_match_data(&client->dev);
 	if (!st->chip_info)
 		st->chip_info = &max1363_chip_info_tbl[id->driver_data];
 	st->client = client;
@@ -1756,7 +1753,7 @@ MODULE_DEVICE_TABLE(i2c, max1363_id);
 static struct i2c_driver max1363_driver = {
 	.driver = {
 		.name = "max1363",
-		.of_match_table = of_match_ptr(max1363_of_match),
+		.of_match_table = max1363_of_match,
 	},
 	.probe = max1363_probe,
 	.remove = max1363_remove,
Signature · 1 line
2.27.0
author maintainer Applied
#12 lore raw

Re: [PATCH 05/23] iio:adc:max1363: Drop of_match_ptr and use generic device_get_match_data

Quoted 9 lines · On Sun, 28 Jun 2020 13:36:36 +0100 Jonathan Cameron <[email protected]> wrote:

From: Jonathan Cameron <[email protected]>

Allows driver to use ACPI PRP0001 binding and there was no particular advantage in having the protections in this driver.

Mostly this part of an effort to remove as many OF specific bits of handling from IIO and use the generic forms where possible.

Applied.

Thanks,

Jonathan

Quoted 54 lines
---
 drivers/iio/adc/max1363.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/iio/adc/max1363.c +4 -7
index d8da5da74b77..420e2ec154fc 100644
@@ -22,8 +22,8 @@
 #include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
+#include <linux/mod_devicetable.h>
+#include <linux/property.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -1529,8 +1529,6 @@ static irqreturn_t max1363_trigger_handler(int irq, void *p)
 	return IRQ_HANDLED;
 }
 
-#ifdef CONFIG_OF
-
 #define MAX1363_COMPATIBLE(of_compatible, cfg) {		\
 			.compatible = of_compatible,		\
 			.data = &max1363_chip_info_tbl[cfg],	\
@@ -1578,7 +1576,6 @@ static const struct of_device_id max1363_of_match[] = {
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, max1363_of_match);
-#endif
 
 static int max1363_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
@@ -1613,7 +1610,7 @@ static int max1363_probe(struct i2c_client *client,
 	/* this is only used for device removal purposes */
 	i2c_set_clientdata(client, indio_dev);
 
-	st->chip_info = of_device_get_match_data(&client->dev);
+	st->chip_info = device_get_match_data(&client->dev);
 	if (!st->chip_info)
 		st->chip_info = &max1363_chip_info_tbl[id->driver_data];
 	st->client = client;
@@ -1756,7 +1753,7 @@ MODULE_DEVICE_TABLE(i2c, max1363_id);
 static struct i2c_driver max1363_driver = {
 	.driver = {
 		.name = "max1363",
-		.of_match_table = of_match_ptr(max1363_of_match),
+		.of_match_table = max1363_of_match,
 	},
 	.probe = max1363_probe,
 	.remove = max1363_remove,
author maintainer
#13 lore raw

PATCH 6/23 iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

These just prevent the driver being used with ACPI PRP0001 and provide no major benefits.

Part of clearing these out in general in IIO to avoid cut and paste repetition in new drivers. Also include mod_devicetable.h as we directly make use of of_device_id which is defined in there.

Cc Miquel Raynal <[email protected]>
Cc Philippe Reynes <[email protected]>
---
 drivers/iio/adc/max1027.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max1027.c +2 -3
index 9e993ccd14de..ca1dff3924ff 100644
@@ -14,6 +14,7 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 #include <linux/delay.h>
 
@@ -79,7 +80,6 @@ static const struct spi_device_id max1027_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, max1027_id);
 
-#ifdef CONFIG_OF
 static const struct of_device_id max1027_adc_dt_ids[] = {
 	{ .compatible = "maxim,max1027" },
 	{ .compatible = "maxim,max1029" },
@@ -90,7 +90,6 @@ static const struct of_device_id max1027_adc_dt_ids[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids);
-#endif
 
 #define MAX1027_V_CHAN(index, depth)					\
 	{								\
@@ -518,7 +517,7 @@ static int max1027_probe(struct spi_device *spi)
 static struct spi_driver max1027_driver = {
 	.driver = {
 		.name	= "max1027",
-		.of_match_table = of_match_ptr(max1027_adc_dt_ids),
+		.of_match_table = max1027_adc_dt_ids,
 	},
 	.probe		= max1027_probe,
 	.id_table	= max1027_id,
Signature · 1 line
2.27.0
#14 lore raw

Re: [PATCH 06/23] iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections

Quoted 5 lines · On Sun, 28 Jun 2020 13:36:37 +0100 Jonathan Cameron <[email protected]> wrote:

From: Jonathan Cameron <[email protected]>

These just prevent the driver being used with ACPI PRP0001 and provide no major benefits.

Quoted 7 lines

Part of clearing these out in general in IIO to avoid cut and paste repetition in new drivers. Also include mod_devicetable.h as we directly make use of of_device_id which is defined in there.

Cc Miquel Raynal <[email protected]>
Cc Philippe Reynes <[email protected]>

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

Thanks,

Jonathan

Quoted 41 lines
---
 drivers/iio/adc/max1027.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max1027.c +2 -3
index 9e993ccd14de..ca1dff3924ff 100644
@@ -14,6 +14,7 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 #include <linux/delay.h>
 
@@ -79,7 +80,6 @@ static const struct spi_device_id max1027_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, max1027_id);
 
-#ifdef CONFIG_OF
 static const struct of_device_id max1027_adc_dt_ids[] = {
 	{ .compatible = "maxim,max1027" },
 	{ .compatible = "maxim,max1029" },
@@ -90,7 +90,6 @@ static const struct of_device_id max1027_adc_dt_ids[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids);
-#endif
 
 #define MAX1027_V_CHAN(index, depth)					\
 	{								\
@@ -518,7 +517,7 @@ static int max1027_probe(struct spi_device *spi)
 static struct spi_driver max1027_driver = {
 	.driver = {
 		.name	= "max1027",
-		.of_match_table = of_match_ptr(max1027_adc_dt_ids),
+		.of_match_table = max1027_adc_dt_ids,
 	},
 	.probe		= max1027_probe,
 	.id_table	= max1027_id,
author maintainer
#15 lore raw

PATCH 7/23 iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

The macro prevents use of driver with ACPI PRP0001 and the of_match_id structure is defined in mod_devicetable.h so include that directly rather than of.h.

Note this is mostly about removing something I don't want cut and paste into new drivers rather than expectation that this particular driver will be used on an ACPI platform.

Cc Uwe Kleine-König <[email protected]>
---
 drivers/iio/adc/ltc2496.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ltc2496.c +2 -2
index 88a30156a849..dd956a7c216e 100644
@@ -14,7 +14,7 @@
 #include <linux/iio/iio.h>
 #include <linux/iio/driver.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
 
 #include "ltc2497.h"
 
@@ -96,7 +96,7 @@ MODULE_DEVICE_TABLE(of, ltc2496_of_match);
 static struct spi_driver ltc2496_driver = {
 	.driver = {
 		.name = "ltc2496",
-		.of_match_table = of_match_ptr(ltc2496_of_match),
+		.of_match_table = ltc2496_of_match,
 	},
 	.probe = ltc2496_probe,
 	.remove = ltc2496_remove,
Signature · 1 line
2.27.0
Reviewed-by on v1 7/23
#16 lore raw

Re: [PATCH 07/23] iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h

Hallo Jonathan,

drivers/iio/adc/ltc2496.c MODULE_DEVICE_TABLE(of, ltc2496_of_match); · line 99

Quoted 6 lines · Jonathan Cameron
drivers/iio/adc/ltc2496.c +1 -1
@@ -96,7 +96,7 @@ MODULE_DEVICE_TABLE(of, ltc2496_of_match);
 static struct spi_driver ltc2496_driver = {
 	.driver = {
 		.name = "ltc2496",
-		.of_match_table = of_match_ptr(ltc2496_of_match),
+		.of_match_table = ltc2496_of_match,

The usage of of_match_ptr would only make sense here if ltc2496_of_match was defined conditionally. As this isn't the case:

Thanks
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
author maintainer
#17 lore raw

Re: [PATCH 07/23] iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h

Quoted 13 lines · On Sun, 28 Jun 2020 17:52:21 +0200 Uwe Kleine-König…

Hallo Jonathan,

drivers/iio/adc/ltc2496.c MODULE_DEVICE_TABLE(of, ltc2496_of_match); · line 99

Quoted 6 lines · Jonathan Cameron
drivers/iio/adc/ltc2496.c +1 -1
@@ -96,7 +96,7 @@ MODULE_DEVICE_TABLE(of, ltc2496_of_match);
 static struct spi_driver ltc2496_driver = {
 	.driver = {
 		.name = "ltc2496",
-		.of_match_table = of_match_ptr(ltc2496_of_match),
+		.of_match_table = ltc2496_of_match,  

The usage of of_match_ptr would only make sense here if ltc2496_of_match was defined conditionally. As this isn't the case:

Quoted 1 line

Thanks,

Applied to the togreg branch of iio.git and pushed out as testing to see if we missed anything.

Thanks,

Jonathan

Quoted 4 lines

Thanks
Uwe

author maintainer
#18 lore raw

PATCH 8/23 iio:adc:cpcap-adc: Drop of_match_ptr protection and use device_get_match_data

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Part of a slow effort to avoid OF specific code in IIO.

Whilst the main advantages of this are not likely to be seen in this particular driver (ACPI support via PRP0001) the change proposed does make things a bit more maintainable and also ensures that this particular (now) anti-patern is less likely to be cut and paste into new drivers.

---
 drivers/iio/adc/cpcap-adc.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
drivers/iio/adc/cpcap-adc.c +6 -16
index 004e7fee1fb2..cc26cf309638 100644
@@ -15,9 +15,9 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_platform.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 #include <linux/regmap.h>
 
 #include <linux/iio/buffer.h>
@@ -955,22 +955,10 @@ MODULE_DEVICE_TABLE(of, cpcap_adc_id_table);
 
 static int cpcap_adc_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	struct cpcap_adc *ddata;
 	struct iio_dev *indio_dev;
 	int error;
 
-	match = of_match_device(of_match_ptr(cpcap_adc_id_table),
-				&pdev->dev);
-	if (!match)
-		return -EINVAL;
-
-	if (!match->data) {
-		dev_err(&pdev->dev, "no configuration data found\n");
-
-		return -ENODEV;
-	}
-
 	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*ddata));
 	if (!indio_dev) {
 		dev_err(&pdev->dev, "failed to allocate iio device\n");
@@ -978,7 +966,9 @@ static int cpcap_adc_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 	ddata = iio_priv(indio_dev);
-	ddata->ato = match->data;
+	ddata->ato = device_get_match_data(&pdev->dev);
+	if (!ddata->ato)
+		return -ENODEV;
 	ddata->dev = &pdev->dev;
 
 	mutex_init(&ddata->lock);
@@ -1027,7 +1017,7 @@ static int cpcap_adc_probe(struct platform_device *pdev)
 static struct platform_driver cpcap_adc_driver = {
 	.driver = {
 		.name = "cpcap_adc",
-		.of_match_table = of_match_ptr(cpcap_adc_id_table),
+		.of_match_table = cpcap_adc_id_table,
 	},
 	.probe = cpcap_adc_probe,
 };
Signature · 1 line
2.27.0
Acked-by on v1 8/23
#19 lore raw

Re: [PATCH 08/23] iio:adc:cpcap-adc: Drop of_match_ptr protection and use device_get_match_data

Quoted 9 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Part of a slow effort to avoid OF specific code in IIO.

Whilst the main advantages of this are not likely to be seen in this particular driver (ACPI support via PRP0001) the change proposed does make things a bit more maintainable and also ensures that this particular (now) anti-patern is less likely to be cut and paste into new drivers.

author maintainer
#20 lore raw

Re: [PATCH 08/23] iio:adc:cpcap-adc: Drop of_match_ptr protection and use device_get_match_data

Quoted 5 lines · On Mon, 29 Jun 2020 08:21:11 -0700 Tony Lindgren <[email protected]> wrote:
Quoted 4 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Part of a slow effort to avoid OF specific code in IIO.

Quoted 7 lines
Quoted 5 lines

Whilst the main advantages of this are not likely to be seen in this particular driver (ACPI support via PRP0001) the change proposed does make things a bit more maintainable and also ensures that this particular (now) anti-patern is less likely to be cut and paste into new drivers.

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

Thanks,

Jonathan

author maintainer
#21 lore raw

PATCH 9/23 iio:adc:ltc2497 drop of_match_ptr protection

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

This prevents the driver being used with ACPI PRP0001 based bindings. Also switch include to mod_devicetable.h which devices the used id structure.

Note this is most about removing something I don't want want cut and paste into new driver rather than any thought that this particular driver will be used in an ACPI system (though it might!)

Cc Michael Hennerich <[email protected]>
Cc Uwe Kleine-König <[email protected]>
---
 drivers/iio/adc/ltc2497.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ltc2497.c +2 -2
index 5db63d7c6bc5..1adddf5a88a9 100644
@@ -11,7 +11,7 @@
 #include <linux/iio/iio.h>
 #include <linux/iio/driver.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
 
 #include "ltc2497.h"
 
@@ -98,7 +98,7 @@ MODULE_DEVICE_TABLE(of, ltc2497_of_match);
 static struct i2c_driver ltc2497_driver = {
 	.driver = {
 		.name = "ltc2497",
-		.of_match_table = of_match_ptr(ltc2497_of_match),
+		.of_match_table = ltc2497_of_match,
 	},
 	.probe = ltc2497_probe,
 	.remove = ltc2497_remove,
Signature · 1 line
2.27.0
Reviewed-by on v1 9/23
#22 lore raw

Re: [PATCH 09/23] iio:adc:ltc2497 drop of_match_ptr protection

Quoted 31 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

This prevents the driver being used with ACPI PRP0001 based bindings. Also switch include to mod_devicetable.h which devices the used id structure.

Note this is most about removing something I don't want want cut and paste into new driver rather than any thought that this particular driver will be used in an ACPI system (though it might!)

Cc Michael Hennerich <[email protected]>
Cc Uwe Kleine-König <[email protected]>
---
 drivers/iio/adc/ltc2497.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ltc2497.c +1 -1
index 5db63d7c6bc5..1adddf5a88a9 100644
@@ -11,7 +11,7 @@
 #include <linux/iio/iio.h>
 #include <linux/iio/driver.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
 
 #include "ltc2497.h"
 

drivers/iio/adc/ltc2497.c MODULE_DEVICE_TABLE(of, ltc2497_of_match); · line 101

Quoted 5 lines
drivers/iio/adc/ltc2497.c +1 -1
@@ -98,7 +98,7 @@ MODULE_DEVICE_TABLE(of, ltc2497_of_match);
 static struct i2c_driver ltc2497_driver = {
 	.driver = {
 		.name = "ltc2497",
-		.of_match_table = of_match_ptr(ltc2497_of_match),
+		.of_match_table = ltc2497_of_match,

This was the copy source of ltc2496_driver. there the change was fine, so it is here:

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
author maintainer
#23 lore raw

Re: [PATCH 09/23] iio:adc:ltc2497 drop of_match_ptr protection

Quoted 41 lines · On Sun, 28 Jun 2020 17:53:24 +0200 Uwe Kleine-König…
Quoted 31 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

This prevents the driver being used with ACPI PRP0001 based bindings. Also switch include to mod_devicetable.h which devices the used id structure.

Note this is most about removing something I don't want want cut and paste into new driver rather than any thought that this particular driver will be used in an ACPI system (though it might!)

Cc Michael Hennerich <[email protected]>
Cc Uwe Kleine-König <[email protected]>
---
 drivers/iio/adc/ltc2497.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ltc2497.c +1 -1
index 5db63d7c6bc5..1adddf5a88a9 100644
@@ -11,7 +11,7 @@
 #include <linux/iio/iio.h>
 #include <linux/iio/driver.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
 
 #include "ltc2497.h"
 

drivers/iio/adc/ltc2497.c MODULE_DEVICE_TABLE(of, ltc2497_of_match); · line 101

Quoted 5 lines
drivers/iio/adc/ltc2497.c +1 -1
@@ -98,7 +98,7 @@ MODULE_DEVICE_TABLE(of, ltc2497_of_match);
 static struct i2c_driver ltc2497_driver = {
 	.driver = {
 		.name = "ltc2497",
-		.of_match_table = of_match_ptr(ltc2497_of_match),
+		.of_match_table = ltc2497_of_match,  

This was the copy source of ltc2496_driver. there the change was fine, so it is here:

Quoted 1 line

Applied thanks,

J

Quoted 4 lines

Best regards
Uwe

author maintainer
#24 lore raw

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

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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)

---
 drivers/iio/adc/max11100.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/max11100.c +2 -1
index 57734f9742f6..77fcee1dddf7 100644
@@ -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,
Signature · 1 line
2.27.0
Acked-by on v1 10/23
#25 lore raw

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

Hi Jonathan,

Quoted 21 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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)

---
 drivers/iio/adc/max11100.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/max11100.c +0 -0
index 57734f9742f6..77fcee1dddf7 100644

drivers/iio/adc/max11100.c line 12

Quoted 4 lines
drivers/iio/adc/max11100.c +1 -0
@@ -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:

Thanks
j

Quoted 15 lines
drivers/iio/adc/max11100.c +1 -2
 #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

author maintainer
#26 lore raw

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

Quoted 18 lines · On Mon, 29 Jun 2020 09:28:09 +0200 Jacopo Mondi <[email protected]> wrote:

Hi Jonathan,

Quoted 16 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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)

---
 drivers/iio/adc/max11100.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 12 lines

drivers/iio/adc/max11100.c line 12

Quoted 9 lines
drivers/iio/adc/max11100.c +1 -0
index 57734f9742f6..77fcee1dddf7 100644
@@ -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 :)

Quoted 4 lines

That apart:

Thanks,

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

Jonathan

Quoted 18 lines

Thanks
j

Quoted 15 lines
drivers/iio/adc/max11100.c +1 -2
 #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

author maintainer
#27 lore raw

PATCH 11/23 iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

These just stop the driver being used with ACPI PRP0001 and we are trying to clear them out of IIO to avoid them getting copied into new drivers.
Also add the mod_devicetable.h include as we are using struct of_device_id which is defined in there.

---
 drivers/iio/adc/max1118.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/iio/adc/max1118.c +2 -5
index 273fbea2a515..01b20e420ac4 100644
@@ -18,6 +18,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
@@ -280,8 +281,6 @@ static const struct spi_device_id max1118_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, max1118_id);
 
-#ifdef CONFIG_OF
-
 static const struct of_device_id max1118_dt_ids[] = {
 	{ .compatible = "maxim,max1117" },
 	{ .compatible = "maxim,max1118" },
@@ -290,12 +289,10 @@ static const struct of_device_id max1118_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, max1118_dt_ids);
 
-#endif
-
 static struct spi_driver max1118_spi_driver = {
 	.driver = {
 		.name = "max1118",
-		.of_match_table = of_match_ptr(max1118_dt_ids),
+		.of_match_table = max1118_dt_ids,
 	},
 	.probe = max1118_probe,
 	.remove = max1118_remove,
Signature · 1 line
2.27.0
author maintainer Applied
#28 lore raw

Re: [PATCH 11/23] iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections

Quoted 10 lines · On Sun, 28 Jun 2020 13:36:42 +0100 Jonathan Cameron <[email protected]> wrote:

From: Jonathan Cameron <[email protected]>

These just stop the driver being used with ACPI PRP0001 and we are trying to clear them out of IIO to avoid them getting copied into new drivers.
Also add the mod_devicetable.h include as we are using struct of_device_id which is defined in there.

Applied.

Thanks,

Jonathan

Quoted 39 lines
---
 drivers/iio/adc/max1118.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/iio/adc/max1118.c +2 -5
index 273fbea2a515..01b20e420ac4 100644
@@ -18,6 +18,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
@@ -280,8 +281,6 @@ static const struct spi_device_id max1118_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, max1118_id);
 
-#ifdef CONFIG_OF
-
 static const struct of_device_id max1118_dt_ids[] = {
 	{ .compatible = "maxim,max1117" },
 	{ .compatible = "maxim,max1118" },
@@ -290,12 +289,10 @@ static const struct of_device_id max1118_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, max1118_dt_ids);
 
-#endif
-
 static struct spi_driver max1118_spi_driver = {
 	.driver = {
 		.name = "max1118",
-		.of_match_table = of_match_ptr(max1118_dt_ids),
+		.of_match_table = max1118_dt_ids,
 	},
 	.probe = max1118_probe,
 	.remove = max1118_remove,
author maintainer
#29 lore raw

PATCH 12/23 iio:adc:mcp320x: Drop CONFIG_OF and of_match_ptr protections

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

These just prevent the driver being used with ACPI PRP0001. They also get cut and paste into new drivers and we want to discourage this from happening by cleaning it out in general.

Cc Oskar Andero <[email protected]>
Cc Søren Andersen <[email protected]>
Cc Lukas Wunner <[email protected]>
---
 drivers/iio/adc/mcp320x.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/mcp320x.c +2 -3
index e533f1064cf8..bb37e66ff7dc 100644
@@ -41,6 +41,7 @@
 #include <linux/delay.h>
 #include <linux/spi/spi.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/iio/iio.h>
 #include <linux/regulator/consumer.h>
 
@@ -469,7 +470,6 @@ static int mcp320x_remove(struct spi_device *spi)
 	return 0;
 }
 
-#if defined(CONFIG_OF)
 static const struct of_device_id mcp320x_dt_ids[] = {
 	/* NOTE: The use of compatibles with no vendor prefix is deprecated. */
 	{ .compatible = "mcp3001" },
@@ -497,7 +497,6 @@ static const struct of_device_id mcp320x_dt_ids[] = {
 	{ }
 };
 MODULE_DEVICE_TABLE(of, mcp320x_dt_ids);
-#endif
 
 static const struct spi_device_id mcp320x_id[] = {
 	{ "mcp3001", mcp3001 },
@@ -520,7 +519,7 @@ MODULE_DEVICE_TABLE(spi, mcp320x_id);
 static struct spi_driver mcp320x_driver = {
 	.driver = {
 		.name = "mcp320x",
-		.of_match_table = of_match_ptr(mcp320x_dt_ids),
+		.of_match_table = mcp320x_dt_ids,
 	},
 	.probe = mcp320x_probe,
 	.remove = mcp320x_remove,
Signature · 1 line
2.27.0
author maintainer Applied
#30 lore raw

Re: [PATCH 12/23] iio:adc:mcp320x: Drop CONFIG_OF and of_match_ptr protections

Quoted 10 lines · On Sun, 28 Jun 2020 13:36:43 +0100 Jonathan Cameron <[email protected]> wrote:

From: Jonathan Cameron <[email protected]>

These just prevent the driver being used with ACPI PRP0001. They also get cut and paste into new drivers and we want to discourage this from happening by cleaning it out in general.

Cc Oskar Andero <[email protected]>
Cc Søren Andersen <[email protected]>
Cc Lukas Wunner <[email protected]>

Applied

Quoted 41 lines
---
 drivers/iio/adc/mcp320x.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/mcp320x.c +2 -3
index e533f1064cf8..bb37e66ff7dc 100644
@@ -41,6 +41,7 @@
 #include <linux/delay.h>
 #include <linux/spi/spi.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/iio/iio.h>
 #include <linux/regulator/consumer.h>
 
@@ -469,7 +470,6 @@ static int mcp320x_remove(struct spi_device *spi)
 	return 0;
 }
 
-#if defined(CONFIG_OF)
 static const struct of_device_id mcp320x_dt_ids[] = {
 	/* NOTE: The use of compatibles with no vendor prefix is deprecated. */
 	{ .compatible = "mcp3001" },
@@ -497,7 +497,6 @@ static const struct of_device_id mcp320x_dt_ids[] = {
 	{ }
 };
 MODULE_DEVICE_TABLE(of, mcp320x_dt_ids);
-#endif
 
 static const struct spi_device_id mcp320x_id[] = {
 	{ "mcp3001", mcp3001 },
@@ -520,7 +519,7 @@ MODULE_DEVICE_TABLE(spi, mcp320x_id);
 static struct spi_driver mcp320x_driver = {
 	.driver = {
 		.name = "mcp320x",
-		.of_match_table = of_match_ptr(mcp320x_dt_ids),
+		.of_match_table = mcp320x_dt_ids,
 	},
 	.probe = mcp320x_probe,
 	.remove = mcp320x_remove,
author maintainer
#31 lore raw

PATCH 13/23 iio:adc:mcp3422: remove CONFIG_OF and of_match_ptr protections

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

They stop the driver being used with ACPI PRP0001 and are something I want to avoid being cut and paste into new drivers. Also switch the include from of.h to mod_devicetable.h as we struct of_device_id is defined in there and we don't use anything actually in of.h.

Cc Angelo Compagnucci <[email protected]>
---
 drivers/iio/adc/mcp3422.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/mcp3422.c +2 -4
index 40e0d3ed05a5..ec9c79199ffb 100644
@@ -16,9 +16,9 @@
 #include <linux/err.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/delay.h>
 #include <linux/sysfs.h>
-#include <linux/of.h>
 #include <asm/unaligned.h>
 
 #include <linux/iio/iio.h>
@@ -402,18 +402,16 @@ static const struct i2c_device_id mcp3422_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, mcp3422_id);
 
-#ifdef CONFIG_OF
 static const struct of_device_id mcp3422_of_match[] = {
 	{ .compatible = "mcp3422" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, mcp3422_of_match);
-#endif
 
 static struct i2c_driver mcp3422_driver = {
 	.driver = {
 		.name = "mcp3422",
-		.of_match_table = of_match_ptr(mcp3422_of_match),
+		.of_match_table = mcp3422_of_match,
 	},
 	.probe = mcp3422_probe,
 	.id_table = mcp3422_id,
Signature · 1 line
2.27.0
author maintainer Applied
#32 lore raw

Re: [PATCH 13/23] iio:adc:mcp3422: remove CONFIG_OF and of_match_ptr protections

Quoted 10 lines · On Sun, 28 Jun 2020 13:36:44 +0100 Jonathan Cameron <[email protected]> wrote:

From: Jonathan Cameron <[email protected]>

They stop the driver being used with ACPI PRP0001 and are something I want to avoid being cut and paste into new drivers. Also switch the include from of.h to mod_devicetable.h as we struct of_device_id is defined in there and we don't use anything actually in of.h.

Cc Angelo Compagnucci <[email protected]>

Applied.

Thanks,

Jonathan

Quoted 39 lines
---
 drivers/iio/adc/mcp3422.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/mcp3422.c +2 -4
index 40e0d3ed05a5..ec9c79199ffb 100644
@@ -16,9 +16,9 @@
 #include <linux/err.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/delay.h>
 #include <linux/sysfs.h>
-#include <linux/of.h>
 #include <asm/unaligned.h>
 
 #include <linux/iio/iio.h>
@@ -402,18 +402,16 @@ static const struct i2c_device_id mcp3422_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, mcp3422_id);
 
-#ifdef CONFIG_OF
 static const struct of_device_id mcp3422_of_match[] = {
 	{ .compatible = "mcp3422" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, mcp3422_of_match);
-#endif
 
 static struct i2c_driver mcp3422_driver = {
 	.driver = {
 		.name = "mcp3422",
-		.of_match_table = of_match_ptr(mcp3422_of_match),
+		.of_match_table = mcp3422_of_match,
 	},
 	.probe = mcp3422_probe,
 	.id_table = mcp3422_id,
author maintainer
#33 lore raw

PATCH 14/23 iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Dropping of_match_ptr allows this driver to be used with ACPI. The header includes are adjusted to include platform_device.h and mod_devicetable.h instead of OF specific header as nothing from that header itself is actually used.

---
 drivers/iio/adc/sd_adc_modulator.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/adc/sd_adc_modulator.c +3 -2
index 1d6c246609c8..327cc2097f6c 100644
@@ -9,7 +9,8 @@
 #include <linux/iio/iio.h>
 #include <linux/iio/triggered_buffer.h>
 #include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/mod_devicetable.h>
+#include <linux/platform_device.h>
 
 static const struct iio_info iio_sd_mod_iio_info;
 
@@ -54,7 +55,7 @@ MODULE_DEVICE_TABLE(of, sd_adc_of_match);
 static struct platform_driver iio_sd_mod_adc = {
 	.driver = {
 		.name = "iio_sd_adc_mod",
-		.of_match_table = of_match_ptr(sd_adc_of_match),
+		.of_match_table = sd_adc_of_match,
 	},
 	.probe = iio_sd_mod_probe,
 };
Signature · 1 line
2.27.0
author maintainer Applied
#34 lore raw

Re: [PATCH 14/23] iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes

Quoted 9 lines · On Sun, 28 Jun 2020 13:36:45 +0100 Jonathan Cameron <[email protected]> wrote:

From: Jonathan Cameron <[email protected]>

Dropping of_match_ptr allows this driver to be used with ACPI. The header includes are adjusted to include platform_device.h and mod_devicetable.h instead of OF specific header as nothing from that header itself is actually used.

Applied.

Thanks,

J

Quoted 27 lines
---
 drivers/iio/adc/sd_adc_modulator.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/adc/sd_adc_modulator.c +3 -2
index 1d6c246609c8..327cc2097f6c 100644
@@ -9,7 +9,8 @@
 #include <linux/iio/iio.h>
 #include <linux/iio/triggered_buffer.h>
 #include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/mod_devicetable.h>
+#include <linux/platform_device.h>
 
 static const struct iio_info iio_sd_mod_iio_info;
 
@@ -54,7 +55,7 @@ MODULE_DEVICE_TABLE(of, sd_adc_of_match);
 static struct platform_driver iio_sd_mod_adc = {
 	.driver = {
 		.name = "iio_sd_adc_mod",
-		.of_match_table = of_match_ptr(sd_adc_of_match),
+		.of_match_table = sd_adc_of_match,
 	},
 	.probe = iio_sd_mod_probe,
 };
author maintainer
#35 lore raw

PATCH 15/23 iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Whilst this driver already supports explicit ACPI bindings we might as well also allow for PRP0001 based binding.

I'm also keen to remove of_match_ptr from IIO drivers to avoid this (now) anti-pattern getting coppied into new drivers.

---
 drivers/iio/adc/ti-adc081c.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-adc081c.c +2 -4
index 82e524b3db88..e00350e6503f 100644
@@ -18,7 +18,7 @@
 #include <linux/err.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
 #include <linux/acpi.h>
 
 #include <linux/iio/iio.h>
@@ -230,7 +230,6 @@ static const struct i2c_device_id adc081c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adc081c_id);
 
-#ifdef CONFIG_OF
 static const struct of_device_id adc081c_of_match[] = {
 	{ .compatible = "ti,adc081c" },
 	{ .compatible = "ti,adc101c" },
@@ -238,7 +237,6 @@ static const struct of_device_id adc081c_of_match[] = {
 	{ }
 };
 MODULE_DEVICE_TABLE(of, adc081c_of_match);
-#endif
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id adc081c_acpi_match[] = {
@@ -253,7 +251,7 @@ MODULE_DEVICE_TABLE(acpi, adc081c_acpi_match);
 static struct i2c_driver adc081c_driver = {
 	.driver = {
 		.name = "adc081c",
-		.of_match_table = of_match_ptr(adc081c_of_match),
+		.of_match_table = adc081c_of_match,
 		.acpi_match_table = ACPI_PTR(adc081c_acpi_match),
 	},
 	.probe = adc081c_probe,
Signature · 1 line
2.27.0
#36 lore raw

Re: [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h

Quoted 9 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Whilst this driver already supports explicit ACPI bindings we might as well also allow for PRP0001 based binding.

I'm also keen to remove of_match_ptr from IIO drivers to avoid this (now) anti-pattern getting coppied into new drivers.

Code LGTM, but see below.

Quoted 27 lines
---
 drivers/iio/adc/ti-adc081c.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-adc081c.c +1 -2
index 82e524b3db88..e00350e6503f 100644
@@ -18,7 +18,7 @@
 #include <linux/err.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
 #include <linux/acpi.h>
 
 #include <linux/iio/iio.h>
@@ -230,7 +230,6 @@ static const struct i2c_device_id adc081c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adc081c_id);
 
-#ifdef CONFIG_OF
 static const struct of_device_id adc081c_of_match[] = {
        { .compatible = "ti,adc081c" },
        { .compatible = "ti,adc101c" },

drivers/iio/adc/ti-adc081c.c static const struct of_device_id adc081c_of_match[] = { · line 242

Quoted 7 lines
drivers/iio/adc/ti-adc081c.c +0 -1
@@ -238,7 +237,6 @@ static const struct of_device_id adc081c_of_match[] = {
        { }
 };
 MODULE_DEVICE_TABLE(of, adc081c_of_match);
-#endif
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id adc081c_acpi_match[] = {

These IDs seem to me artificial (and non-official). Perhaps in a separate patch remove them?
Or do we have confirmation (in writing) from TI that these are okay?

Quoted 12 lines
drivers/iio/adc/ti-adc081c.c +1 -2
@@ -253,7 +251,7 @@ MODULE_DEVICE_TABLE(acpi, adc081c_acpi_match);
 static struct i2c_driver adc081c_driver = {
        .driver = {
                .name = "adc081c",
-               .of_match_table = of_match_ptr(adc081c_of_match),
+               .of_match_table = adc081c_of_match,
                .acpi_match_table = ACPI_PTR(adc081c_acpi_match),
        },
        .probe = adc081c_probe,
--

2.27.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#37 lore raw

Re: [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h

Quoted 45 lines · On Tue, 30 Jun 2020 10:12:51 +0300 Andy Shevchenko <[email protected]>…
Quoted 9 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Whilst this driver already supports explicit ACPI bindings we might as well also allow for PRP0001 based binding.

I'm also keen to remove of_match_ptr from IIO drivers to avoid this (now) anti-pattern getting coppied into new drivers.

Code LGTM, but see below.

Quoted 32 lines
---
 drivers/iio/adc/ti-adc081c.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-adc081c.c +1 -3
index 82e524b3db88..e00350e6503f 100644
@@ -18,7 +18,7 @@
 #include <linux/err.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
 #include <linux/acpi.h>
 
 #include <linux/iio/iio.h>
@@ -230,7 +230,6 @@ static const struct i2c_device_id adc081c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adc081c_id);
 
-#ifdef CONFIG_OF
 static const struct of_device_id adc081c_of_match[] = {
        { .compatible = "ti,adc081c" },
        { .compatible = "ti,adc101c" },
@@ -238,7 +237,6 @@ static const struct of_device_id adc081c_of_match[] = {
        { }
 };
 MODULE_DEVICE_TABLE(of, adc081c_of_match);
-#endif
 
Quoted 6 lines

drivers/iio/adc/ti-adc081c.c static const struct of_device_id adc081c_of_match[] = { · line 242

Quoted 2 lines
drivers/iio/adc/ti-adc081c.c +0 -0
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id adc081c_acpi_match[] = {  

These IDs seem to me artificial (and non-official). Perhaps in a separate patch remove them?
Or do we have confirmation (in writing) from TI that these are okay?

+CC Dan O'Donovan,

It seems highly unlikely these are 'official'.

Dan. You added them, can you give us some background (admittedly 4 years ago so you may not recall!)

Unfortunately I was rather less aware of ACPI than I have become in the meantime, so let these in without questioning them.

If we have these out there in in the wild, we can still add a note to make it clear that people should avoid using them in future, or copying the approach in other drivers.

Jonathan

Quoted 15 lines
Quoted 13 lines
drivers/iio/adc/ti-adc081c.c +1 -2
@@ -253,7 +251,7 @@ MODULE_DEVICE_TABLE(acpi, adc081c_acpi_match);
 static struct i2c_driver adc081c_driver = {
        .driver = {
                .name = "adc081c",
-               .of_match_table = of_match_ptr(adc081c_of_match),
+               .of_match_table = adc081c_of_match,
                .acpi_match_table = ACPI_PTR(adc081c_acpi_match),
        },
        .probe = adc081c_probe,
--

2.27.0

#38 lore raw

Re: [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h

Quoted 61 lines · On Sat, 4 Jul 2020 16:45:05 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 45 lines · On Tue, 30 Jun 2020 10:12:51 +0300 Andy Shevchenko <[email protected]>…
Quoted 9 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Whilst this driver already supports explicit ACPI bindings we might as well also allow for PRP0001 based binding.

I'm also keen to remove of_match_ptr from IIO drivers to avoid this (now) anti-pattern getting coppied into new drivers.

Code LGTM, but see below.

Quoted 32 lines
---
 drivers/iio/adc/ti-adc081c.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-adc081c.c +1 -3
index 82e524b3db88..e00350e6503f 100644
@@ -18,7 +18,7 @@
 #include <linux/err.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
 #include <linux/acpi.h>
 
 #include <linux/iio/iio.h>
@@ -230,7 +230,6 @@ static const struct i2c_device_id adc081c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adc081c_id);
 
-#ifdef CONFIG_OF
 static const struct of_device_id adc081c_of_match[] = {
        { .compatible = "ti,adc081c" },
        { .compatible = "ti,adc101c" },
@@ -238,7 +237,6 @@ static const struct of_device_id adc081c_of_match[] = {
        { }
 };
 MODULE_DEVICE_TABLE(of, adc081c_of_match);
-#endif
 
Quoted 6 lines

drivers/iio/adc/ti-adc081c.c static const struct of_device_id adc081c_of_match[] = { · line 242

Quoted 2 lines
drivers/iio/adc/ti-adc081c.c +0 -0
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id adc081c_acpi_match[] = {    

These IDs seem to me artificial (and non-official). Perhaps in a separate patch remove them?
Or do we have confirmation (in writing) from TI that these are okay?

+CC Dan O'Donovan,

It seems highly unlikely these are 'official'.

Dan. You added them, can you give us some background (admittedly 4 years ago so you may not recall!)

Quoted 7 lines

Unfortunately I was rather less aware of ACPI than I have become in the meantime, so let these in without questioning them.

If we have these out there in in the wild, we can still add a note to make it clear that people should avoid using them in future, or copying the approach in other drivers.

As this is a separate issue (kind of) I've applied this patch and we can address whether to remove the ACPI bindings separately.

Thanks,

Jonathan

Quoted 18 lines

Jonathan

Quoted 15 lines
Quoted 13 lines
drivers/iio/adc/ti-adc081c.c +1 -2
@@ -253,7 +251,7 @@ MODULE_DEVICE_TABLE(acpi, adc081c_acpi_match);
 static struct i2c_driver adc081c_driver = {
        .driver = {
                .name = "adc081c",
-               .of_match_table = of_match_ptr(adc081c_of_match),
+               .of_match_table = adc081c_of_match,
                .acpi_match_table = ACPI_PTR(adc081c_acpi_match),
        },
        .probe = adc081c_probe,
--

2.27.0

#39 lore raw

Re: [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h

Quoted 5 lines · Jonathan Cameron
Quoted 3 lines · On Sat, 4 Jul 2020 16:45:05 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 1 line · On Tue, 30 Jun 2020 10:12:51 +0300 Andy Shevchenko <[email protected]>…

On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <[email protected]> wrote:

...

Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

#ifdef CONFIG_ACPI
static const struct acpi_device_id adc081c_acpi_match[] = {

These IDs seem to me artificial (and non-official). Perhaps in a separate patch remove them?
Or do we have confirmation (in writing) from TI that these are okay?

+CC Dan O'Donovan,

It seems highly unlikely these are 'official'.

+1 here.

Quoted 6 lines
Quoted 6 lines

Dan. You added them, can you give us some background (admittedly 4 years ago so you may not recall!)

Unfortunately I was rather less aware of ACPI than I have become in the meantime, so let these in without questioning them.

Quoted 6 lines
Quoted 4 lines

If we have these out there in in the wild, we can still add a note to make it clear that people should avoid using them in future, or copying the approach in other drivers.

As this is a separate issue (kind of) I've applied this patch and we can address whether to remove the ACPI bindings separately.

Agree. Just to mention one more time that this shouldn't be forgotten. Also we can ask somebody from TI.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#40 lore raw

PATCH 16/23 iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

These just prevent the driver being used with ACPI PRP0001.

I am also trying to remove these from IIO in general to avoid them being coppied into new drivers.

Also include the mod_devicetable.h header as we are using of_device_id which is defined in there.

---
 drivers/iio/adc/ti-adc0832.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/iio/adc/ti-adc0832.c +2 -5
index 3eb3ba5fb610..05061dc05b32 100644
@@ -8,6 +8,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 #include <linux/iio/iio.h>
 #include <linux/regulator/consumer.h>
@@ -313,8 +314,6 @@ static int adc0832_remove(struct spi_device *spi)
 	return 0;
 }
 
-#ifdef CONFIG_OF
-
 static const struct of_device_id adc0832_dt_ids[] = {
 	{ .compatible = "ti,adc0831", },
 	{ .compatible = "ti,adc0832", },
@@ -324,8 +323,6 @@ static const struct of_device_id adc0832_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, adc0832_dt_ids);
 
-#endif
-
 static const struct spi_device_id adc0832_id[] = {
 	{ "adc0831", adc0831 },
 	{ "adc0832", adc0832 },
@@ -338,7 +335,7 @@ MODULE_DEVICE_TABLE(spi, adc0832_id);
 static struct spi_driver adc0832_driver = {
 	.driver = {
 		.name = "adc0832",
-		.of_match_table = of_match_ptr(adc0832_dt_ids),
+		.of_match_table = adc0832_dt_ids,
 	},
 	.probe = adc0832_probe,
 	.remove = adc0832_remove,
Signature · 1 line
2.27.0
author maintainer
#41 lore raw

Re: [PATCH 16/23] iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections

Quoted 4 lines · On Sun, 28 Jun 2020 13:36:47 +0100 Jonathan Cameron <[email protected]> wrote:

From: Jonathan Cameron <[email protected]>

These just prevent the driver being used with ACPI PRP0001.

Quoted 8 lines

I am also trying to remove these from IIO in general to avoid them being coppied into new drivers.

Also include the mod_devicetable.h header as we are using of_device_id which is defined in there.

Applied thanks

J

Quoted 43 lines
---
 drivers/iio/adc/ti-adc0832.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/iio/adc/ti-adc0832.c +2 -5
index 3eb3ba5fb610..05061dc05b32 100644
@@ -8,6 +8,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 #include <linux/iio/iio.h>
 #include <linux/regulator/consumer.h>
@@ -313,8 +314,6 @@ static int adc0832_remove(struct spi_device *spi)
 	return 0;
 }
 
-#ifdef CONFIG_OF
-
 static const struct of_device_id adc0832_dt_ids[] = {
 	{ .compatible = "ti,adc0831", },
 	{ .compatible = "ti,adc0832", },
@@ -324,8 +323,6 @@ static const struct of_device_id adc0832_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, adc0832_dt_ids);
 
-#endif
-
 static const struct spi_device_id adc0832_id[] = {
 	{ "adc0831", adc0831 },
 	{ "adc0832", adc0832 },
@@ -338,7 +335,7 @@ MODULE_DEVICE_TABLE(spi, adc0832_id);
 static struct spi_driver adc0832_driver = {
 	.driver = {
 		.name = "adc0832",
-		.of_match_table = of_match_ptr(adc0832_dt_ids),
+		.of_match_table = adc0832_dt_ids,
 	},
 	.probe = adc0832_probe,
 	.remove = adc0832_remove,
author maintainer
#42 lore raw

PATCH 17/23 iio:adc:ti-adc084s021: drop of_match_ptr protection

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Allows ACPI PRP0001 to be used with this driver.
Also adds mod_devicetable.h header as the driver is directly using struct of_device_id which is defined in that file.

I'm also trying to clear out of_match_ptr use in IIO to avoid it being cut and paste into new drivers.

---
 drivers/iio/adc/ti-adc084s021.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-adc084s021.c +2 -1
index c2db2435f419..5678bf7499b1 100644
@@ -10,6 +10,7 @@
 #include <linux/err.h>
 #include <linux/spi/spi.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/interrupt.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
@@ -254,7 +255,7 @@ MODULE_DEVICE_TABLE(spi, adc084s021_id);
 static struct spi_driver adc084s021_driver = {
 	.driver = {
 		.name = ADC084S021_DRIVER_NAME,
-		.of_match_table = of_match_ptr(adc084s021_of_match),
+		.of_match_table = adc084s021_of_match,
 	},
 	.probe = adc084s021_probe,
 	.id_table = adc084s021_id,
Signature · 1 line
2.27.0
author maintainer Applied
#43 lore raw

Re: [PATCH 17/23] iio:adc:ti-adc084s021: drop of_match_ptr protection

Quoted 11 lines · On Sun, 28 Jun 2020 13:36:48 +0100 Jonathan Cameron <[email protected]> wrote:

From: Jonathan Cameron <[email protected]>

Allows ACPI PRP0001 to be used with this driver.
Also adds mod_devicetable.h header as the driver is directly using struct of_device_id which is defined in that file.

I'm also trying to clear out of_match_ptr use in IIO to avoid it being cut and paste into new drivers.

Applied.

Thanks,

Jonathan

Quoted 25 lines
---
 drivers/iio/adc/ti-adc084s021.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-adc084s021.c +2 -1
index c2db2435f419..5678bf7499b1 100644
@@ -10,6 +10,7 @@
 #include <linux/err.h>
 #include <linux/spi/spi.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/interrupt.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
@@ -254,7 +255,7 @@ MODULE_DEVICE_TABLE(spi, adc084s021_id);
 static struct spi_driver adc084s021_driver = {
 	.driver = {
 		.name = ADC084S021_DRIVER_NAME,
-		.of_match_table = of_match_ptr(adc084s021_of_match),
+		.of_match_table = adc084s021_of_match,
 	},
 	.probe = adc084s021_probe,
 	.id_table = adc084s021_id,
author maintainer
#44 lore raw

PATCH 18/23 iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Although this driver has an explicit ACPI binding it is good to also allow for PRP0001 use of the of_match_id table.

I'm also 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.

---
 drivers/iio/adc/ti-adc108s102.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/ti-adc108s102.c +2 -3
index 9b9b27415c93..183b2245e89b 100644
@@ -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,
Signature · 1 line
2.27.0
#45 lore raw

Re: [PATCH 18/23] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections

Quoted 12 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Although this driver has an explicit ACPI binding it is good to also allow for PRP0001 use of the of_match_id table.

I'm also 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.

I think this is not needed. At least the commit message in this case is misleading.
We have only one ID and ACPI already has it. So, there is no need for this patch from that perspective.

Quoted 44 lines
---
 drivers/iio/adc/ti-adc108s102.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/ti-adc108s102.c +2 -4
index 9b9b27415c93..183b2245e89b 100644
@@ -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

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#46 lore raw

Re: [PATCH 18/23] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections

Quoted 10 lines · On Tue, 30 Jun 2020 10:20:55 +0300 Andy Shevchenko <[email protected]>…
Quoted 9 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Although this driver has an explicit ACPI binding it is good to also allow for PRP0001 use of the of_match_id table.

I'm also trying to clean this (now) anti-pattern out of IIO to avoid cut and paste into new drivers.

Quoted 8 lines
Quoted 3 lines

Also add an include of mod_devicetable.h as the driver directly uses struct of_device_id which is defined in there.

I think this is not needed. At least the commit message in this case is misleading.
We have only one ID and ACPI already has it. So, there is no need for this patch from that perspective.

It would be a bit odd if non Intel boards used an Intel ID for a TI part. Particularly I as can't immediately find any public docs of the ID. Do you know if these are documented publicly anywhere?

I know we don't do this in an ideal fashion as we have an internal registry but I don't think we publish it anywhere, but then we don't really expect anyone else to use them. I'm not aware of us having issued IDs for parts made by anyone other than ourselves.

So in general I'd rather we gave the option for using the dt binding PRP0001 route in addition to the intel ACPI ID.

Thanks,

Jonathan

Quoted 47 lines
Quoted 45 lines
---
 drivers/iio/adc/ti-adc108s102.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/ti-adc108s102.c +2 -4
index 9b9b27415c93..183b2245e89b 100644
@@ -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

#47 lore raw

Re: [PATCH 18/23] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections

Quoted 18 lines · Jonathan Cameron
Quoted 14 lines · On Tue, 30 Jun 2020 10:20:55 +0300 Andy Shevchenko <[email protected]>…
Quoted 12 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Although this driver has an explicit ACPI binding it is good to also allow for PRP0001 use of the of_match_id table.

I'm also 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.

Quoted 8 lines
Quoted 4 lines

I think this is not needed. At least the commit message in this case is misleading.
We have only one ID and ACPI already has it. So, there is no need for this patch from that perspective.

It would be a bit odd if non Intel boards used an Intel ID for a TI part. Particularly I as can't immediately find any public docs of the ID. Do you know if these are documented publicly anywhere?

Unfortunately it's vendor specific stuff, only vendor prefixes are documented on uefi.org.
And it's fine to use an already existing ID for the component from the same company.
The thing is that this is a really discrete component from TI on Intel Galileo board.

Quoted 7 lines

I know we don't do this in an ideal fashion as we have an internal registry but I don't think we publish it anywhere, but then we don't really expect anyone else to use them. I'm not aware of us having issued IDs for parts made by anyone other than ourselves.

So in general I'd rather we gave the option for using the dt binding PRP0001 route in addition to the intel ACPI ID.

I'm not against the clean up in code, but I don't think it is good to encourage users to use PRP0001 when the ACPI ID is already allocated (doesn't matter by whom).

So, I would recommend to leave the change, but rephrase the commit message to avoid PRP0001 mentioning.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#48 lore raw

PATCH 19/23 iio:adc:ti-adc128s052: drop of_match_ptr protection

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

There is no real advantage in this and it prevents use of ACPI PRP0001. I'm also trying to clear this out of IIO in general to avoid copying in new drivers.

Include mod_devicetable.h as we are using of_device_id in here so including that header is best practice.

Cc Angelo Compagnucci <[email protected]>
---
 drivers/iio/adc/ti-adc128s052.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-adc128s052.c +2 -1
index c1552b0fee04..cc3fb2d1686a 100644
@@ -13,6 +13,7 @@
 #include <linux/err.h>
 #include <linux/spi/spi.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/iio/iio.h>
 #include <linux/property.h>
 #include <linux/regulator/consumer.h>
@@ -220,7 +221,7 @@ MODULE_DEVICE_TABLE(acpi, adc128_acpi_match);
 static struct spi_driver adc128_driver = {
 	.driver = {
 		.name = "adc128s052",
-		.of_match_table = of_match_ptr(adc128_of_match),
+		.of_match_table = adc128_of_match,
 		.acpi_match_table = ACPI_PTR(adc128_acpi_match),
 	},
 	.probe = adc128_probe,
Signature · 1 line
2.27.0
#49 lore raw

Re: [PATCH 19/23] iio:adc:ti-adc128s052: drop of_match_ptr protection

Quoted 9 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

There is no real advantage in this and it prevents use of ACPI PRP0001. I'm also trying to clear this out of IIO in general to avoid copying in new drivers.

Include mod_devicetable.h as we are using of_device_id in here so including that header is best practice.

Similar comment as per previous patch. ACPI has an official ID at least for one component. So, we encourage vendors to provide proper ID.
That said, the commit message is misleading a bit here (it might be useful for the components which are not supported by existing ACPI ID.

Quoted 30 lines
Cc Angelo Compagnucci <[email protected]>
---
 drivers/iio/adc/ti-adc128s052.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-adc128s052.c +2 -2
index c1552b0fee04..cc3fb2d1686a 100644
@@ -13,6 +13,7 @@
 #include <linux/err.h>
 #include <linux/spi/spi.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/iio/iio.h>
 #include <linux/property.h>
 #include <linux/regulator/consumer.h>
@@ -220,7 +221,7 @@ MODULE_DEVICE_TABLE(acpi, adc128_acpi_match);
 static struct spi_driver adc128_driver = {
        .driver = {
                .name = "adc128s052",
-               .of_match_table = of_match_ptr(adc128_of_match),
+               .of_match_table = adc128_of_match,
                .acpi_match_table = ACPI_PTR(adc128_acpi_match),
        },
        .probe = adc128_probe,
--

2.27.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#50 lore raw

Re: [PATCH 19/23] iio:adc:ti-adc128s052: drop of_match_ptr protection

Quoted 8 lines · On Tue, 30 Jun 2020 10:22:45 +0300 Andy Shevchenko <[email protected]>…
Quoted 7 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

There is no real advantage in this and it prevents use of ACPI PRP0001. I'm also trying to clear this out of IIO in general to avoid copying in new drivers.

Quoted 6 lines
Quoted 2 lines

Include mod_devicetable.h as we are using of_device_id in here so including that header is best practice.

Similar comment as per previous patch. ACPI has an official ID at least for one component. So, we encourage vendors to provide proper ID.

The problem is that not all vendors have an ACPI manufacturer ID (or a PNP one). They could probably get one but smaller manufacturers are never going to bother.

Quoted 2 lines

That said, the commit message is misleading a bit here (it might be useful for the components which are not supported by existing ACPI ID.

I'm a bit dubious about encouraging people to use an Intel ID. If it were issued by TI for a TI part that would be a different matter.

Obviously there is no problem with Intel issuing an ID, or anyone else doing so.

Jonathan

Quoted 34 lines
Quoted 32 lines
Cc Angelo Compagnucci <[email protected]>
---
 drivers/iio/adc/ti-adc128s052.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-adc128s052.c +2 -2
index c1552b0fee04..cc3fb2d1686a 100644
@@ -13,6 +13,7 @@
 #include <linux/err.h>
 #include <linux/spi/spi.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/iio/iio.h>
 #include <linux/property.h>
 #include <linux/regulator/consumer.h>
@@ -220,7 +221,7 @@ MODULE_DEVICE_TABLE(acpi, adc128_acpi_match);
 static struct spi_driver adc128_driver = {
        .driver = {
                .name = "adc128s052",
-               .of_match_table = of_match_ptr(adc128_of_match),
+               .of_match_table = adc128_of_match,
                .acpi_match_table = ACPI_PTR(adc128_acpi_match),
        },
        .probe = adc128_probe,
--

2.27.0

#51 lore raw

Re: [PATCH 19/23] iio:adc:ti-adc128s052: drop of_match_ptr protection

Quoted 7 lines · Jonathan Cameron
Quoted 1 line · On Tue, 30 Jun 2020 10:22:45 +0300 Andy Shevchenko <[email protected]>…

On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <[email protected]> wrote:

The problem is that not all vendors have an ACPI manufacturer ID (or a PNP one). They could probably get one but smaller manufacturers are never going to bother.

I understand and this is a real flaw in the ACPI process. But users (customers) should do something about it.

Quoted 5 lines
Quoted 2 lines

That said, the commit message is misleading a bit here (it might be useful for the components which are not supported by existing ACPI ID.

I'm a bit dubious about encouraging people to use an Intel ID. If it were issued by TI for a TI part that would be a different matter.

Here it's an ID corresponding to one of the supported components, so, PRP0001 makes sense for the rest.
Rephrase the message to be more align with the reality (as per previous comment on the patch with same matter).

Quoted 2 lines

Obviously there is no problem with Intel issuing an ID, or anyone else doing so.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#52 lore raw

PATCH 20/23 iio:adc:ti-adc161s626: Drop of_match_ptr protection.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Dropping this allows use of ACPI PRP0001.

I'm also looking to drop all of_match_ptr use in IIO in order to avoid it getting cut and paste into new drivers in the future.

Also add a direct include of mod_devicetable.h to reflect the use of struct of_device_id.

---
 drivers/iio/adc/ti-adc161s626.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-adc161s626.c +2 -1
index f27ca3161530..607791ffe7f0 100644
@@ -11,6 +11,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/spi/spi.h>
@@ -257,7 +258,7 @@ MODULE_DEVICE_TABLE(spi, ti_adc_id);
 static struct spi_driver ti_adc_driver = {
 	.driver = {
 		.name	= TI_ADC_DRV_NAME,
-		.of_match_table = of_match_ptr(ti_adc_dt_ids),
+		.of_match_table = ti_adc_dt_ids,
 	},
 	.probe		= ti_adc_probe,
 	.remove		= ti_adc_remove,
Signature · 1 line
2.27.0
Acked-by on v1 20/23
#53 lore raw

Re: [PATCH 20/23] iio:adc:ti-adc161s626: Drop of_match_ptr protection.

Quoted 5 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Dropping this allows use of ACPI PRP0001.

Quoted 7 lines

I'm also looking to drop all of_match_ptr use in IIO in order to avoid it getting cut and paste into new drivers in the future.

Also add a direct include of mod_devicetable.h to reflect the use of struct of_device_id.

Quoted 29 lines
Cc Matt Ranostay <[email protected]>
---
 drivers/iio/adc/ti-adc161s626.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-adc161s626.c +2 -2
index f27ca3161530..607791ffe7f0 100644
@@ -11,6 +11,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/spi/spi.h>
@@ -257,7 +258,7 @@ MODULE_DEVICE_TABLE(spi, ti_adc_id);
 static struct spi_driver ti_adc_driver = {
        .driver = {
                .name   = TI_ADC_DRV_NAME,
-               .of_match_table = of_match_ptr(ti_adc_dt_ids),
+               .of_match_table = ti_adc_dt_ids,
        },
        .probe          = ti_adc_probe,
        .remove         = ti_adc_remove,
--

2.27.0

author maintainer Applied
#54 lore raw

Re: [PATCH 20/23] iio:adc:ti-adc161s626: Drop of_match_ptr protection.

Quoted 9 lines · On Sun, 28 Jun 2020 12:51:09 -0700 Matt Ranostay <[email protected]>…
Quoted 8 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Dropping this allows use of ACPI PRP0001.

I'm also looking to drop all of_match_ptr use in IIO in order to avoid it getting cut and paste into new drivers in the future.

Quoted 6 lines
Quoted 4 lines

Also add a direct include of mod_devicetable.h to reflect the use of struct of_device_id.

Applied.

Thanks,

Jonathan

Quoted 30 lines
Quoted 30 lines
Cc Matt Ranostay <[email protected]>
---
 drivers/iio/adc/ti-adc161s626.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-adc161s626.c +2 -2
index f27ca3161530..607791ffe7f0 100644
@@ -11,6 +11,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/spi/spi.h>
@@ -257,7 +258,7 @@ MODULE_DEVICE_TABLE(spi, ti_adc_id);
 static struct spi_driver ti_adc_driver = {
        .driver = {
                .name   = TI_ADC_DRV_NAME,
-               .of_match_table = of_match_ptr(ti_adc_dt_ids),
+               .of_match_table = ti_adc_dt_ids,
        },
        .probe          = ti_adc_probe,
        .remove         = ti_adc_remove,
--

2.27.0

author maintainer
#55 lore raw

PATCH 21/23 iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

These stop us using ACPI PRP0001 to instantiate the device. I am slowly clearly out use of these in IIO to avoid this being coppied into new drivers.

Here I also included mod_devicetable.h as we are using of_match_id which is defined in there and hence it is best practice to include it directly.

---
 drivers/iio/adc/ti-tlc4541.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/ti-tlc4541.c +2 -3
index 432238246519..53359a2e5bea 100644
@@ -24,6 +24,7 @@
 #include <linux/iio/triggered_buffer.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
@@ -235,14 +236,12 @@ static int tlc4541_remove(struct spi_device *spi)
 	return 0;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id tlc4541_dt_ids[] = {
 	{ .compatible = "ti,tlc3541", },
 	{ .compatible = "ti,tlc4541", },
 	{}
 };
 MODULE_DEVICE_TABLE(of, tlc4541_dt_ids);
-#endif
 
 static const struct spi_device_id tlc4541_id[] = {
 	{"tlc3541", TLC3541},
@@ -254,7 +253,7 @@ MODULE_DEVICE_TABLE(spi, tlc4541_id);
 static struct spi_driver tlc4541_driver = {
 	.driver = {
 		.name   = "tlc4541",
-		.of_match_table = of_match_ptr(tlc4541_dt_ids),
+		.of_match_table = tlc4541_dt_ids,
 	},
 	.probe          = tlc4541_probe,
 	.remove         = tlc4541_remove,
Signature · 1 line
2.27.0
Reviewed-by on v1 21/23
#56 lore raw

Re: [PATCH 21/23] iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections.

Quoted 6 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

These stop us using ACPI PRP0001 to instantiate the device. I am slowly clearly out use of these in IIO to avoid this being coppied into new drivers.

Quoted 6 lines

Here I also included mod_devicetable.h as we are using of_match_id which is defined in there and hence it is best practice to include it directly.

Quoted 41 lines
---
  drivers/iio/adc/ti-tlc4541.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/ti-tlc4541.c +2 -3
index 432238246519..53359a2e5bea 100644
@@ -24,6 +24,7 @@
  #include <linux/iio/triggered_buffer.h>
  #include <linux/kernel.h>
  #include <linux/module.h>
+#include <linux/mod_devicetable.h>
  #include <linux/regulator/consumer.h>
  #include <linux/slab.h>
  #include <linux/spi/spi.h>
@@ -235,14 +236,12 @@ static int tlc4541_remove(struct spi_device *spi)
  	return 0;
  }
 
-#ifdef CONFIG_OF
  static const struct of_device_id tlc4541_dt_ids[] = {
  	{ .compatible = "ti,tlc3541", },
  	{ .compatible = "ti,tlc4541", },
  	{}
  };
  MODULE_DEVICE_TABLE(of, tlc4541_dt_ids);
-#endif
 
  static const struct spi_device_id tlc4541_id[] = {
  	{"tlc3541", TLC3541},
@@ -254,7 +253,7 @@ MODULE_DEVICE_TABLE(spi, tlc4541_id);
  static struct spi_driver tlc4541_driver = {
  	.driver = {
  		.name   = "tlc4541",
-		.of_match_table = of_match_ptr(tlc4541_dt_ids),
+		.of_match_table = tlc4541_dt_ids,
  	},
  	.probe          = tlc4541_probe,
  	.remove         = tlc4541_remove,
author maintainer Applied
#57 lore raw

Re: [PATCH 21/23] iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections.

Quoted 7 lines · On Mon, 29 Jun 2020 07:43:55 +0800 Phil Reid <[email protected]> wrote:
Quoted 6 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

These stop us using ACPI PRP0001 to instantiate the device. I am slowly clearly out use of these in IIO to avoid this being coppied into new drivers.

Quoted 8 lines
Quoted 6 lines

Here I also included mod_devicetable.h as we are using of_match_id which is defined in there and hence it is best practice to include it directly.

Applied,

Thanks,

Jonathan

Quoted 43 lines
Quoted 42 lines
---
  drivers/iio/adc/ti-tlc4541.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/ti-tlc4541.c +2 -3
index 432238246519..53359a2e5bea 100644
@@ -24,6 +24,7 @@
  #include <linux/iio/triggered_buffer.h>
  #include <linux/kernel.h>
  #include <linux/module.h>
+#include <linux/mod_devicetable.h>
  #include <linux/regulator/consumer.h>
  #include <linux/slab.h>
  #include <linux/spi/spi.h>
@@ -235,14 +236,12 @@ static int tlc4541_remove(struct spi_device *spi)
  	return 0;
  }
 
-#ifdef CONFIG_OF
  static const struct of_device_id tlc4541_dt_ids[] = {
  	{ .compatible = "ti,tlc3541", },
  	{ .compatible = "ti,tlc4541", },
  	{}
  };
  MODULE_DEVICE_TABLE(of, tlc4541_dt_ids);
-#endif
 
  static const struct spi_device_id tlc4541_id[] = {
  	{"tlc3541", TLC3541},
@@ -254,7 +253,7 @@ MODULE_DEVICE_TABLE(spi, tlc4541_id);
  static struct spi_driver tlc4541_driver = {
  	.driver = {
  		.name   = "tlc4541",
-		.of_match_table = of_match_ptr(tlc4541_dt_ids),
+		.of_match_table = tlc4541_dt_ids,
  	},
  	.probe          = tlc4541_probe,
  	.remove         = tlc4541_remove,
author maintainer
#58 lore raw

PATCH 22/23 iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Whilst it's unlikely that this driver will ever be instantiated from ACPI PRP0001 there is little advantage in using the of_match_ptr protection. The switch of header is because we only use of_match_id in here and that is defined in mod_devicetable.h not of.h.

Note the main reason for this patch is to avoid providing instances of of_match_ptr being used in IIO that might get copied into new drivers.

Cc Raveendra Padasalagi <[email protected]>
---
 drivers/iio/adc/bcm_iproc_adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/bcm_iproc_adc.c +2 -2
index 936da32faa9d..44e1e53ada72 100644
@@ -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);
Signature · 1 line
2.27.0
#59 lore raw

Re: [PATCH 22/23] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h

Quoted 11 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Whilst it's unlikely that this driver will ever be instantiated from ACPI PRP0001 there is little advantage in using the of_match_ptr protection. The switch of header is because we only use of_match_id in here and that is defined in mod_devicetable.h not of.h.

Note the main reason for this patch is to avoid providing instances of of_match_ptr being used in IIO that might get copied into new drivers.

Commit message is misleading. The change won't help with ACPI due to syscon_regmap_lookup_by_phandle() call.

Quoted 31 lines
Cc Raveendra Padasalagi <[email protected]>
---
 drivers/iio/adc/bcm_iproc_adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/bcm_iproc_adc.c +2 -3
index 936da32faa9d..44e1e53ada72 100644
@@ -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

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#60 lore raw

Re: [PATCH 22/23] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h

Quoted 9 lines · On Tue, 30 Jun 2020 10:25:24 +0300 Andy Shevchenko <[email protected]>…
Quoted 8 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Whilst it's unlikely that this driver will ever be instantiated from ACPI PRP0001 there is little advantage in using the of_match_ptr protection. The switch of header is because we only use of_match_id in here and that is defined in mod_devicetable.h not of.h.

Quoted 6 lines
Quoted 3 lines

Note the main reason for this patch is to avoid providing instances of of_match_ptr being used in IIO that might get copied into new drivers.

Commit message is misleading. The change won't help with ACPI due to syscon_regmap_lookup_by_phandle() call.

I'd missed that. I'll drop this one.

Thanks,

Jonathan

Quoted 34 lines
Quoted 32 lines
Cc Raveendra Padasalagi <[email protected]>
---
 drivers/iio/adc/bcm_iproc_adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/bcm_iproc_adc.c +2 -3
index 936da32faa9d..44e1e53ada72 100644
@@ -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

#61 lore raw

Re: [PATCH 22/23] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h

Quoted 13 lines · Jonathan Cameron
Quoted 9 lines · On Tue, 30 Jun 2020 10:25:24 +0300 Andy Shevchenko <[email protected]>…
Quoted 8 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Whilst it's unlikely that this driver will ever be instantiated from ACPI PRP0001 there is little advantage in using the of_match_ptr protection. The switch of header is because we only use of_match_id in here and that is defined in mod_devicetable.h not of.h.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Note the main reason for this patch is to avoid providing instances of of_match_ptr being used in IIO that might get copied into new drivers.

Commit message is misleading. The change won't help with ACPI due to syscon_regmap_lookup_by_phandle() call.

I'd missed that. I'll drop this one.

Actually in this case, if it's not done yet, I prefer to see in Kconfig something like

depends on OF || COMPILE_TEST

to explicitly show that "yes, you may compile it, but it requires OF to function with usefulness".

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#62 lore raw

PATCH 23/23 iio:adc:ingenic: drop of_match_ptr protection and include mod_devicetable.h

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Whilst it's unlikely this device will ever be instantiated using ACPI, there is little advantage not assigning the of_device_id table in all cases and it avoids providing an example that might be coppied into new drivers.

Also include mod_devicetable.h whilst here as of_device_id is defined in there so including the header is best practice.

---
 drivers/iio/adc/ingenic-adc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/ingenic-adc.c +2 -3
index 3ea097c9650e..fa7ae7f6677e 100644
@@ -13,6 +13,7 @@
 #include <linux/iopoll.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/mutex.h>
 #include <linux/platform_device.h>
 
@@ -497,7 +498,6 @@ static int ingenic_adc_probe(struct platform_device *pdev)
 	return ret;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id ingenic_adc_of_match[] = {
 	{ .compatible = "ingenic,jz4725b-adc", .data = &jz4725b_adc_soc_data, },
 	{ .compatible = "ingenic,jz4740-adc", .data = &jz4740_adc_soc_data, },
@@ -505,12 +505,11 @@ static const struct of_device_id ingenic_adc_of_match[] = {
 	{ },
 };
 MODULE_DEVICE_TABLE(of, ingenic_adc_of_match);
-#endif
 
 static struct platform_driver ingenic_adc_driver = {
 	.driver = {
 		.name = "ingenic-adc",
-		.of_match_table = of_match_ptr(ingenic_adc_of_match),
+		.of_match_table = ingenic_adc_of_match,
 	},
 	.probe = ingenic_adc_probe,
 };
Signature · 1 line
2.27.0
author maintainer
#63 lore raw

Re: [PATCH 23/23] iio:adc:ingenic: drop of_match_ptr protection and include mod_devicetable.h

Quoted 7 lines · On Sun, 28 Jun 2020 13:36:54 +0100 Jonathan Cameron <[email protected]> wrote:

From: Jonathan Cameron <[email protected]>

Whilst it's unlikely this device will ever be instantiated using ACPI, there is little advantage not assigning the of_device_id table in all cases and it avoids providing an example that might be coppied into new drivers.

Quoted 5 lines

Also include mod_devicetable.h whilst here as of_device_id is defined in there so including the header is best practice.

Applied thanks,

Jonathan

Quoted 38 lines
---
 drivers/iio/adc/ingenic-adc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/ingenic-adc.c +2 -3
index 3ea097c9650e..fa7ae7f6677e 100644
@@ -13,6 +13,7 @@
 #include <linux/iopoll.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/mutex.h>
 #include <linux/platform_device.h>
 
@@ -497,7 +498,6 @@ static int ingenic_adc_probe(struct platform_device *pdev)
 	return ret;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id ingenic_adc_of_match[] = {
 	{ .compatible = "ingenic,jz4725b-adc", .data = &jz4725b_adc_soc_data, },
 	{ .compatible = "ingenic,jz4740-adc", .data = &jz4740_adc_soc_data, },
@@ -505,12 +505,11 @@ static const struct of_device_id ingenic_adc_of_match[] = {
 	{ },
 };
 MODULE_DEVICE_TABLE(of, ingenic_adc_of_match);
-#endif
 
 static struct platform_driver ingenic_adc_driver = {
 	.driver = {
 		.name = "ingenic-adc",
-		.of_match_table = of_match_ptr(ingenic_adc_of_match),
+		.of_match_table = ingenic_adc_of_match,
 	},
 	.probe = ingenic_adc_probe,
 };
#64 lore raw
In reply to Jonathan Cameron
Quoted 5 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Continuation of slow process to try and remove use of of_match_ptr to supress asignment of the of_device_id table when !CONFIG_OF.

suppress assignment ?

Quoted 9 lines

Usual argument that it prevents ACPI being used with these drivers via PRP0001 in DSDT. Perhaps more usefully we are cutting down on the number of places it can be cut and paste from into new drivers.

This is just the low hanging fruit. I'm not yet sure if it makes sense to expend the effort to use generic firmware properties etc for some of the remaining drivers as it is unlikely they'll ever be used with anything other than device tree. There are 4 current ADC drivers in this more complex category.

All of them make sense to me, but I did only a shallow review (I would look closer next week).
Also, perhaps it makes sense to give people an example of what it looks like in the ACPI table. For example, in the cover letter (this message) mention a link to meta-acpi repository [1] which has a lot of examples [2].

[1]: https://github.com/westeri/meta-acpi
[2]: https://github.com/westeri/meta-acpi/tree/master/recipes-bsp/acpi-tables/samples
(Edison has most of the examples right now)

Quoted 57 lines

Jonathan Cameron (23):
iio:adc:lpc32xx: Drop of_match_ptr protection iio:adc:axp20x: Convert from OF to generic fw / device properties iio:adc:hi8435: Drop unused of_gpio.h header iio:adc:hi8435: Drop of_match_ptr protection. iio:adc:max1363: Drop of_match_ptr and use generic
device_get_match_data
iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h iio:adc:cpcap-adc: Drop of_match_ptr protection and use
device_get_match_data
iio:adc:ltc2497 drop of_match_ptr protection iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h
include
iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections iio:adc:mcp320x: Drop CONFIG_OF and of_match_ptr protections iio:adc:mcp3422: remove CONFIG_OF and of_match_ptr protections iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections iio:adc:ti-adc084s021: drop of_match_ptr protection iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections iio:adc:ti-adc128s052: drop of_match_ptr protection iio:adc:ti-adc161s626: Drop of_match_ptr protection. iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections. iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to
mod_devicetable.h
iio:adc:ingenic: drop of_match_ptr protection and include
mod_devicetable.h

 drivers/iio/adc/axp20x_adc.c       | 10 +++++-----
 drivers/iio/adc/bcm_iproc_adc.c    |  4 ++--
 drivers/iio/adc/cpcap-adc.c        | 22 ++++++----------------
 drivers/iio/adc/hi8435.c           |  6 ++----
 drivers/iio/adc/ingenic-adc.c      |  5 ++---
 drivers/iio/adc/lpc32xx_adc.c      |  5 ++---
 drivers/iio/adc/ltc2496.c          |  4 ++--
 drivers/iio/adc/ltc2497.c          |  4 ++--
 drivers/iio/adc/max1027.c          |  5 ++---
 drivers/iio/adc/max11100.c         |  3 ++-
 drivers/iio/adc/max1118.c          |  7 ++-----
 drivers/iio/adc/max1363.c          | 11 ++++-------
 drivers/iio/adc/mcp320x.c          |  5 ++---
 drivers/iio/adc/mcp3422.c          |  6 ++----
 drivers/iio/adc/sd_adc_modulator.c |  5 +++--
 drivers/iio/adc/ti-adc081c.c       |  6 ++----
 drivers/iio/adc/ti-adc0832.c       |  7 ++-----
 drivers/iio/adc/ti-adc084s021.c    |  3 ++-
 drivers/iio/adc/ti-adc108s102.c    |  5 ++---
 drivers/iio/adc/ti-adc128s052.c    |  3 ++-
 drivers/iio/adc/ti-adc161s626.c    |  3 ++-
 drivers/iio/adc/ti-tlc4541.c       |  5 ++---
 22 files changed, 54 insertions(+), 80 deletions(-)

--
2.27.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#65 lore raw
Quoted 8 lines · On Sun, 28 Jun 2020 20:53:09 +0300 Andy Shevchenko <[email protected]>…
Quoted 5 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Continuation of slow process to try and remove use of of_match_ptr to supress asignment of the of_device_id table when !CONFIG_OF.

suppress assignment ?

Hohum.
One day I'll remember to spell check my cover letters.

Quoted 18 lines
Quoted 10 lines

Usual argument that it prevents ACPI being used with these drivers via PRP0001 in DSDT. Perhaps more usefully we are cutting down on the number of places it can be cut and paste from into new drivers.

This is just the low hanging fruit. I'm not yet sure if it makes sense to expend the effort to use generic firmware properties etc for some of the remaining drivers as it is unlikely they'll ever be used with anything other than device tree. There are 4 current ADC drivers in this more complex category.

All of them make sense to me, but I did only a shallow review (I would look closer next week).
Also, perhaps it makes sense to give people an example of what it looks like in the ACPI table. For example, in the cover letter (this message) mention a link to meta-acpi repository [1] which has a lot of examples [2].

Quoted 4 lines

[1]: https://github.com/westeri/meta-acpi
[2]: https://github.com/westeri/meta-acpi/tree/master/recipes-bsp/acpi-tables/samples
(Edison has most of the examples right now)

Nice reference. I'll tidy up any other issues and add that for v2, but probably not until next weekend as somewhat crazy week ahead.

Great to have something less dry than the spec to illustrate it.

Thanks,

Jonathan

Quoted 60 lines
Quoted 58 lines

Jonathan Cameron (23):
iio:adc:lpc32xx: Drop of_match_ptr protection iio:adc:axp20x: Convert from OF to generic fw / device properties iio:adc:hi8435: Drop unused of_gpio.h header iio:adc:hi8435: Drop of_match_ptr protection. iio:adc:max1363: Drop of_match_ptr and use generic
device_get_match_data
iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h iio:adc:cpcap-adc: Drop of_match_ptr protection and use
device_get_match_data
iio:adc:ltc2497 drop of_match_ptr protection iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h
include
iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections iio:adc:mcp320x: Drop CONFIG_OF and of_match_ptr protections iio:adc:mcp3422: remove CONFIG_OF and of_match_ptr protections iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections iio:adc:ti-adc084s021: drop of_match_ptr protection iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections iio:adc:ti-adc128s052: drop of_match_ptr protection iio:adc:ti-adc161s626: Drop of_match_ptr protection. iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections. iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to
mod_devicetable.h
iio:adc:ingenic: drop of_match_ptr protection and include
mod_devicetable.h

 drivers/iio/adc/axp20x_adc.c       | 10 +++++-----
 drivers/iio/adc/bcm_iproc_adc.c    |  4 ++--
 drivers/iio/adc/cpcap-adc.c        | 22 ++++++----------------
 drivers/iio/adc/hi8435.c           |  6 ++----
 drivers/iio/adc/ingenic-adc.c      |  5 ++---
 drivers/iio/adc/lpc32xx_adc.c      |  5 ++---
 drivers/iio/adc/ltc2496.c          |  4 ++--
 drivers/iio/adc/ltc2497.c          |  4 ++--
 drivers/iio/adc/max1027.c          |  5 ++---
 drivers/iio/adc/max11100.c         |  3 ++-
 drivers/iio/adc/max1118.c          |  7 ++-----
 drivers/iio/adc/max1363.c          | 11 ++++-------
 drivers/iio/adc/mcp320x.c          |  5 ++---
 drivers/iio/adc/mcp3422.c          |  6 ++----
 drivers/iio/adc/sd_adc_modulator.c |  5 +++--
 drivers/iio/adc/ti-adc081c.c       |  6 ++----
 drivers/iio/adc/ti-adc0832.c       |  7 ++-----
 drivers/iio/adc/ti-adc084s021.c    |  3 ++-
 drivers/iio/adc/ti-adc108s102.c    |  5 ++---
 drivers/iio/adc/ti-adc128s052.c    |  3 ++-
 drivers/iio/adc/ti-adc161s626.c    |  3 ++-
 drivers/iio/adc/ti-tlc4541.c       |  5 ++---
 22 files changed, 54 insertions(+), 80 deletions(-)

--
2.27.0

Reviewed-by on the v1 series
#66 lore raw
In reply to Jonathan Cameron
Quoted 10 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Continuation of slow process to try and remove use of of_match_ptr to supress asignment of the of_device_id table when !CONFIG_OF.

Usual argument that it prevents ACPI being used with these drivers via PRP0001 in DSDT. Perhaps more usefully we are cutting down on the number of places it can be cut and paste from into new drivers.

Quoted 5 lines

This is just the low hanging fruit. I'm not yet sure if it makes sense to expend the effort to use generic firmware properties etc for some of the remaining drivers as it is unlikely they'll ever be used with anything other than device tree. There are 4 current ADC drivers in this more complex category.

For the non-commented,

Commented with LGTM also can have Rb tag.
The rest, please consider to address.

Thanks for a nice clean up!

Quoted 58 lines

Jonathan Cameron (23):
iio:adc:lpc32xx: Drop of_match_ptr protection iio:adc:axp20x: Convert from OF to generic fw / device properties iio:adc:hi8435: Drop unused of_gpio.h header iio:adc:hi8435: Drop of_match_ptr protection. iio:adc:max1363: Drop of_match_ptr and use generic
device_get_match_data
iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h iio:adc:cpcap-adc: Drop of_match_ptr protection and use
device_get_match_data
iio:adc:ltc2497 drop of_match_ptr protection iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h
include
iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections iio:adc:mcp320x: Drop CONFIG_OF and of_match_ptr protections iio:adc:mcp3422: remove CONFIG_OF and of_match_ptr protections iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections iio:adc:ti-adc084s021: drop of_match_ptr protection iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections iio:adc:ti-adc128s052: drop of_match_ptr protection iio:adc:ti-adc161s626: Drop of_match_ptr protection. iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections. iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to
mod_devicetable.h
iio:adc:ingenic: drop of_match_ptr protection and include
mod_devicetable.h

 drivers/iio/adc/axp20x_adc.c       | 10 +++++-----
 drivers/iio/adc/bcm_iproc_adc.c    |  4 ++--
 drivers/iio/adc/cpcap-adc.c        | 22 ++++++----------------
 drivers/iio/adc/hi8435.c           |  6 ++----
 drivers/iio/adc/ingenic-adc.c      |  5 ++---
 drivers/iio/adc/lpc32xx_adc.c      |  5 ++---
 drivers/iio/adc/ltc2496.c          |  4 ++--
 drivers/iio/adc/ltc2497.c          |  4 ++--
 drivers/iio/adc/max1027.c          |  5 ++---
 drivers/iio/adc/max11100.c         |  3 ++-
 drivers/iio/adc/max1118.c          |  7 ++-----
 drivers/iio/adc/max1363.c          | 11 ++++-------
 drivers/iio/adc/mcp320x.c          |  5 ++---
 drivers/iio/adc/mcp3422.c          |  6 ++----
 drivers/iio/adc/sd_adc_modulator.c |  5 +++--
 drivers/iio/adc/ti-adc081c.c       |  6 ++----
 drivers/iio/adc/ti-adc0832.c       |  7 ++-----
 drivers/iio/adc/ti-adc084s021.c    |  3 ++-
 drivers/iio/adc/ti-adc108s102.c    |  5 ++---
 drivers/iio/adc/ti-adc128s052.c    |  3 ++-
 drivers/iio/adc/ti-adc161s626.c    |  3 ++-
 drivers/iio/adc/ti-tlc4541.c       |  5 ++---
 22 files changed, 54 insertions(+), 80 deletions(-)

--
2.27.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#67 lore raw
Quoted 17 lines · On Tue, 30 Jun 2020 10:27:49 +0300 Andy Shevchenko <[email protected]>…
Quoted 10 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Continuation of slow process to try and remove use of of_match_ptr to supress asignment of the of_device_id table when !CONFIG_OF.

Usual argument that it prevents ACPI being used with these drivers via PRP0001 in DSDT. Perhaps more usefully we are cutting down on the number of places it can be cut and paste from into new drivers.

Quoted 5 lines

This is just the low hanging fruit. I'm not yet sure if it makes sense to expend the effort to use generic firmware properties etc for some of the remaining drivers as it is unlikely they'll ever be used with anything other than device tree. There are 4 current ADC drivers in this more complex category.

Quoted 7 lines

For the non-commented,

Commented with LGTM also can have Rb tag.
The rest, please consider to address.

Thanks for a nice clean up!

Thanks for your hard work going through all these.

I've applied all the good ones and will respin the others.

Thanks,

Jonathan

Quoted 61 lines
Quoted 59 lines

Jonathan Cameron (23):
iio:adc:lpc32xx: Drop of_match_ptr protection iio:adc:axp20x: Convert from OF to generic fw / device properties iio:adc:hi8435: Drop unused of_gpio.h header iio:adc:hi8435: Drop of_match_ptr protection. iio:adc:max1363: Drop of_match_ptr and use generic
device_get_match_data
iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h iio:adc:cpcap-adc: Drop of_match_ptr protection and use
device_get_match_data
iio:adc:ltc2497 drop of_match_ptr protection iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h
include
iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections iio:adc:mcp320x: Drop CONFIG_OF and of_match_ptr protections iio:adc:mcp3422: remove CONFIG_OF and of_match_ptr protections iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections iio:adc:ti-adc084s021: drop of_match_ptr protection iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections iio:adc:ti-adc128s052: drop of_match_ptr protection iio:adc:ti-adc161s626: Drop of_match_ptr protection. iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections. iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to
mod_devicetable.h
iio:adc:ingenic: drop of_match_ptr protection and include
mod_devicetable.h

 drivers/iio/adc/axp20x_adc.c       | 10 +++++-----
 drivers/iio/adc/bcm_iproc_adc.c    |  4 ++--
 drivers/iio/adc/cpcap-adc.c        | 22 ++++++----------------
 drivers/iio/adc/hi8435.c           |  6 ++----
 drivers/iio/adc/ingenic-adc.c      |  5 ++---
 drivers/iio/adc/lpc32xx_adc.c      |  5 ++---
 drivers/iio/adc/ltc2496.c          |  4 ++--
 drivers/iio/adc/ltc2497.c          |  4 ++--
 drivers/iio/adc/max1027.c          |  5 ++---
 drivers/iio/adc/max11100.c         |  3 ++-
 drivers/iio/adc/max1118.c          |  7 ++-----
 drivers/iio/adc/max1363.c          | 11 ++++-------
 drivers/iio/adc/mcp320x.c          |  5 ++---
 drivers/iio/adc/mcp3422.c          |  6 ++----
 drivers/iio/adc/sd_adc_modulator.c |  5 +++--
 drivers/iio/adc/ti-adc081c.c       |  6 ++----
 drivers/iio/adc/ti-adc0832.c       |  7 ++-----
 drivers/iio/adc/ti-adc084s021.c    |  3 ++-
 drivers/iio/adc/ti-adc108s102.c    |  5 ++---
 drivers/iio/adc/ti-adc128s052.c    |  3 ++-
 drivers/iio/adc/ti-adc161s626.c    |  3 ++-
 drivers/iio/adc/ti-tlc4541.c       |  5 ++---
 22 files changed, 54 insertions(+), 80 deletions(-)

--
2.27.0