linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/23] iio:adc more of_match_ptr and similar removal
@ 2020-06-28 12:36 Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 01/23] iio:adc:lpc32xx: Drop of_match_ptr protection Jonathan Cameron
                   ` (24 more replies)
  0 siblings, 25 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio; +Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 01/23] iio:adc:lpc32xx: Drop of_match_ptr protection
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-06-30  7:01   ` Andy Shevchenko
  2020-06-28 12:36 ` [PATCH 02/23] iio:adc:axp20x: Convert from OF to generic fw / device properties Jonathan Cameron
                   ` (23 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio; +Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/lpc32xx_adc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/lpc32xx_adc.c b/drivers/iio/adc/lpc32xx_adc.c
index bc2712a48844..b56ce15255cf 100644
--- a/drivers/iio/adc/lpc32xx_adc.c
+++ b/drivers/iio/adc/lpc32xx_adc.c
@@ -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,
 	},
 };
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 02/23] iio:adc:axp20x: Convert from OF to generic fw / device properties
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 01/23] iio:adc:lpc32xx: Drop of_match_ptr protection Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-06-28 17:43   ` Andy Shevchenko
  2020-06-28 12:36 ` [PATCH 03/23] iio:adc:hi8435: Drop unused of_gpio.h header Jonathan Cameron
                   ` (22 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Quentin Schulz

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Quentin Schulz <quentin.schulz@bootlin.com>
---
 drivers/iio/adc/axp20x_adc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c
index 798ff2d89691..b678f897d983 100644
--- a/drivers/iio/adc/axp20x_adc.c
+++ b/drivers/iio/adc/axp20x_adc.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 03/23] iio:adc:hi8435: Drop unused of_gpio.h header
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 01/23] iio:adc:lpc32xx: Drop of_match_ptr protection Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 02/23] iio:adc:axp20x: Convert from OF to generic fw / device properties Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-07-04 16:52   ` Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 04/23] iio:adc:hi8435: Drop of_match_ptr protection Jonathan Cameron
                   ` (21 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Nikita Yushchenko, Vladimir Barinov

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Cc: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
 drivers/iio/adc/hi8435.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/iio/adc/hi8435.c b/drivers/iio/adc/hi8435.c
index 127e78243233..235374ec7bab 100644
--- a/drivers/iio/adc/hi8435.c
+++ b/drivers/iio/adc/hi8435.c
@@ -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>
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 04/23] iio:adc:hi8435: Drop of_match_ptr protection.
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (2 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 03/23] iio:adc:hi8435: Drop unused of_gpio.h header Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-07-04 16:53   ` Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 05/23] iio:adc:max1363: Drop of_match_ptr and use generic device_get_match_data Jonathan Cameron
                   ` (20 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Vladimir Barinov, Nikita Yushchenko

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Cc: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
---
 drivers/iio/adc/hi8435.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/hi8435.c b/drivers/iio/adc/hi8435.c
index 235374ec7bab..074c30970465 100644
--- a/drivers/iio/adc/hi8435.c
+++ b/drivers/iio/adc/hi8435.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 05/23] iio:adc:max1363: Drop of_match_ptr and use generic device_get_match_data
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (3 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 04/23] iio:adc:hi8435: Drop of_match_ptr protection Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-07-04 16:54   ` Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 06/23] iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections Jonathan Cameron
                   ` (19 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio; +Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/max1363.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
index d8da5da74b77..420e2ec154fc 100644
--- a/drivers/iio/adc/max1363.c
+++ b/drivers/iio/adc/max1363.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 06/23] iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (4 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 05/23] iio:adc:max1363: Drop of_match_ptr and use generic device_get_match_data Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-07-04 16:56   ` Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 07/23] iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h Jonathan Cameron
                   ` (18 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Miquel Raynal, Philippe Reynes

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Philippe Reynes <tremyfr@yahoo.fr>
---
 drivers/iio/adc/max1027.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index 9e993ccd14de..ca1dff3924ff 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 07/23] iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (5 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 06/23] iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-06-28 15:52   ` Uwe Kleine-König
  2020-06-28 12:36 ` [PATCH 08/23] iio:adc:cpcap-adc: Drop of_match_ptr protection and use device_get_match_data Jonathan Cameron
                   ` (17 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Uwe Kleine-König

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/iio/adc/ltc2496.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ltc2496.c b/drivers/iio/adc/ltc2496.c
index 88a30156a849..dd956a7c216e 100644
--- a/drivers/iio/adc/ltc2496.c
+++ b/drivers/iio/adc/ltc2496.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 08/23] iio:adc:cpcap-adc: Drop of_match_ptr protection and use device_get_match_data
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (6 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 07/23] iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-06-29 15:21   ` Tony Lindgren
  2020-06-28 12:36 ` [PATCH 09/23] iio:adc:ltc2497 drop of_match_ptr protection Jonathan Cameron
                   ` (16 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Tony Lindgren

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 drivers/iio/adc/cpcap-adc.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/iio/adc/cpcap-adc.c b/drivers/iio/adc/cpcap-adc.c
index 004e7fee1fb2..cc26cf309638 100644
--- a/drivers/iio/adc/cpcap-adc.c
+++ b/drivers/iio/adc/cpcap-adc.c
@@ -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,
 };
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 09/23] iio:adc:ltc2497 drop of_match_ptr protection
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (7 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 08/23] iio:adc:cpcap-adc: Drop of_match_ptr protection and use device_get_match_data Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-06-28 15:53   ` Uwe Kleine-König
  2020-06-28 12:36 ` [PATCH 10/23] iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h include Jonathan Cameron
                   ` (15 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Michael Hennerich, Uwe Kleine-König

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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!)

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/iio/adc/ltc2497.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ltc2497.c b/drivers/iio/adc/ltc2497.c
index 5db63d7c6bc5..1adddf5a88a9 100644
--- a/drivers/iio/adc/ltc2497.c
+++ b/drivers/iio/adc/ltc2497.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 10/23] iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h include
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (8 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 09/23] iio:adc:ltc2497 drop of_match_ptr protection Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-06-29  7:28   ` Jacopo Mondi
  2020-06-28 12:36 ` [PATCH 11/23] iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections Jonathan Cameron
                   ` (14 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Jacopo Mondi

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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

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

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

diff --git a/drivers/iio/adc/max11100.c b/drivers/iio/adc/max11100.c
index 57734f9742f6..77fcee1dddf7 100644
--- a/drivers/iio/adc/max11100.c
+++ b/drivers/iio/adc/max11100.c
@@ -9,6 +9,7 @@
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #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


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 11/23] iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (9 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 10/23] iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h include Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-07-04 17:20   ` Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 12/23] iio:adc:mcp320x: Drop CONFIG_OF and " Jonathan Cameron
                   ` (13 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Akinobu Mita

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/iio/adc/max1118.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/max1118.c b/drivers/iio/adc/max1118.c
index 273fbea2a515..01b20e420ac4 100644
--- a/drivers/iio/adc/max1118.c
+++ b/drivers/iio/adc/max1118.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 12/23] iio:adc:mcp320x: Drop CONFIG_OF and of_match_ptr protections
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (10 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 11/23] iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-07-04 17:21   ` Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 13/23] iio:adc:mcp3422: remove " Jonathan Cameron
                   ` (12 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Oskar Andero, Søren Andersen, Lukas Wunner

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Oskar Andero <oskar.andero@gmail.com>
Cc: Søren Andersen <san@rosetechnology.dk>
Cc: Lukas Wunner <lukas@wunner.de>
---
 drivers/iio/adc/mcp320x.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
index e533f1064cf8..bb37e66ff7dc 100644
--- a/drivers/iio/adc/mcp320x.c
+++ b/drivers/iio/adc/mcp320x.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 13/23] iio:adc:mcp3422: remove CONFIG_OF and of_match_ptr protections
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (11 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 12/23] iio:adc:mcp320x: Drop CONFIG_OF and " Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-07-04 17:22   ` Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 14/23] iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes Jonathan Cameron
                   ` (11 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Angelo Compagnucci

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---
 drivers/iio/adc/mcp3422.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c
index 40e0d3ed05a5..ec9c79199ffb 100644
--- a/drivers/iio/adc/mcp3422.c
+++ b/drivers/iio/adc/mcp3422.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 14/23] iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (12 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 13/23] iio:adc:mcp3422: remove " Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-07-04 17:24   ` Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h Jonathan Cameron
                   ` (10 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Arnaud Pouliquen

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnaud Pouliquen <arnaud.pouliquen@st.com>
---
 drivers/iio/adc/sd_adc_modulator.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/sd_adc_modulator.c b/drivers/iio/adc/sd_adc_modulator.c
index 1d6c246609c8..327cc2097f6c 100644
--- a/drivers/iio/adc/sd_adc_modulator.c
+++ b/drivers/iio/adc/sd_adc_modulator.c
@@ -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,
 };
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (13 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 14/23] iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-06-30  7:12   ` Andy Shevchenko
  2020-06-28 12:36 ` [PATCH 16/23] iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
                   ` (9 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio; +Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/ti-adc081c.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
index 82e524b3db88..e00350e6503f 100644
--- a/drivers/iio/adc/ti-adc081c.c
+++ b/drivers/iio/adc/ti-adc081c.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 16/23] iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (14 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-07-04 17:29   ` Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 17/23] iio:adc:ti-adc084s021: drop of_match_ptr protection Jonathan Cameron
                   ` (8 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Akinobu Mita

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/iio/adc/ti-adc0832.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/ti-adc0832.c b/drivers/iio/adc/ti-adc0832.c
index 3eb3ba5fb610..05061dc05b32 100644
--- a/drivers/iio/adc/ti-adc0832.c
+++ b/drivers/iio/adc/ti-adc0832.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 17/23] iio:adc:ti-adc084s021: drop of_match_ptr protection
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (15 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 16/23] iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-07-04 17:30   ` Jonathan Cameron
  2020-06-28 12:36 ` [PATCH 18/23] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
                   ` (7 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Mårten Lindahl

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Mårten Lindahl <martenli@axis.com>
---
 drivers/iio/adc/ti-adc084s021.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-adc084s021.c b/drivers/iio/adc/ti-adc084s021.c
index c2db2435f419..5678bf7499b1 100644
--- a/drivers/iio/adc/ti-adc084s021.c
+++ b/drivers/iio/adc/ti-adc084s021.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 18/23] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (16 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 17/23] iio:adc:ti-adc084s021: drop of_match_ptr protection Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-06-30  7:20   ` Andy Shevchenko
  2020-06-28 12:36 ` [PATCH 19/23] iio:adc:ti-adc128s052: drop of_match_ptr protection Jonathan Cameron
                   ` (6 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Jan Kiszka

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
---
 drivers/iio/adc/ti-adc108s102.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/ti-adc108s102.c b/drivers/iio/adc/ti-adc108s102.c
index 9b9b27415c93..183b2245e89b 100644
--- a/drivers/iio/adc/ti-adc108s102.c
+++ b/drivers/iio/adc/ti-adc108s102.c
@@ -20,6 +20,7 @@
 #include <linux/iio/trigger_consumer.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/property.h>
 #include <linux/regulator/consumer.h>
 #include <linux/spi/spi.h>
@@ -299,13 +300,11 @@ static int adc108s102_remove(struct spi_device *spi)
 	return 0;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id adc108s102_of_match[] = {
 	{ .compatible = "ti,adc108s102" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, adc108s102_of_match);
-#endif
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id adc108s102_acpi_ids[] = {
@@ -324,7 +323,7 @@ MODULE_DEVICE_TABLE(spi, adc108s102_id);
 static struct spi_driver adc108s102_driver = {
 	.driver = {
 		.name   = "adc108s102",
-		.of_match_table = of_match_ptr(adc108s102_of_match),
+		.of_match_table = adc108s102_of_match,
 		.acpi_match_table = ACPI_PTR(adc108s102_acpi_ids),
 	},
 	.probe		= adc108s102_probe,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 19/23] iio:adc:ti-adc128s052: drop of_match_ptr protection
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (17 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 18/23] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-06-30  7:22   ` Andy Shevchenko
  2020-06-28 12:36 ` [PATCH 20/23] iio:adc:ti-adc161s626: Drop " Jonathan Cameron
                   ` (5 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Angelo Compagnucci

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---
 drivers/iio/adc/ti-adc128s052.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c
index c1552b0fee04..cc3fb2d1686a 100644
--- a/drivers/iio/adc/ti-adc128s052.c
+++ b/drivers/iio/adc/ti-adc128s052.c
@@ -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


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 20/23] iio:adc:ti-adc161s626: Drop of_match_ptr protection.
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (18 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 19/23] iio:adc:ti-adc128s052: drop of_match_ptr protection Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-06-28 19:51   ` Matt Ranostay
  2020-06-28 12:36 ` [PATCH 21/23] iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
                   ` (4 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Matt Ranostay

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
---
 drivers/iio/adc/ti-adc161s626.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ti-adc161s626.c b/drivers/iio/adc/ti-adc161s626.c
index f27ca3161530..607791ffe7f0 100644
--- a/drivers/iio/adc/ti-adc161s626.c
+++ b/drivers/iio/adc/ti-adc161s626.c
@@ -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


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 21/23] iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections.
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (19 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 20/23] iio:adc:ti-adc161s626: Drop " Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-06-28 23:43   ` Phil Reid
  2020-06-28 12:36 ` [PATCH 22/23] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h Jonathan Cameron
                   ` (3 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Phil Reid

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Phil Reid <preid@electromag.com.au>
---
 drivers/iio/adc/ti-tlc4541.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/ti-tlc4541.c b/drivers/iio/adc/ti-tlc4541.c
index 432238246519..53359a2e5bea 100644
--- a/drivers/iio/adc/ti-tlc4541.c
+++ b/drivers/iio/adc/ti-tlc4541.c
@@ -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,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 22/23] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (20 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 21/23] iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-06-30  7:25   ` Andy Shevchenko
  2020-06-28 12:36 ` [PATCH 23/23] iio:adc:ingenic: drop of_match_ptr protection and include mod_devicetable.h Jonathan Cameron
                   ` (2 subsequent siblings)
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Raveendra Padasalagi

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
---
 drivers/iio/adc/bcm_iproc_adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
index 936da32faa9d..44e1e53ada72 100644
--- a/drivers/iio/adc/bcm_iproc_adc.c
+++ b/drivers/iio/adc/bcm_iproc_adc.c
@@ -4,7 +4,7 @@
  */
 
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
 #include <linux/io.h>
 #include <linux/clk.h>
 #include <linux/mfd/syscon.h>
@@ -617,7 +617,7 @@ static struct platform_driver iproc_adc_driver = {
 	.remove	= iproc_adc_remove,
 	.driver	= {
 		.name	= "iproc-static-adc",
-		.of_match_table = of_match_ptr(iproc_adc_of_match),
+		.of_match_table = iproc_adc_of_match,
 	},
 };
 module_platform_driver(iproc_adc_driver);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 23/23] iio:adc:ingenic: drop of_match_ptr protection and include mod_devicetable.h
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (21 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 22/23] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h Jonathan Cameron
@ 2020-06-28 12:36 ` Jonathan Cameron
  2020-07-04 17:33   ` Jonathan Cameron
  2020-06-28 17:53 ` [PATCH 00/23] iio:adc more of_match_ptr and similar removal Andy Shevchenko
  2020-06-30  7:27 ` Andy Shevchenko
  24 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 12:36 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Artur Rojek

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Artur Rojek <contact@artur-rojek.eu>
---
 drivers/iio/adc/ingenic-adc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/ingenic-adc.c b/drivers/iio/adc/ingenic-adc.c
index 3ea097c9650e..fa7ae7f6677e 100644
--- a/drivers/iio/adc/ingenic-adc.c
+++ b/drivers/iio/adc/ingenic-adc.c
@@ -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,
 };
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* Re: [PATCH 07/23] iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h
  2020-06-28 12:36 ` [PATCH 07/23] iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h Jonathan Cameron
@ 2020-06-28 15:52   ` Uwe Kleine-König
  2020-07-04 16:58     ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Uwe Kleine-König @ 2020-06-28 15:52 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

[-- Attachment #1: Type: text/plain, Size: 706 bytes --]

Hallo Jonathan,

On Sun, Jun 28, 2020 at 01:36:38PM +0100, Jonathan Cameron wrote:
> @@ -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:

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 09/23] iio:adc:ltc2497 drop of_match_ptr protection
  2020-06-28 12:36 ` [PATCH 09/23] iio:adc:ltc2497 drop of_match_ptr protection Jonathan Cameron
@ 2020-06-28 15:53   ` Uwe Kleine-König
  2020-07-04 17:04     ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Uwe Kleine-König @ 2020-06-28 15:53 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Michael Hennerich

[-- Attachment #1: Type: text/plain, Size: 1761 bytes --]

On Sun, Jun 28, 2020 at 01:36:40PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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!)
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Michael Hennerich <michael.hennerich@analog.com>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/iio/adc/ltc2497.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/ltc2497.c b/drivers/iio/adc/ltc2497.c
> index 5db63d7c6bc5..1adddf5a88a9 100644
> --- a/drivers/iio/adc/ltc2497.c
> +++ b/drivers/iio/adc/ltc2497.c
> @@ -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,

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

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 02/23] iio:adc:axp20x: Convert from OF to generic fw / device properties
  2020-06-28 12:36 ` [PATCH 02/23] iio:adc:axp20x: Convert from OF to generic fw / device properties Jonathan Cameron
@ 2020-06-28 17:43   ` Andy Shevchenko
  2020-06-28 19:16     ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Andy Shevchenko @ 2020-06-28 17:43 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron, Quentin Schulz

On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:

> 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.

...

> -               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.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 00/23] iio:adc more of_match_ptr and similar removal
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (22 preceding siblings ...)
  2020-06-28 12:36 ` [PATCH 23/23] iio:adc:ingenic: drop of_match_ptr protection and include mod_devicetable.h Jonathan Cameron
@ 2020-06-28 17:53 ` Andy Shevchenko
  2020-06-28 19:32   ` Jonathan Cameron
  2020-06-30  7:27 ` Andy Shevchenko
  24 siblings, 1 reply; 68+ messages in thread
From: Andy Shevchenko @ 2020-06-28 17:53 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron

On Sun, Jun 28, 2020 at 3:38 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> 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 ?

> 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)


> 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
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 02/23] iio:adc:axp20x: Convert from OF to generic fw / device properties
  2020-06-28 17:43   ` Andy Shevchenko
@ 2020-06-28 19:16     ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 19:16 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron, Quentin Schulz

On Sun, 28 Jun 2020 20:43:50 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > 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.  
> 
> ...
> 
> > -               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


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 00/23] iio:adc more of_match_ptr and similar removal
  2020-06-28 17:53 ` [PATCH 00/23] iio:adc more of_match_ptr and similar removal Andy Shevchenko
@ 2020-06-28 19:32   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-06-28 19:32 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron

On Sun, 28 Jun 2020 20:53:09 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Sun, Jun 28, 2020 at 3:38 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > 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.

> 
> > 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)
> 

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


> 
> > 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
> >  
> 
> 


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 20/23] iio:adc:ti-adc161s626: Drop of_match_ptr protection.
  2020-06-28 12:36 ` [PATCH 20/23] iio:adc:ti-adc161s626: Drop " Jonathan Cameron
@ 2020-06-28 19:51   ` Matt Ranostay
  2020-07-04 17:31     ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Matt Ranostay @ 2020-06-28 19:51 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: open list:IIO SUBSYSTEM AND DRIVERS, Alexandru Ardelean,
	Andy Shevchenko, Jonathan Cameron

On Sun, Jun 28, 2020 at 5:39 AM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> 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.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>

> Cc: Matt Ranostay <matt.ranostay@konsulko.com>
> ---
>  drivers/iio/adc/ti-adc161s626.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ti-adc161s626.c b/drivers/iio/adc/ti-adc161s626.c
> index f27ca3161530..607791ffe7f0 100644
> --- a/drivers/iio/adc/ti-adc161s626.c
> +++ b/drivers/iio/adc/ti-adc161s626.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 21/23] iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections.
  2020-06-28 12:36 ` [PATCH 21/23] iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
@ 2020-06-28 23:43   ` Phil Reid
  2020-07-04 17:32     ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Phil Reid @ 2020-06-28 23:43 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

On 28/06/2020 20:36, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Phil Reid <preid@electromag.com.au>

Reviewed-by: Phil Reid <preid@electromag.com.au>

> ---
>   drivers/iio/adc/ti-tlc4541.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti-tlc4541.c b/drivers/iio/adc/ti-tlc4541.c
> index 432238246519..53359a2e5bea 100644
> --- a/drivers/iio/adc/ti-tlc4541.c
> +++ b/drivers/iio/adc/ti-tlc4541.c
> @@ -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,
> 


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 10/23] iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h include
  2020-06-28 12:36 ` [PATCH 10/23] iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h include Jonathan Cameron
@ 2020-06-29  7:28   ` Jacopo Mondi
  2020-07-04 17:19     ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Jacopo Mondi @ 2020-06-29  7:28 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

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

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

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

Thanks
   j

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

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 08/23] iio:adc:cpcap-adc: Drop of_match_ptr protection and use device_get_match_data
  2020-06-28 12:36 ` [PATCH 08/23] iio:adc:cpcap-adc: Drop of_match_ptr protection and use device_get_match_data Jonathan Cameron
@ 2020-06-29 15:21   ` Tony Lindgren
  2020-07-04 17:00     ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Tony Lindgren @ 2020-06-29 15:21 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

* Jonathan Cameron <jic23@kernel.org> [200628 12:40]:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.

Acked-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 01/23] iio:adc:lpc32xx: Drop of_match_ptr protection
  2020-06-28 12:36 ` [PATCH 01/23] iio:adc:lpc32xx: Drop of_match_ptr protection Jonathan Cameron
@ 2020-06-30  7:01   ` Andy Shevchenko
  2020-07-04 16:49     ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Andy Shevchenko @ 2020-06-30  7:01 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron

On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> 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!

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/iio/adc/lpc32xx_adc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/lpc32xx_adc.c b/drivers/iio/adc/lpc32xx_adc.c
> index bc2712a48844..b56ce15255cf 100644
> --- a/drivers/iio/adc/lpc32xx_adc.c
> +++ b/drivers/iio/adc/lpc32xx_adc.c
> @@ -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,
>         },
>  };
>
> --
> 2.27.0
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h
  2020-06-28 12:36 ` [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h Jonathan Cameron
@ 2020-06-30  7:12   ` Andy Shevchenko
  2020-07-04 15:45     ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Andy Shevchenko @ 2020-06-30  7:12 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron

On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> 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.

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/iio/adc/ti-adc081c.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
> index 82e524b3db88..e00350e6503f 100644
> --- a/drivers/iio/adc/ti-adc081c.c
> +++ b/drivers/iio/adc/ti-adc081c.c
> @@ -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[] = {

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?

> @@ -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
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 18/23] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections
  2020-06-28 12:36 ` [PATCH 18/23] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
@ 2020-06-30  7:20   ` Andy Shevchenko
  2020-07-04 15:54     ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Andy Shevchenko @ 2020-06-30  7:20 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron, Jan Kiszka

On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> 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.

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


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 19/23] iio:adc:ti-adc128s052: drop of_match_ptr protection
  2020-06-28 12:36 ` [PATCH 19/23] iio:adc:ti-adc128s052: drop of_match_ptr protection Jonathan Cameron
@ 2020-06-30  7:22   ` Andy Shevchenko
  2020-07-04 15:58     ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Andy Shevchenko @ 2020-06-30  7:22 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron, Angelo Compagnucci

On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> 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.


> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>
> ---
>  drivers/iio/adc/ti-adc128s052.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c
> index c1552b0fee04..cc3fb2d1686a 100644
> --- a/drivers/iio/adc/ti-adc128s052.c
> +++ b/drivers/iio/adc/ti-adc128s052.c
> @@ -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
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 22/23] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h
  2020-06-28 12:36 ` [PATCH 22/23] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h Jonathan Cameron
@ 2020-06-30  7:25   ` Andy Shevchenko
  2020-07-04 15:59     ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Andy Shevchenko @ 2020-06-30  7:25 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron, Raveendra Padasalagi

On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> 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.

> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
> ---
>  drivers/iio/adc/bcm_iproc_adc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
> index 936da32faa9d..44e1e53ada72 100644
> --- a/drivers/iio/adc/bcm_iproc_adc.c
> +++ b/drivers/iio/adc/bcm_iproc_adc.c
> @@ -4,7 +4,7 @@
>   */
>
>  #include <linux/module.h>
> -#include <linux/of.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/io.h>
>  #include <linux/clk.h>
>  #include <linux/mfd/syscon.h>
> @@ -617,7 +617,7 @@ static struct platform_driver iproc_adc_driver = {
>         .remove = iproc_adc_remove,
>         .driver = {
>                 .name   = "iproc-static-adc",
> -               .of_match_table = of_match_ptr(iproc_adc_of_match),
> +               .of_match_table = iproc_adc_of_match,
>         },
>  };
>  module_platform_driver(iproc_adc_driver);
> --
> 2.27.0
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 00/23] iio:adc more of_match_ptr and similar removal
  2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
                   ` (23 preceding siblings ...)
  2020-06-28 17:53 ` [PATCH 00/23] iio:adc more of_match_ptr and similar removal Andy Shevchenko
@ 2020-06-30  7:27 ` Andy Shevchenko
  2020-07-04 17:35   ` Jonathan Cameron
  24 siblings, 1 reply; 68+ messages in thread
From: Andy Shevchenko @ 2020-06-30  7:27 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron

On Sun, Jun 28, 2020 at 3:38 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> 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.

For the non-commented,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

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

Thanks for a nice clean up!

>
> 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
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h
  2020-06-30  7:12   ` Andy Shevchenko
@ 2020-07-04 15:45     ` Jonathan Cameron
  2020-07-04 17:26       ` Jonathan Cameron
  0 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 15:45 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron,
	Signed-off-by: Dan O'Donovan

On Tue, 30 Jun 2020 10:12:51 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > 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.
> 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > ---
> >  drivers/iio/adc/ti-adc081c.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
> > index 82e524b3db88..e00350e6503f 100644
> > --- a/drivers/iio/adc/ti-adc081c.c
> > +++ b/drivers/iio/adc/ti-adc081c.c
> > @@ -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[] = {  
> 
> 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

> 
> > @@ -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
> >  
> 
> 


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 18/23] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections
  2020-06-30  7:20   ` Andy Shevchenko
@ 2020-07-04 15:54     ` Jonathan Cameron
  2020-07-04 18:16       ` Andy Shevchenko
  0 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 15:54 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron, Jan Kiszka

On Tue, 30 Jun 2020 10:20:55 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > 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.

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

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


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 19/23] iio:adc:ti-adc128s052: drop of_match_ptr protection
  2020-06-30  7:22   ` Andy Shevchenko
@ 2020-07-04 15:58     ` Jonathan Cameron
  2020-07-04 18:20       ` Andy Shevchenko
  0 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 15:58 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron, Angelo Compagnucci

On Tue, 30 Jun 2020 10:22:45 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > 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.

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.

> 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

> 
> 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>
> > ---
> >  drivers/iio/adc/ti-adc128s052.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c
> > index c1552b0fee04..cc3fb2d1686a 100644
> > --- a/drivers/iio/adc/ti-adc128s052.c
> > +++ b/drivers/iio/adc/ti-adc128s052.c
> > @@ -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
> >  
> 
> 


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 22/23] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h
  2020-06-30  7:25   ` Andy Shevchenko
@ 2020-07-04 15:59     ` Jonathan Cameron
  2020-07-04 18:22       ` Andy Shevchenko
  0 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 15:59 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron, Raveendra Padasalagi

On Tue, 30 Jun 2020 10:25:24 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > 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.

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

Thanks,

Jonathan

> 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
> > ---
> >  drivers/iio/adc/bcm_iproc_adc.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
> > index 936da32faa9d..44e1e53ada72 100644
> > --- a/drivers/iio/adc/bcm_iproc_adc.c
> > +++ b/drivers/iio/adc/bcm_iproc_adc.c
> > @@ -4,7 +4,7 @@
> >   */
> >
> >  #include <linux/module.h>
> > -#include <linux/of.h>
> > +#include <linux/mod_devicetable.h>
> >  #include <linux/io.h>
> >  #include <linux/clk.h>
> >  #include <linux/mfd/syscon.h>
> > @@ -617,7 +617,7 @@ static struct platform_driver iproc_adc_driver = {
> >         .remove = iproc_adc_remove,
> >         .driver = {
> >                 .name   = "iproc-static-adc",
> > -               .of_match_table = of_match_ptr(iproc_adc_of_match),
> > +               .of_match_table = iproc_adc_of_match,
> >         },
> >  };
> >  module_platform_driver(iproc_adc_driver);
> > --
> > 2.27.0
> >  
> 
> 


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 01/23] iio:adc:lpc32xx: Drop of_match_ptr protection
  2020-06-30  7:01   ` Andy Shevchenko
@ 2020-07-04 16:49     ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 16:49 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron

On Tue, 30 Jun 2020 10:01:29 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > 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!
> 
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

> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > ---
> >  drivers/iio/adc/lpc32xx_adc.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/adc/lpc32xx_adc.c b/drivers/iio/adc/lpc32xx_adc.c
> > index bc2712a48844..b56ce15255cf 100644
> > --- a/drivers/iio/adc/lpc32xx_adc.c
> > +++ b/drivers/iio/adc/lpc32xx_adc.c
> > @@ -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,
> >         },
> >  };
> >
> > --
> > 2.27.0
> >  
> 
> 


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 03/23] iio:adc:hi8435: Drop unused of_gpio.h header
  2020-06-28 12:36 ` [PATCH 03/23] iio:adc:hi8435: Drop unused of_gpio.h header Jonathan Cameron
@ 2020-07-04 16:52   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 16:52 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Nikita Yushchenko, Vladimir Barinov

On Sun, 28 Jun 2020 13:36:34 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> I guess this is a left over from some earlier cleanup. Not used
> currently.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
> Cc: Vladimir Barinov <vladimir.barinov@cogentembedded.com>

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

Thanks,

Jonathan

> ---
>  drivers/iio/adc/hi8435.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/hi8435.c b/drivers/iio/adc/hi8435.c
> index 127e78243233..235374ec7bab 100644
> --- a/drivers/iio/adc/hi8435.c
> +++ b/drivers/iio/adc/hi8435.c
> @@ -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>
>  


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 04/23] iio:adc:hi8435: Drop of_match_ptr protection.
  2020-06-28 12:36 ` [PATCH 04/23] iio:adc:hi8435: Drop of_match_ptr protection Jonathan Cameron
@ 2020-07-04 16:53   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 16:53 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Vladimir Barinov, Nikita Yushchenko

On Sun, 28 Jun 2020 13:36:35 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
> Cc: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Applied.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/hi8435.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/hi8435.c b/drivers/iio/adc/hi8435.c
> index 235374ec7bab..074c30970465 100644
> --- a/drivers/iio/adc/hi8435.c
> +++ b/drivers/iio/adc/hi8435.c
> @@ -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,


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 05/23] iio:adc:max1363: Drop of_match_ptr and use generic device_get_match_data
  2020-06-28 12:36 ` [PATCH 05/23] iio:adc:max1363: Drop of_match_ptr and use generic device_get_match_data Jonathan Cameron
@ 2020-07-04 16:54   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 16:54 UTC (permalink / raw)
  To: linux-iio; +Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

On Sun, 28 Jun 2020 13:36:36 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Applied.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/max1363.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
> index d8da5da74b77..420e2ec154fc 100644
> --- a/drivers/iio/adc/max1363.c
> +++ b/drivers/iio/adc/max1363.c
> @@ -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,


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 06/23] iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections
  2020-06-28 12:36 ` [PATCH 06/23] iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections Jonathan Cameron
@ 2020-07-04 16:56   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 16:56 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Miquel Raynal, Philippe Reynes

On Sun, 28 Jun 2020 13:36:37 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Philippe Reynes <tremyfr@yahoo.fr>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to poke at it.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/max1027.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> index 9e993ccd14de..ca1dff3924ff 100644
> --- a/drivers/iio/adc/max1027.c
> +++ b/drivers/iio/adc/max1027.c
> @@ -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,


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 07/23] iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h
  2020-06-28 15:52   ` Uwe Kleine-König
@ 2020-07-04 16:58     ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 16:58 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-iio, alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

On Sun, 28 Jun 2020 17:52:21 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> Hallo Jonathan,
> 
> On Sun, Jun 28, 2020 at 01:36:38PM +0100, Jonathan Cameron wrote:
> > @@ -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:
> 
> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thanks, 

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

Thanks,

Jonathan

> 
> Thanks
> Uwe
> 


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 08/23] iio:adc:cpcap-adc: Drop of_match_ptr protection and use device_get_match_data
  2020-06-29 15:21   ` Tony Lindgren
@ 2020-07-04 17:00     ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:00 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-iio, alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

On Mon, 29 Jun 2020 08:21:11 -0700
Tony Lindgren <tony@atomide.com> wrote:

> * Jonathan Cameron <jic23@kernel.org> [200628 12:40]:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > 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.  
> 
> Acked-by: Tony Lindgren <tony@atomide.com>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan



^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 09/23] iio:adc:ltc2497 drop of_match_ptr protection
  2020-06-28 15:53   ` Uwe Kleine-König
@ 2020-07-04 17:04     ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:04 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-iio, alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Michael Hennerich

On Sun, 28 Jun 2020 17:53:24 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> On Sun, Jun 28, 2020 at 01:36:40PM +0100, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > 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!)
> > 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Michael Hennerich <michael.hennerich@analog.com>
> > Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> >  drivers/iio/adc/ltc2497.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/ltc2497.c b/drivers/iio/adc/ltc2497.c
> > index 5db63d7c6bc5..1adddf5a88a9 100644
> > --- a/drivers/iio/adc/ltc2497.c
> > +++ b/drivers/iio/adc/ltc2497.c
> > @@ -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,  
> 
> This was the copy source of ltc2496_driver. there the change was fine,
> so it is here:
> 
> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Applied thanks,

J

> 
> Best regards
> Uwe
> 


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 10/23] iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h include
  2020-06-29  7:28   ` Jacopo Mondi
@ 2020-07-04 17:19     ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:19 UTC (permalink / raw)
  To: Jacopo Mondi
  Cc: linux-iio, alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

On Mon, 29 Jun 2020 09:28:09 +0200
Jacopo Mondi <jacopo@jmondi.org> wrote:

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

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

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

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

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

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

Jonathan

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


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 11/23] iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections
  2020-06-28 12:36 ` [PATCH 11/23] iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections Jonathan Cameron
@ 2020-07-04 17:20   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:20 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Akinobu Mita

On Sun, 28 Jun 2020 13:36:42 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Akinobu Mita <akinobu.mita@gmail.com>
Applied.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/max1118.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/max1118.c b/drivers/iio/adc/max1118.c
> index 273fbea2a515..01b20e420ac4 100644
> --- a/drivers/iio/adc/max1118.c
> +++ b/drivers/iio/adc/max1118.c
> @@ -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,


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 12/23] iio:adc:mcp320x: Drop CONFIG_OF and of_match_ptr protections
  2020-06-28 12:36 ` [PATCH 12/23] iio:adc:mcp320x: Drop CONFIG_OF and " Jonathan Cameron
@ 2020-07-04 17:21   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:21 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Oskar Andero, Søren Andersen, Lukas Wunner

On Sun, 28 Jun 2020 13:36:43 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Oskar Andero <oskar.andero@gmail.com>
> Cc: Søren Andersen <san@rosetechnology.dk>
> Cc: Lukas Wunner <lukas@wunner.de>
Applied

> ---
>  drivers/iio/adc/mcp320x.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
> index e533f1064cf8..bb37e66ff7dc 100644
> --- a/drivers/iio/adc/mcp320x.c
> +++ b/drivers/iio/adc/mcp320x.c
> @@ -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,


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 13/23] iio:adc:mcp3422: remove CONFIG_OF and of_match_ptr protections
  2020-06-28 12:36 ` [PATCH 13/23] iio:adc:mcp3422: remove " Jonathan Cameron
@ 2020-07-04 17:22   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:22 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Angelo Compagnucci

On Sun, 28 Jun 2020 13:36:44 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Applied.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/mcp3422.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c
> index 40e0d3ed05a5..ec9c79199ffb 100644
> --- a/drivers/iio/adc/mcp3422.c
> +++ b/drivers/iio/adc/mcp3422.c
> @@ -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,


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 14/23] iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes
  2020-06-28 12:36 ` [PATCH 14/23] iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes Jonathan Cameron
@ 2020-07-04 17:24   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:24 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Arnaud Pouliquen

On Sun, 28 Jun 2020 13:36:45 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Applied.

Thanks,

J
> ---
>  drivers/iio/adc/sd_adc_modulator.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/sd_adc_modulator.c b/drivers/iio/adc/sd_adc_modulator.c
> index 1d6c246609c8..327cc2097f6c 100644
> --- a/drivers/iio/adc/sd_adc_modulator.c
> +++ b/drivers/iio/adc/sd_adc_modulator.c
> @@ -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,
>  };


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h
  2020-07-04 15:45     ` Jonathan Cameron
@ 2020-07-04 17:26       ` Jonathan Cameron
  2020-07-04 18:31         ` Andy Shevchenko
  0 siblings, 1 reply; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:26 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron,
	Signed-off-by: Dan O'Donovan

On Sat, 4 Jul 2020 16:45:05 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Tue, 30 Jun 2020 10:12:51 +0300
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> 
> > On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:  
> > >
> > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > >
> > > 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.
> >   
> > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > ---
> > >  drivers/iio/adc/ti-adc081c.c | 6 ++----
> > >  1 file changed, 2 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
> > > index 82e524b3db88..e00350e6503f 100644
> > > --- a/drivers/iio/adc/ti-adc081c.c
> > > +++ b/drivers/iio/adc/ti-adc081c.c
> > > @@ -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[] = {    
> > 
> > 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.
> 
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

> Jonathan
> 
> >   
> > > @@ -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
> > >    
> > 
> >   
> 


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 16/23] iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections
  2020-06-28 12:36 ` [PATCH 16/23] iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
@ 2020-07-04 17:29   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:29 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Akinobu Mita

On Sun, 28 Jun 2020 13:36:47 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Akinobu Mita <akinobu.mita@gmail.com>
Applied thanks

J
> ---
>  drivers/iio/adc/ti-adc0832.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti-adc0832.c b/drivers/iio/adc/ti-adc0832.c
> index 3eb3ba5fb610..05061dc05b32 100644
> --- a/drivers/iio/adc/ti-adc0832.c
> +++ b/drivers/iio/adc/ti-adc0832.c
> @@ -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,


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 17/23] iio:adc:ti-adc084s021: drop of_match_ptr protection
  2020-06-28 12:36 ` [PATCH 17/23] iio:adc:ti-adc084s021: drop of_match_ptr protection Jonathan Cameron
@ 2020-07-04 17:30   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:30 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron,
	Mårten Lindahl

On Sun, 28 Jun 2020 13:36:48 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Mårten Lindahl <martenli@axis.com>
Applied.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/ti-adc084s021.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ti-adc084s021.c b/drivers/iio/adc/ti-adc084s021.c
> index c2db2435f419..5678bf7499b1 100644
> --- a/drivers/iio/adc/ti-adc084s021.c
> +++ b/drivers/iio/adc/ti-adc084s021.c
> @@ -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,


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 20/23] iio:adc:ti-adc161s626: Drop of_match_ptr protection.
  2020-06-28 19:51   ` Matt Ranostay
@ 2020-07-04 17:31     ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:31 UTC (permalink / raw)
  To: Matt Ranostay
  Cc: open list:IIO SUBSYSTEM AND DRIVERS, Alexandru Ardelean,
	Andy Shevchenko, Jonathan Cameron

On Sun, 28 Jun 2020 12:51:09 -0700
Matt Ranostay <matt.ranostay@konsulko.com> wrote:

> On Sun, Jun 28, 2020 at 5:39 AM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > 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.
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>  
> 
> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Applied.

Thanks,

Jonathan

> 
> > Cc: Matt Ranostay <matt.ranostay@konsulko.com>
> > ---
> >  drivers/iio/adc/ti-adc161s626.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/adc/ti-adc161s626.c b/drivers/iio/adc/ti-adc161s626.c
> > index f27ca3161530..607791ffe7f0 100644
> > --- a/drivers/iio/adc/ti-adc161s626.c
> > +++ b/drivers/iio/adc/ti-adc161s626.c
> > @@ -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
> >  


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 21/23] iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections.
  2020-06-28 23:43   ` Phil Reid
@ 2020-07-04 17:32     ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:32 UTC (permalink / raw)
  To: Phil Reid
  Cc: linux-iio, alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron

On Mon, 29 Jun 2020 07:43:55 +0800
Phil Reid <preid@electromag.com.au> wrote:

> On 28/06/2020 20:36, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > 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.
> > 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Phil Reid <preid@electromag.com.au>  
> 
> Reviewed-by: Phil Reid <preid@electromag.com.au>

Applied,

Thanks,

Jonathan

> 
> > ---
> >   drivers/iio/adc/ti-tlc4541.c | 5 ++---
> >   1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/ti-tlc4541.c b/drivers/iio/adc/ti-tlc4541.c
> > index 432238246519..53359a2e5bea 100644
> > --- a/drivers/iio/adc/ti-tlc4541.c
> > +++ b/drivers/iio/adc/ti-tlc4541.c
> > @@ -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,
> >   
> 


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 23/23] iio:adc:ingenic: drop of_match_ptr protection and include mod_devicetable.h
  2020-06-28 12:36 ` [PATCH 23/23] iio:adc:ingenic: drop of_match_ptr protection and include mod_devicetable.h Jonathan Cameron
@ 2020-07-04 17:33   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:33 UTC (permalink / raw)
  To: linux-iio
  Cc: alexandru.Ardelean, Andy Shevchenko, Jonathan Cameron, Artur Rojek

On Sun, 28 Jun 2020 13:36:54 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> 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.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Artur Rojek <contact@artur-rojek.eu>
Applied thanks,

Jonathan

> ---
>  drivers/iio/adc/ingenic-adc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/ingenic-adc.c b/drivers/iio/adc/ingenic-adc.c
> index 3ea097c9650e..fa7ae7f6677e 100644
> --- a/drivers/iio/adc/ingenic-adc.c
> +++ b/drivers/iio/adc/ingenic-adc.c
> @@ -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,
>  };


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 00/23] iio:adc more of_match_ptr and similar removal
  2020-06-30  7:27 ` Andy Shevchenko
@ 2020-07-04 17:35   ` Jonathan Cameron
  0 siblings, 0 replies; 68+ messages in thread
From: Jonathan Cameron @ 2020-07-04 17:35 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron

On Tue, 30 Jun 2020 10:27:49 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Sun, Jun 28, 2020 at 3:38 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > 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.  
> 
> For the non-commented,
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> 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

> 
> >
> > 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
> >  
> 
> 


^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 18/23] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections
  2020-07-04 15:54     ` Jonathan Cameron
@ 2020-07-04 18:16       ` Andy Shevchenko
  0 siblings, 0 replies; 68+ messages in thread
From: Andy Shevchenko @ 2020-07-04 18:16 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron, Jan Kiszka

On Sat, Jul 4, 2020 at 6:55 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Tue, 30 Jun 2020 10:20:55 +0300
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
>
> > On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
> > >
> > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > >
> > > 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.
>
> 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.

> 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.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 19/23] iio:adc:ti-adc128s052: drop of_match_ptr protection
  2020-07-04 15:58     ` Jonathan Cameron
@ 2020-07-04 18:20       ` Andy Shevchenko
  0 siblings, 0 replies; 68+ messages in thread
From: Andy Shevchenko @ 2020-07-04 18:20 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron, Angelo Compagnucci

On Sat, Jul 4, 2020 at 6:58 PM Jonathan Cameron <jic23@kernel.org> wrote:
> On Tue, 30 Jun 2020 10:22:45 +0300
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> > On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> 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.

> > 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).

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

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 22/23] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h
  2020-07-04 15:59     ` Jonathan Cameron
@ 2020-07-04 18:22       ` Andy Shevchenko
  0 siblings, 0 replies; 68+ messages in thread
From: Andy Shevchenko @ 2020-07-04 18:22 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron, Raveendra Padasalagi

On Sat, Jul 4, 2020 at 6:59 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Tue, 30 Jun 2020 10:25:24 +0300
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
>
> > On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
> > >
> > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > >
> > > 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.
>
> 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".

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h
  2020-07-04 17:26       ` Jonathan Cameron
@ 2020-07-04 18:31         ` Andy Shevchenko
  0 siblings, 0 replies; 68+ messages in thread
From: Andy Shevchenko @ 2020-07-04 18:31 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Alexandru Ardelean, Jonathan Cameron, Dan O'Donovan

On Sat, Jul 4, 2020 at 8:26 PM Jonathan Cameron
<jic23@jic23.retrosnub.co.uk> wrote:
> On Sat, 4 Jul 2020 16:45:05 +0100
> Jonathan Cameron <jic23@kernel.org> wrote:
> > On Tue, 30 Jun 2020 10:12:51 +0300
> > Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> > > On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:

...

> > > >  #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.

> > 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.
> >
> 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.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 68+ messages in thread

end of thread, other threads:[~2020-07-04 18:31 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-28 12:36 [PATCH 00/23] iio:adc more of_match_ptr and similar removal Jonathan Cameron
2020-06-28 12:36 ` [PATCH 01/23] iio:adc:lpc32xx: Drop of_match_ptr protection Jonathan Cameron
2020-06-30  7:01   ` Andy Shevchenko
2020-07-04 16:49     ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 02/23] iio:adc:axp20x: Convert from OF to generic fw / device properties Jonathan Cameron
2020-06-28 17:43   ` Andy Shevchenko
2020-06-28 19:16     ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 03/23] iio:adc:hi8435: Drop unused of_gpio.h header Jonathan Cameron
2020-07-04 16:52   ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 04/23] iio:adc:hi8435: Drop of_match_ptr protection Jonathan Cameron
2020-07-04 16:53   ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 05/23] iio:adc:max1363: Drop of_match_ptr and use generic device_get_match_data Jonathan Cameron
2020-07-04 16:54   ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 06/23] iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections Jonathan Cameron
2020-07-04 16:56   ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 07/23] iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h Jonathan Cameron
2020-06-28 15:52   ` Uwe Kleine-König
2020-07-04 16:58     ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 08/23] iio:adc:cpcap-adc: Drop of_match_ptr protection and use device_get_match_data Jonathan Cameron
2020-06-29 15:21   ` Tony Lindgren
2020-07-04 17:00     ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 09/23] iio:adc:ltc2497 drop of_match_ptr protection Jonathan Cameron
2020-06-28 15:53   ` Uwe Kleine-König
2020-07-04 17:04     ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 10/23] iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h include Jonathan Cameron
2020-06-29  7:28   ` Jacopo Mondi
2020-07-04 17:19     ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 11/23] iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections Jonathan Cameron
2020-07-04 17:20   ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 12/23] iio:adc:mcp320x: Drop CONFIG_OF and " Jonathan Cameron
2020-07-04 17:21   ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 13/23] iio:adc:mcp3422: remove " Jonathan Cameron
2020-07-04 17:22   ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 14/23] iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes Jonathan Cameron
2020-07-04 17:24   ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 15/23] iio:adc:ti-adc081c: Drop of_match_ptr and change to mod_devicetable.h Jonathan Cameron
2020-06-30  7:12   ` Andy Shevchenko
2020-07-04 15:45     ` Jonathan Cameron
2020-07-04 17:26       ` Jonathan Cameron
2020-07-04 18:31         ` Andy Shevchenko
2020-06-28 12:36 ` [PATCH 16/23] iio:adc:ti-adc0832: drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
2020-07-04 17:29   ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 17/23] iio:adc:ti-adc084s021: drop of_match_ptr protection Jonathan Cameron
2020-07-04 17:30   ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 18/23] iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
2020-06-30  7:20   ` Andy Shevchenko
2020-07-04 15:54     ` Jonathan Cameron
2020-07-04 18:16       ` Andy Shevchenko
2020-06-28 12:36 ` [PATCH 19/23] iio:adc:ti-adc128s052: drop of_match_ptr protection Jonathan Cameron
2020-06-30  7:22   ` Andy Shevchenko
2020-07-04 15:58     ` Jonathan Cameron
2020-07-04 18:20       ` Andy Shevchenko
2020-06-28 12:36 ` [PATCH 20/23] iio:adc:ti-adc161s626: Drop " Jonathan Cameron
2020-06-28 19:51   ` Matt Ranostay
2020-07-04 17:31     ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 21/23] iio:adc:ti-tlc4541: Drop CONFIG_OF and of_match_ptr protections Jonathan Cameron
2020-06-28 23:43   ` Phil Reid
2020-07-04 17:32     ` Jonathan Cameron
2020-06-28 12:36 ` [PATCH 22/23] iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h Jonathan Cameron
2020-06-30  7:25   ` Andy Shevchenko
2020-07-04 15:59     ` Jonathan Cameron
2020-07-04 18:22       ` Andy Shevchenko
2020-06-28 12:36 ` [PATCH 23/23] iio:adc:ingenic: drop of_match_ptr protection and include mod_devicetable.h Jonathan Cameron
2020-07-04 17:33   ` Jonathan Cameron
2020-06-28 17:53 ` [PATCH 00/23] iio:adc more of_match_ptr and similar removal Andy Shevchenko
2020-06-28 19:32   ` Jonathan Cameron
2020-06-30  7:27 ` Andy Shevchenko
2020-07-04 17:35   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).