linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion
@ 2019-12-16 17:38 Andy Shevchenko
  2019-12-16 17:38 ` [PATCH v1 2/9] iio: accel: st_accel: Drop unnecessary #else branch for ACPI Andy Shevchenko
                   ` (8 more replies)
  0 siblings, 9 replies; 22+ messages in thread
From: Andy Shevchenko @ 2019-12-16 17:38 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler
  Cc: Andy Shevchenko

There is no evidence that the driver supports or needs ACPI APIs.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/light/st_uvis25_i2c.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/iio/light/st_uvis25_i2c.c b/drivers/iio/light/st_uvis25_i2c.c
index dacbac6a6662..4889bbeb0c73 100644
--- a/drivers/iio/light/st_uvis25_i2c.c
+++ b/drivers/iio/light/st_uvis25_i2c.c
@@ -9,7 +9,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/acpi.h>
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <linux/regmap.h>
-- 
2.24.0


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

* [PATCH v1 2/9] iio: accel: st_accel: Drop unnecessary #else branch for ACPI
  2019-12-16 17:38 [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Andy Shevchenko
@ 2019-12-16 17:38 ` Andy Shevchenko
  2019-12-23 16:17   ` Jonathan Cameron
  2019-12-16 17:38 ` [PATCH v1 3/9] iio: pressure: st_press: " Andy Shevchenko
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2019-12-16 17:38 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler
  Cc: Andy Shevchenko

ACPI_PTR() takes care of the argument in case of !CONFIG_ACPI.
Remove unnecessary #else branch.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/accel/st_accel_i2c.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
index 50fa0fc32baa..0f4aef5448e7 100644
--- a/drivers/iio/accel/st_accel_i2c.c
+++ b/drivers/iio/accel/st_accel_i2c.c
@@ -119,8 +119,6 @@ static const struct acpi_device_id st_accel_acpi_match[] = {
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, st_accel_acpi_match);
-#else
-#define st_accel_acpi_match NULL
 #endif
 
 static const struct i2c_device_id st_accel_id_table[] = {
-- 
2.24.0


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

* [PATCH v1 3/9] iio: pressure: st_press: Drop unnecessary #else branch for ACPI
  2019-12-16 17:38 [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Andy Shevchenko
  2019-12-16 17:38 ` [PATCH v1 2/9] iio: accel: st_accel: Drop unnecessary #else branch for ACPI Andy Shevchenko
@ 2019-12-16 17:38 ` Andy Shevchenko
  2019-12-23 16:19   ` Jonathan Cameron
  2019-12-16 17:38 ` [PATCH v1 4/9] iio: gyro: st_gyro: Mark gyro_pdata with __maybe_unused Andy Shevchenko
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2019-12-16 17:38 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler
  Cc: Andy Shevchenko

ACPI_PTR() takes care of the argument in case of !CONFIG_ACPI.
Remove unnecessary #else branch.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/pressure/st_pressure_i2c.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
index 71d2ed6b4948..6203bc9d5c2d 100644
--- a/drivers/iio/pressure/st_pressure_i2c.c
+++ b/drivers/iio/pressure/st_pressure_i2c.c
@@ -61,8 +61,6 @@ static const struct acpi_device_id st_press_acpi_match[] = {
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, st_press_acpi_match);
-#else
-#define st_press_acpi_match NULL
 #endif
 
 static const struct i2c_device_id st_press_id_table[] = {
-- 
2.24.0


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

* [PATCH v1 4/9] iio: gyro: st_gyro: Mark gyro_pdata with __maybe_unused
  2019-12-16 17:38 [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Andy Shevchenko
  2019-12-16 17:38 ` [PATCH v1 2/9] iio: accel: st_accel: Drop unnecessary #else branch for ACPI Andy Shevchenko
  2019-12-16 17:38 ` [PATCH v1 3/9] iio: pressure: st_press: " Andy Shevchenko
@ 2019-12-16 17:38 ` Andy Shevchenko
  2019-12-23 16:20   ` Jonathan Cameron
  2019-12-16 17:38 ` [PATCH v1 5/9] iio: accel: st_accel: Mark default_accel_pdata " Andy Shevchenko
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2019-12-16 17:38 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler
  Cc: Andy Shevchenko

Since we put static variable to a header file it's copied to each module
that includes the header. But not all of them are actually used it.

Mark gyro_pdata with __maybe_unused to calm a compiler down:

In file included from drivers/iio/gyro/st_gyro_i2c.c:18:
drivers/iio/gyro/st_gyro.h:31:46: warning: ‘gyro_pdata’ defined but not used [-Wunused-const-variable=]
   31 | static const struct st_sensors_platform_data gyro_pdata = {
      |                                              ^~~~~~~~~~
...

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/gyro/st_gyro.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h
index 592f6b34e987..fd9171cc3aba 100644
--- a/drivers/iio/gyro/st_gyro.h
+++ b/drivers/iio/gyro/st_gyro.h
@@ -28,7 +28,7 @@
  * struct st_sensors_platform_data - gyro platform data
  * @drdy_int_pin: DRDY on gyros is available only on INT2 pin.
  */
-static const struct st_sensors_platform_data gyro_pdata = {
+static __maybe_unused const struct st_sensors_platform_data gyro_pdata = {
 	.drdy_int_pin = 2,
 };
 
-- 
2.24.0


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

* [PATCH v1 5/9] iio: accel: st_accel: Mark default_accel_pdata with __maybe_unused
  2019-12-16 17:38 [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Andy Shevchenko
                   ` (2 preceding siblings ...)
  2019-12-16 17:38 ` [PATCH v1 4/9] iio: gyro: st_gyro: Mark gyro_pdata with __maybe_unused Andy Shevchenko
@ 2019-12-16 17:38 ` Andy Shevchenko
  2019-12-23 16:20   ` Jonathan Cameron
  2019-12-16 17:38 ` [PATCH v1 6/9] iio: pressure: st_press: Mark default_press_pdata " Andy Shevchenko
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2019-12-16 17:38 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler
  Cc: Andy Shevchenko

Since we put static variable to a header file it's copied to each module
that includes the header. But not all of them are actually used it.

Mark default_accel_pdata with __maybe_unused to calm a compiler down:

In file included from drivers/iio/accel/st_accel_i2c.c:19:
drivers/iio/accel/st_accel.h:67:46: warning: ‘default_accel_pdata’ defined but not used [-Wunused-const-variable=]
   67 | static const struct st_sensors_platform_data default_accel_pdata = {
      |                                              ^~~~~~~~~~~~~~~~~~~
...

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/accel/st_accel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
index af09943f38c9..5b13e293cade 100644
--- a/drivers/iio/accel/st_accel.h
+++ b/drivers/iio/accel/st_accel.h
@@ -64,7 +64,7 @@ enum st_accel_type {
 * struct st_sensors_platform_data - default accel platform data
 * @drdy_int_pin: default accel DRDY is available on INT1 pin.
 */
-static const struct st_sensors_platform_data default_accel_pdata = {
+static __maybe_unused const struct st_sensors_platform_data default_accel_pdata = {
 	.drdy_int_pin = 1,
 };
 
-- 
2.24.0


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

* [PATCH v1 6/9] iio: pressure: st_press: Mark default_press_pdata with __maybe_unused
  2019-12-16 17:38 [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Andy Shevchenko
                   ` (3 preceding siblings ...)
  2019-12-16 17:38 ` [PATCH v1 5/9] iio: accel: st_accel: Mark default_accel_pdata " Andy Shevchenko
@ 2019-12-16 17:38 ` Andy Shevchenko
  2019-12-23 16:21   ` Jonathan Cameron
  2019-12-16 17:38 ` [PATCH v1 7/9] iio: st_sensors: Describe function parameters in kernel-doc Andy Shevchenko
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2019-12-16 17:38 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler
  Cc: Andy Shevchenko

Since we put static variable to a header file it's copied to each module
that includes the header. But not all of them are actually used it.

Mark default_press_pdata with __maybe_unused to calm a compiler down:

In file included from drivers/iio/pressure/st_pressure_spi.c:18:
drivers/iio/pressure/st_pressure.h:40:46: warning: ‘default_press_pdata’ defined but not used [-Wunused-const-variable=]
   40 | static const struct st_sensors_platform_data default_press_pdata = {
      |                                              ^~~~~~~~~~~~~~~~~~~
...

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/pressure/st_pressure.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/st_pressure.h b/drivers/iio/pressure/st_pressure.h
index c2e47a6c3118..5c746ff6087e 100644
--- a/drivers/iio/pressure/st_pressure.h
+++ b/drivers/iio/pressure/st_pressure.h
@@ -37,7 +37,7 @@ enum st_press_type {
  * struct st_sensors_platform_data - default press platform data
  * @drdy_int_pin: default press DRDY is available on INT1 pin.
  */
-static const struct st_sensors_platform_data default_press_pdata = {
+static __maybe_unused const struct st_sensors_platform_data default_press_pdata = {
 	.drdy_int_pin = 1,
 };
 
-- 
2.24.0


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

* [PATCH v1 7/9] iio: st_sensors: Describe function parameters in kernel-doc
  2019-12-16 17:38 [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Andy Shevchenko
                   ` (4 preceding siblings ...)
  2019-12-16 17:38 ` [PATCH v1 6/9] iio: pressure: st_press: Mark default_press_pdata " Andy Shevchenko
@ 2019-12-16 17:38 ` Andy Shevchenko
  2019-12-23 16:22   ` Jonathan Cameron
  2019-12-16 17:38 ` [PATCH v1 8/9] iio: st_sensors: Drop redundant parameter from st_sensors_of_name_probe() Andy Shevchenko
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2019-12-16 17:38 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler
  Cc: Andy Shevchenko

Kernel documentation script complains that some of the function parameters
are not described:

.../common/st_sensors/st_sensors_trigger.c:29: warning: Function parameter or member 'indio_dev' not described in 'st_sensors_new_samples_available'
.../common/st_sensors/st_sensors_trigger.c:29: warning: Function parameter or member 'sdata' not described in 'st_sensors_new_samples_available'

Describe function parameters where it's appropriate.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/common/st_sensors/st_sensors_trigger.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c
index 4a2efa00f7f2..e817537cdfb5 100644
--- a/drivers/iio/common/st_sensors/st_sensors_trigger.c
+++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c
@@ -19,6 +19,9 @@
 
 /**
  * st_sensors_new_samples_available() - check if more samples came in
+ * @indio_dev: IIO device reference.
+ * @sdata: Sensor data.
+ *
  * returns:
  * 0 - no new samples available
  * 1 - new samples available
-- 
2.24.0


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

* [PATCH v1 8/9] iio: st_sensors: Drop redundant parameter from st_sensors_of_name_probe()
  2019-12-16 17:38 [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Andy Shevchenko
                   ` (5 preceding siblings ...)
  2019-12-16 17:38 ` [PATCH v1 7/9] iio: st_sensors: Describe function parameters in kernel-doc Andy Shevchenko
@ 2019-12-16 17:38 ` Andy Shevchenko
  2019-12-23 16:28   ` Jonathan Cameron
  2019-12-16 17:38 ` [PATCH v1 9/9] iio: st_sensors: Make use of device properties Andy Shevchenko
  2019-12-23 16:15 ` [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Jonathan Cameron
  8 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2019-12-16 17:38 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler
  Cc: Andy Shevchenko

Since we have access to the struct device_driver and thus to the ID table,
there is no need to supply special parameters to st_sensors_of_name_probe().

Besides that we have a common API to get driver match data, there is
no need to do matching separately for OF and ACPI.

Taking into consideration above, simplify the ST sensors code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/accel/st_accel_spi.c              |  3 +-
 .../iio/common/st_sensors/st_sensors_core.c   | 38 +++++++++----------
 .../iio/common/st_sensors/st_sensors_i2c.c    | 21 ----------
 drivers/iio/gyro/st_gyro_i2c.c                |  3 +-
 drivers/iio/gyro/st_gyro_spi.c                |  3 +-
 drivers/iio/magnetometer/st_magn_i2c.c        |  3 +-
 drivers/iio/magnetometer/st_magn_spi.c        |  3 +-
 drivers/iio/pressure/st_pressure_i2c.c        | 14 +------
 drivers/iio/pressure/st_pressure_spi.c        |  3 +-
 include/linux/iio/common/st_sensors.h         | 12 +-----
 include/linux/iio/common/st_sensors_i2c.h     | 10 -----
 11 files changed, 25 insertions(+), 88 deletions(-)

diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
index 8af7027d5598..3e25268638e2 100644
--- a/drivers/iio/accel/st_accel_spi.c
+++ b/drivers/iio/accel/st_accel_spi.c
@@ -107,8 +107,7 @@ static int st_accel_spi_probe(struct spi_device *spi)
 	struct iio_dev *indio_dev;
 	int err;
 
-	st_sensors_of_name_probe(&spi->dev, st_accel_of_match,
-				 spi->modalias, sizeof(spi->modalias));
+	st_sensors_dev_name_probe(&spi->dev, spi->modalias, sizeof(spi->modalias));
 
 	settings = st_accel_get_settings(spi->modalias);
 	if (!settings) {
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 4a3064fb6cd9..42a71a50650f 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -12,6 +12,7 @@
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/iio/iio.h>
+#include <linux/property.h>
 #include <linux/regulator/consumer.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -340,42 +341,37 @@ static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
 
 	return pdata;
 }
+#else
+static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
+		struct st_sensors_platform_data *defdata)
+{
+	return NULL;
+}
+#endif
 
 /**
- * st_sensors_of_name_probe() - device tree probe for ST sensor name
+ * st_sensors_dev_name_probe() - device probe for ST sensor name
  * @dev: driver model representation of the device.
- * @match: the OF match table for the device, containing compatible strings
- *	but also a .data field with the corresponding internal kernel name
- *	used by this sensor.
  * @name: device name buffer reference.
  * @len: device name buffer length.
  *
- * In effect this function matches a compatible string to an internal kernel
+ * In effect this function matches an ID to an internal kernel
  * name for a certain sensor device, so that the rest of the autodetection can
  * rely on that name from this point on. I2C/SPI devices will be renamed
  * to match the internal kernel convention.
  */
-void st_sensors_of_name_probe(struct device *dev,
-			      const struct of_device_id *match,
-			      char *name, int len)
+void st_sensors_dev_name_probe(struct device *dev, char *name, int len)
 {
-	const struct of_device_id *of_id;
+	const void *match;
 
-	of_id = of_match_device(match, dev);
-	if (!of_id || !of_id->data)
+	match = device_get_match_data(dev);
+	if (!match)
 		return;
 
-	/* The name from the OF match takes precedence if present */
-	strlcpy(name, of_id->data, len);
+	/* The name from the match takes precedence if present */
+	strlcpy(name, match, len);
 }
-EXPORT_SYMBOL(st_sensors_of_name_probe);
-#else
-static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
-		struct st_sensors_platform_data *defdata)
-{
-	return NULL;
-}
-#endif
+EXPORT_SYMBOL(st_sensors_dev_name_probe);
 
 int st_sensors_init_sensor(struct iio_dev *indio_dev,
 					struct st_sensors_platform_data *pdata)
diff --git a/drivers/iio/common/st_sensors/st_sensors_i2c.c b/drivers/iio/common/st_sensors/st_sensors_i2c.c
index aa89d54a7c59..286830fb5d35 100644
--- a/drivers/iio/common/st_sensors/st_sensors_i2c.c
+++ b/drivers/iio/common/st_sensors/st_sensors_i2c.c
@@ -11,8 +11,6 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/iio/iio.h>
-#include <linux/of_device.h>
-#include <linux/acpi.h>
 #include <linux/regmap.h>
 
 #include <linux/iio/common/st_sensors_i2c.h>
@@ -68,25 +66,6 @@ int st_sensors_i2c_configure(struct iio_dev *indio_dev,
 }
 EXPORT_SYMBOL(st_sensors_i2c_configure);
 
-#ifdef CONFIG_ACPI
-int st_sensors_match_acpi_device(struct device *dev)
-{
-	const struct acpi_device_id *acpi_id;
-	kernel_ulong_t driver_data = 0;
-
-	if (ACPI_HANDLE(dev)) {
-		acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
-		if (!acpi_id) {
-			dev_err(dev, "No driver data\n");
-			return -EINVAL;
-		}
-		driver_data = acpi_id->driver_data;
-	}
-	return driver_data;
-}
-EXPORT_SYMBOL(st_sensors_match_acpi_device);
-#endif
-
 MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
 MODULE_DESCRIPTION("STMicroelectronics ST-sensors i2c driver");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c
index 05a1a0874bd5..bc0010835ac0 100644
--- a/drivers/iio/gyro/st_gyro_i2c.c
+++ b/drivers/iio/gyro/st_gyro_i2c.c
@@ -70,8 +70,7 @@ static int st_gyro_i2c_probe(struct i2c_client *client,
 	struct iio_dev *indio_dev;
 	int err;
 
-	st_sensors_of_name_probe(&client->dev, st_gyro_of_match,
-				 client->name, sizeof(client->name));
+	st_sensors_dev_name_probe(&client->dev, client->name, sizeof(client->name));
 
 	settings = st_gyro_get_settings(client->name);
 	if (!settings) {
diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c
index b5c624251231..07224d5bf299 100644
--- a/drivers/iio/gyro/st_gyro_spi.c
+++ b/drivers/iio/gyro/st_gyro_spi.c
@@ -74,8 +74,7 @@ static int st_gyro_spi_probe(struct spi_device *spi)
 	struct iio_dev *indio_dev;
 	int err;
 
-	st_sensors_of_name_probe(&spi->dev, st_gyro_of_match,
-				 spi->modalias, sizeof(spi->modalias));
+	st_sensors_dev_name_probe(&spi->dev, spi->modalias, sizeof(spi->modalias));
 
 	settings = st_gyro_get_settings(spi->modalias);
 	if (!settings) {
diff --git a/drivers/iio/magnetometer/st_magn_i2c.c b/drivers/iio/magnetometer/st_magn_i2c.c
index fdba480a12be..bf63777bbc6e 100644
--- a/drivers/iio/magnetometer/st_magn_i2c.c
+++ b/drivers/iio/magnetometer/st_magn_i2c.c
@@ -62,8 +62,7 @@ static int st_magn_i2c_probe(struct i2c_client *client,
 	struct iio_dev *indio_dev;
 	int err;
 
-	st_sensors_of_name_probe(&client->dev, st_magn_of_match,
-				 client->name, sizeof(client->name));
+	st_sensors_dev_name_probe(&client->dev, client->name, sizeof(client->name));
 
 	settings = st_magn_get_settings(client->name);
 	if (!settings) {
diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c
index fbf909bde841..78f846fc120e 100644
--- a/drivers/iio/magnetometer/st_magn_spi.c
+++ b/drivers/iio/magnetometer/st_magn_spi.c
@@ -56,8 +56,7 @@ static int st_magn_spi_probe(struct spi_device *spi)
 	struct iio_dev *indio_dev;
 	int err;
 
-	st_sensors_of_name_probe(&spi->dev, st_magn_of_match,
-				 spi->modalias, sizeof(spi->modalias));
+	st_sensors_dev_name_probe(&spi->dev, spi->modalias, sizeof(spi->modalias));
 
 	settings = st_magn_get_settings(spi->modalias);
 	if (!settings) {
diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
index 6203bc9d5c2d..dd1f515ca1f1 100644
--- a/drivers/iio/pressure/st_pressure_i2c.c
+++ b/drivers/iio/pressure/st_pressure_i2c.c
@@ -10,7 +10,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <linux/acpi.h>
 #include <linux/i2c.h>
 #include <linux/iio/iio.h>
 
@@ -83,18 +82,7 @@ static int st_press_i2c_probe(struct i2c_client *client,
 	struct iio_dev *indio_dev;
 	int ret;
 
-	if (client->dev.of_node) {
-		st_sensors_of_name_probe(&client->dev, st_press_of_match,
-					 client->name, sizeof(client->name));
-	} else if (ACPI_HANDLE(&client->dev)) {
-		ret = st_sensors_match_acpi_device(&client->dev);
-		if ((ret < 0) || (ret >= ST_PRESS_MAX))
-			return -ENODEV;
-
-		strlcpy(client->name, st_press_id_table[ret].name,
-			sizeof(client->name));
-	} else if (!id)
-		return -ENODEV;
+	st_sensors_dev_name_probe(&client->dev, client->name, sizeof(client->name));
 
 	settings = st_press_get_settings(client->name);
 	if (!settings) {
diff --git a/drivers/iio/pressure/st_pressure_spi.c b/drivers/iio/pressure/st_pressure_spi.c
index 7c8b70221e70..dd31241bf4b4 100644
--- a/drivers/iio/pressure/st_pressure_spi.c
+++ b/drivers/iio/pressure/st_pressure_spi.c
@@ -66,8 +66,7 @@ static int st_press_spi_probe(struct spi_device *spi)
 	struct iio_dev *indio_dev;
 	int err;
 
-	st_sensors_of_name_probe(&spi->dev, st_press_of_match,
-				 spi->modalias, sizeof(spi->modalias));
+	st_sensors_dev_name_probe(&spi->dev, spi->modalias, sizeof(spi->modalias));
 
 	settings = st_press_get_settings(spi->modalias);
 	if (!settings) {
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 686be532f4cb..33e939977444 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -315,16 +315,6 @@ ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev,
 ssize_t st_sensors_sysfs_scale_avail(struct device *dev,
 				struct device_attribute *attr, char *buf);
 
-#ifdef CONFIG_OF
-void st_sensors_of_name_probe(struct device *dev,
-			      const struct of_device_id *match,
-			      char *name, int len);
-#else
-static inline void st_sensors_of_name_probe(struct device *dev,
-					    const struct of_device_id *match,
-					    char *name, int len)
-{
-}
-#endif
+void st_sensors_dev_name_probe(struct device *dev, char *name, int len);
 
 #endif /* ST_SENSORS_H */
diff --git a/include/linux/iio/common/st_sensors_i2c.h b/include/linux/iio/common/st_sensors_i2c.h
index 01e424e2af4f..5f15cf01036c 100644
--- a/include/linux/iio/common/st_sensors_i2c.h
+++ b/include/linux/iio/common/st_sensors_i2c.h
@@ -12,18 +12,8 @@
 
 #include <linux/i2c.h>
 #include <linux/iio/common/st_sensors.h>
-#include <linux/of.h>
 
 int st_sensors_i2c_configure(struct iio_dev *indio_dev,
 			     struct i2c_client *client);
 
-#ifdef CONFIG_ACPI
-int st_sensors_match_acpi_device(struct device *dev);
-#else
-static inline int st_sensors_match_acpi_device(struct device *dev)
-{
-	return -ENODEV;
-}
-#endif
-
 #endif /* ST_SENSORS_I2C_H */
-- 
2.24.0


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

* [PATCH v1 9/9] iio: st_sensors: Make use of device properties
  2019-12-16 17:38 [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Andy Shevchenko
                   ` (6 preceding siblings ...)
  2019-12-16 17:38 ` [PATCH v1 8/9] iio: st_sensors: Drop redundant parameter from st_sensors_of_name_probe() Andy Shevchenko
@ 2019-12-16 17:38 ` Andy Shevchenko
  2019-12-23 16:30   ` Jonathan Cameron
  2019-12-23 16:15 ` [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Jonathan Cameron
  8 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2019-12-16 17:38 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler
  Cc: Andy Shevchenko

Device property API allows to gather device resources from different sources,
such as ACPI. Convert the drivers to unleash the power of device property API.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/accel/st_accel_i2c.c              |  6 +-----
 drivers/iio/accel/st_accel_spi.c              |  6 +-----
 .../iio/common/st_sensors/st_sensors_core.c   | 21 +++++--------------
 .../iio/common/st_sensors/st_sensors_spi.c    | 12 ++++++-----
 drivers/iio/gyro/st_gyro_i2c.c                |  6 +-----
 drivers/iio/gyro/st_gyro_spi.c                |  6 +-----
 drivers/iio/magnetometer/st_magn_i2c.c        |  6 +-----
 drivers/iio/magnetometer/st_magn_spi.c        |  6 +-----
 drivers/iio/pressure/st_pressure_i2c.c        |  6 +-----
 drivers/iio/pressure/st_pressure_spi.c        |  6 +-----
 10 files changed, 20 insertions(+), 61 deletions(-)

diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
index 0f4aef5448e7..633955d764cc 100644
--- a/drivers/iio/accel/st_accel_i2c.c
+++ b/drivers/iio/accel/st_accel_i2c.c
@@ -18,7 +18,6 @@
 #include <linux/iio/common/st_sensors_i2c.h>
 #include "st_accel.h"
 
-#ifdef CONFIG_OF
 static const struct of_device_id st_accel_of_match[] = {
 	{
 		/* An older compatible */
@@ -108,9 +107,6 @@ static const struct of_device_id st_accel_of_match[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
-#else
-#define st_accel_of_match NULL
-#endif
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id st_accel_acpi_match[] = {
@@ -193,7 +189,7 @@ static int st_accel_i2c_remove(struct i2c_client *client)
 static struct i2c_driver st_accel_driver = {
 	.driver = {
 		.name = "st-accel-i2c",
-		.of_match_table = of_match_ptr(st_accel_of_match),
+		.of_match_table = st_accel_of_match,
 		.acpi_match_table = ACPI_PTR(st_accel_acpi_match),
 	},
 	.probe_new = st_accel_i2c_probe,
diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
index 3e25268638e2..568ff1bae0ee 100644
--- a/drivers/iio/accel/st_accel_spi.c
+++ b/drivers/iio/accel/st_accel_spi.c
@@ -17,7 +17,6 @@
 #include <linux/iio/common/st_sensors_spi.h>
 #include "st_accel.h"
 
-#ifdef CONFIG_OF
 /*
  * For new single-chip sensors use <device_name> as compatible string.
  * For old single-chip devices keep <device_name>-accel to maintain
@@ -96,9 +95,6 @@ static const struct of_device_id st_accel_of_match[] = {
 	{}
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
-#else
-#define st_accel_of_match	NULL
-#endif
 
 static int st_accel_spi_probe(struct spi_device *spi)
 {
@@ -165,7 +161,7 @@ MODULE_DEVICE_TABLE(spi, st_accel_id_table);
 static struct spi_driver st_accel_driver = {
 	.driver = {
 		.name = "st-accel-spi",
-		.of_match_table = of_match_ptr(st_accel_of_match),
+		.of_match_table = st_accel_of_match,
 	},
 	.probe = st_accel_spi_probe,
 	.remove = st_accel_spi_remove,
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 42a71a50650f..e051edbc43c1 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -14,8 +14,6 @@
 #include <linux/iio/iio.h>
 #include <linux/property.h>
 #include <linux/regulator/consumer.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/regmap.h>
 #include <asm/unaligned.h>
 #include <linux/iio/common/st_sensors.h>
@@ -320,34 +318,25 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
 	return 0;
 }
 
-#ifdef CONFIG_OF
-static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
+static struct st_sensors_platform_data *st_sensors_dev_probe(struct device *dev,
 		struct st_sensors_platform_data *defdata)
 {
 	struct st_sensors_platform_data *pdata;
-	struct device_node *np = dev->of_node;
 	u32 val;
 
-	if (!np)
+	if (!dev_fwnode(dev))
 		return NULL;
 
 	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
-	if (!of_property_read_u32(np, "st,drdy-int-pin", &val) && (val <= 2))
+	if (!device_property_read_u32(dev, "st,drdy-int-pin", &val) && (val <= 2))
 		pdata->drdy_int_pin = (u8) val;
 	else
 		pdata->drdy_int_pin = defdata ? defdata->drdy_int_pin : 0;
 
-	pdata->open_drain = of_property_read_bool(np, "drive-open-drain");
+	pdata->open_drain = device_property_read_bool(dev, "drive-open-drain");
 
 	return pdata;
 }
-#else
-static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
-		struct st_sensors_platform_data *defdata)
-{
-	return NULL;
-}
-#endif
 
 /**
  * st_sensors_dev_name_probe() - device probe for ST sensor name
@@ -381,7 +370,7 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
 	int err = 0;
 
 	/* If OF/DT pdata exists, it will take precedence of anything else */
-	of_pdata = st_sensors_of_probe(indio_dev->dev.parent, pdata);
+	of_pdata = st_sensors_dev_probe(indio_dev->dev.parent, pdata);
 	if (of_pdata)
 		pdata = of_pdata;
 
diff --git a/drivers/iio/common/st_sensors/st_sensors_spi.c b/drivers/iio/common/st_sensors/st_sensors_spi.c
index 2262f81b07c2..1275fb0eda31 100644
--- a/drivers/iio/common/st_sensors/st_sensors_spi.c
+++ b/drivers/iio/common/st_sensors/st_sensors_spi.c
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/iio/iio.h>
+#include <linux/property.h>
 #include <linux/regmap.h>
 
 #include <linux/iio/common/st_sensors_spi.h>
@@ -37,14 +38,15 @@ static const struct regmap_config st_sensors_spi_regmap_multiread_bit_config = {
  */
 static bool st_sensors_is_spi_3_wire(struct spi_device *spi)
 {
-	struct device_node *np = spi->dev.of_node;
 	struct st_sensors_platform_data *pdata;
+	struct device *dev = &spi->dev;
 
-	pdata = (struct st_sensors_platform_data *)spi->dev.platform_data;
-	if ((np && of_property_read_bool(np, "spi-3wire")) ||
-	    (pdata && pdata->spi_3wire)) {
+	if (device_property_read_bool(dev, "spi-3wire"))
+		return true;
+
+	pdata = (struct st_sensors_platform_data *)dev->platform_data;
+	if (pdata && pdata->spi_3wire)
 		return true;
-	}
 
 	return false;
 }
diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c
index bc0010835ac0..8190966e6ff0 100644
--- a/drivers/iio/gyro/st_gyro_i2c.c
+++ b/drivers/iio/gyro/st_gyro_i2c.c
@@ -17,7 +17,6 @@
 #include <linux/iio/common/st_sensors_i2c.h>
 #include "st_gyro.h"
 
-#ifdef CONFIG_OF
 static const struct of_device_id st_gyro_of_match[] = {
 	{
 		.compatible = "st,l3g4200d-gyro",
@@ -58,9 +57,6 @@ static const struct of_device_id st_gyro_of_match[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_gyro_of_match);
-#else
-#define st_gyro_of_match NULL
-#endif
 
 static int st_gyro_i2c_probe(struct i2c_client *client,
 			     const struct i2c_device_id *id)
@@ -121,7 +117,7 @@ MODULE_DEVICE_TABLE(i2c, st_gyro_id_table);
 static struct i2c_driver st_gyro_driver = {
 	.driver = {
 		.name = "st-gyro-i2c",
-		.of_match_table = of_match_ptr(st_gyro_of_match),
+		.of_match_table = st_gyro_of_match,
 	},
 	.probe = st_gyro_i2c_probe,
 	.remove = st_gyro_i2c_remove,
diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c
index 07224d5bf299..efb862763ca3 100644
--- a/drivers/iio/gyro/st_gyro_spi.c
+++ b/drivers/iio/gyro/st_gyro_spi.c
@@ -17,7 +17,6 @@
 #include <linux/iio/common/st_sensors_spi.h>
 #include "st_gyro.h"
 
-#ifdef CONFIG_OF
 /*
  * For new single-chip sensors use <device_name> as compatible string.
  * For old single-chip devices keep <device_name>-gyro to maintain
@@ -63,9 +62,6 @@ static const struct of_device_id st_gyro_of_match[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_gyro_of_match);
-#else
-#define st_gyro_of_match	NULL
-#endif
 
 static int st_gyro_spi_probe(struct spi_device *spi)
 {
@@ -125,7 +121,7 @@ MODULE_DEVICE_TABLE(spi, st_gyro_id_table);
 static struct spi_driver st_gyro_driver = {
 	.driver = {
 		.name = "st-gyro-spi",
-		.of_match_table = of_match_ptr(st_gyro_of_match),
+		.of_match_table = st_gyro_of_match,
 	},
 	.probe = st_gyro_spi_probe,
 	.remove = st_gyro_spi_remove,
diff --git a/drivers/iio/magnetometer/st_magn_i2c.c b/drivers/iio/magnetometer/st_magn_i2c.c
index bf63777bbc6e..c6bb4ce77594 100644
--- a/drivers/iio/magnetometer/st_magn_i2c.c
+++ b/drivers/iio/magnetometer/st_magn_i2c.c
@@ -17,7 +17,6 @@
 #include <linux/iio/common/st_sensors_i2c.h>
 #include "st_magn.h"
 
-#ifdef CONFIG_OF
 static const struct of_device_id st_magn_of_match[] = {
 	{
 		.compatible = "st,lsm303dlh-magn",
@@ -50,9 +49,6 @@ static const struct of_device_id st_magn_of_match[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_magn_of_match);
-#else
-#define st_magn_of_match NULL
-#endif
 
 static int st_magn_i2c_probe(struct i2c_client *client,
 			     const struct i2c_device_id *id)
@@ -112,7 +108,7 @@ MODULE_DEVICE_TABLE(i2c, st_magn_id_table);
 static struct i2c_driver st_magn_driver = {
 	.driver = {
 		.name = "st-magn-i2c",
-		.of_match_table = of_match_ptr(st_magn_of_match),
+		.of_match_table = st_magn_of_match,
 	},
 	.probe = st_magn_i2c_probe,
 	.remove = st_magn_i2c_remove,
diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c
index 78f846fc120e..3d08d74c367d 100644
--- a/drivers/iio/magnetometer/st_magn_spi.c
+++ b/drivers/iio/magnetometer/st_magn_spi.c
@@ -17,7 +17,6 @@
 #include <linux/iio/common/st_sensors_spi.h>
 #include "st_magn.h"
 
-#ifdef CONFIG_OF
 /*
  * For new single-chip sensors use <device_name> as compatible string.
  * For old single-chip devices keep <device_name>-magn to maintain
@@ -45,9 +44,6 @@ static const struct of_device_id st_magn_of_match[] = {
 	{}
 };
 MODULE_DEVICE_TABLE(of, st_magn_of_match);
-#else
-#define st_magn_of_match	NULL
-#endif
 
 static int st_magn_spi_probe(struct spi_device *spi)
 {
@@ -103,7 +99,7 @@ MODULE_DEVICE_TABLE(spi, st_magn_id_table);
 static struct spi_driver st_magn_driver = {
 	.driver = {
 		.name = "st-magn-spi",
-		.of_match_table = of_match_ptr(st_magn_of_match),
+		.of_match_table = st_magn_of_match,
 	},
 	.probe = st_magn_spi_probe,
 	.remove = st_magn_spi_remove,
diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
index dd1f515ca1f1..09c6903f99b8 100644
--- a/drivers/iio/pressure/st_pressure_i2c.c
+++ b/drivers/iio/pressure/st_pressure_i2c.c
@@ -17,7 +17,6 @@
 #include <linux/iio/common/st_sensors_i2c.h>
 #include "st_pressure.h"
 
-#ifdef CONFIG_OF
 static const struct of_device_id st_press_of_match[] = {
 	{
 		.compatible = "st,lps001wp-press",
@@ -50,9 +49,6 @@ static const struct of_device_id st_press_of_match[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_press_of_match);
-#else
-#define st_press_of_match NULL
-#endif
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id st_press_acpi_match[] = {
@@ -119,7 +115,7 @@ static int st_press_i2c_remove(struct i2c_client *client)
 static struct i2c_driver st_press_driver = {
 	.driver = {
 		.name = "st-press-i2c",
-		.of_match_table = of_match_ptr(st_press_of_match),
+		.of_match_table = st_press_of_match,
 		.acpi_match_table = ACPI_PTR(st_press_acpi_match),
 	},
 	.probe = st_press_i2c_probe,
diff --git a/drivers/iio/pressure/st_pressure_spi.c b/drivers/iio/pressure/st_pressure_spi.c
index dd31241bf4b4..b5ee3ec2764f 100644
--- a/drivers/iio/pressure/st_pressure_spi.c
+++ b/drivers/iio/pressure/st_pressure_spi.c
@@ -17,7 +17,6 @@
 #include <linux/iio/common/st_sensors_spi.h>
 #include "st_pressure.h"
 
-#ifdef CONFIG_OF
 /*
  * For new single-chip sensors use <device_name> as compatible string.
  * For old single-chip devices keep <device_name>-press to maintain
@@ -55,9 +54,6 @@ static const struct of_device_id st_press_of_match[] = {
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_press_of_match);
-#else
-#define st_press_of_match	NULL
-#endif
 
 static int st_press_spi_probe(struct spi_device *spi)
 {
@@ -115,7 +111,7 @@ MODULE_DEVICE_TABLE(spi, st_press_id_table);
 static struct spi_driver st_press_driver = {
 	.driver = {
 		.name = "st-press-spi",
-		.of_match_table = of_match_ptr(st_press_of_match),
+		.of_match_table = st_press_of_match,
 	},
 	.probe = st_press_spi_probe,
 	.remove = st_press_spi_remove,
-- 
2.24.0


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

* Re: [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion
  2019-12-16 17:38 [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Andy Shevchenko
                   ` (7 preceding siblings ...)
  2019-12-16 17:38 ` [PATCH v1 9/9] iio: st_sensors: Make use of device properties Andy Shevchenko
@ 2019-12-23 16:15 ` Jonathan Cameron
  8 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2019-12-23 16:15 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler

On Mon, 16 Dec 2019 19:38:45 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> There is no evidence that the driver supports or needs ACPI APIs.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied.
> ---
>  drivers/iio/light/st_uvis25_i2c.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/iio/light/st_uvis25_i2c.c b/drivers/iio/light/st_uvis25_i2c.c
> index dacbac6a6662..4889bbeb0c73 100644
> --- a/drivers/iio/light/st_uvis25_i2c.c
> +++ b/drivers/iio/light/st_uvis25_i2c.c
> @@ -9,7 +9,6 @@
>  
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> -#include <linux/acpi.h>
>  #include <linux/i2c.h>
>  #include <linux/slab.h>
>  #include <linux/regmap.h>


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

* Re: [PATCH v1 2/9] iio: accel: st_accel: Drop unnecessary #else branch for ACPI
  2019-12-16 17:38 ` [PATCH v1 2/9] iio: accel: st_accel: Drop unnecessary #else branch for ACPI Andy Shevchenko
@ 2019-12-23 16:17   ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2019-12-23 16:17 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler

On Mon, 16 Dec 2019 19:38:46 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> ACPI_PTR() takes care of the argument in case of !CONFIG_ACPI.
> Remove unnecessary #else branch.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied.

Thanks,

J
> ---
>  drivers/iio/accel/st_accel_i2c.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
> index 50fa0fc32baa..0f4aef5448e7 100644
> --- a/drivers/iio/accel/st_accel_i2c.c
> +++ b/drivers/iio/accel/st_accel_i2c.c
> @@ -119,8 +119,6 @@ static const struct acpi_device_id st_accel_acpi_match[] = {
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(acpi, st_accel_acpi_match);
> -#else
> -#define st_accel_acpi_match NULL
>  #endif
>  
>  static const struct i2c_device_id st_accel_id_table[] = {


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

* Re: [PATCH v1 3/9] iio: pressure: st_press: Drop unnecessary #else branch for ACPI
  2019-12-16 17:38 ` [PATCH v1 3/9] iio: pressure: st_press: " Andy Shevchenko
@ 2019-12-23 16:19   ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2019-12-23 16:19 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler

On Mon, 16 Dec 2019 19:38:47 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> ACPI_PTR() takes care of the argument in case of !CONFIG_ACPI.
> Remove unnecessary #else branch.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied.

Thanks,

> ---
>  drivers/iio/pressure/st_pressure_i2c.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
> index 71d2ed6b4948..6203bc9d5c2d 100644
> --- a/drivers/iio/pressure/st_pressure_i2c.c
> +++ b/drivers/iio/pressure/st_pressure_i2c.c
> @@ -61,8 +61,6 @@ static const struct acpi_device_id st_press_acpi_match[] = {
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(acpi, st_press_acpi_match);
> -#else
> -#define st_press_acpi_match NULL
>  #endif
>  
>  static const struct i2c_device_id st_press_id_table[] = {


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

* Re: [PATCH v1 4/9] iio: gyro: st_gyro: Mark gyro_pdata with __maybe_unused
  2019-12-16 17:38 ` [PATCH v1 4/9] iio: gyro: st_gyro: Mark gyro_pdata with __maybe_unused Andy Shevchenko
@ 2019-12-23 16:20   ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2019-12-23 16:20 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler

On Mon, 16 Dec 2019 19:38:48 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Since we put static variable to a header file it's copied to each module
> that includes the header. But not all of them are actually used it.
> 
> Mark gyro_pdata with __maybe_unused to calm a compiler down:
> 
> In file included from drivers/iio/gyro/st_gyro_i2c.c:18:
> drivers/iio/gyro/st_gyro.h:31:46: warning: ‘gyro_pdata’ defined but not used [-Wunused-const-variable=]
>    31 | static const struct st_sensors_platform_data gyro_pdata = {
>       |                                              ^~~~~~~~~~
> ...

Applied
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/iio/gyro/st_gyro.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h
> index 592f6b34e987..fd9171cc3aba 100644
> --- a/drivers/iio/gyro/st_gyro.h
> +++ b/drivers/iio/gyro/st_gyro.h
> @@ -28,7 +28,7 @@
>   * struct st_sensors_platform_data - gyro platform data
>   * @drdy_int_pin: DRDY on gyros is available only on INT2 pin.
>   */
> -static const struct st_sensors_platform_data gyro_pdata = {
> +static __maybe_unused const struct st_sensors_platform_data gyro_pdata = {
>  	.drdy_int_pin = 2,
>  };
>  


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

* Re: [PATCH v1 5/9] iio: accel: st_accel: Mark default_accel_pdata with __maybe_unused
  2019-12-16 17:38 ` [PATCH v1 5/9] iio: accel: st_accel: Mark default_accel_pdata " Andy Shevchenko
@ 2019-12-23 16:20   ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2019-12-23 16:20 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler

On Mon, 16 Dec 2019 19:38:49 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Since we put static variable to a header file it's copied to each module
> that includes the header. But not all of them are actually used it.
> 
> Mark default_accel_pdata with __maybe_unused to calm a compiler down:
> 
> In file included from drivers/iio/accel/st_accel_i2c.c:19:
> drivers/iio/accel/st_accel.h:67:46: warning: ‘default_accel_pdata’ defined but not used [-Wunused-const-variable=]
>    67 | static const struct st_sensors_platform_data default_accel_pdata = {
>       |                                              ^~~~~~~~~~~~~~~~~~~
> ...
Applied.

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/iio/accel/st_accel.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/st_accel.h b/drivers/iio/accel/st_accel.h
> index af09943f38c9..5b13e293cade 100644
> --- a/drivers/iio/accel/st_accel.h
> +++ b/drivers/iio/accel/st_accel.h
> @@ -64,7 +64,7 @@ enum st_accel_type {
>  * struct st_sensors_platform_data - default accel platform data
>  * @drdy_int_pin: default accel DRDY is available on INT1 pin.
>  */
> -static const struct st_sensors_platform_data default_accel_pdata = {
> +static __maybe_unused const struct st_sensors_platform_data default_accel_pdata = {
>  	.drdy_int_pin = 1,
>  };
>  


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

* Re: [PATCH v1 6/9] iio: pressure: st_press: Mark default_press_pdata with __maybe_unused
  2019-12-16 17:38 ` [PATCH v1 6/9] iio: pressure: st_press: Mark default_press_pdata " Andy Shevchenko
@ 2019-12-23 16:21   ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2019-12-23 16:21 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler

On Mon, 16 Dec 2019 19:38:50 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Since we put static variable to a header file it's copied to each module
> that includes the header. But not all of them are actually used it.
> 
> Mark default_press_pdata with __maybe_unused to calm a compiler down:
> 
> In file included from drivers/iio/pressure/st_pressure_spi.c:18:
> drivers/iio/pressure/st_pressure.h:40:46: warning: ‘default_press_pdata’ defined but not used [-Wunused-const-variable=]
>    40 | static const struct st_sensors_platform_data default_press_pdata = {
>       |                                              ^~~~~~~~~~~~~~~~~~~
> ...
> 
Applied.

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/iio/pressure/st_pressure.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/pressure/st_pressure.h b/drivers/iio/pressure/st_pressure.h
> index c2e47a6c3118..5c746ff6087e 100644
> --- a/drivers/iio/pressure/st_pressure.h
> +++ b/drivers/iio/pressure/st_pressure.h
> @@ -37,7 +37,7 @@ enum st_press_type {
>   * struct st_sensors_platform_data - default press platform data
>   * @drdy_int_pin: default press DRDY is available on INT1 pin.
>   */
> -static const struct st_sensors_platform_data default_press_pdata = {
> +static __maybe_unused const struct st_sensors_platform_data default_press_pdata = {
>  	.drdy_int_pin = 1,
>  };
>  


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

* Re: [PATCH v1 7/9] iio: st_sensors: Describe function parameters in kernel-doc
  2019-12-16 17:38 ` [PATCH v1 7/9] iio: st_sensors: Describe function parameters in kernel-doc Andy Shevchenko
@ 2019-12-23 16:22   ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2019-12-23 16:22 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler

On Mon, 16 Dec 2019 19:38:51 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Kernel documentation script complains that some of the function parameters
> are not described:
> 
> .../common/st_sensors/st_sensors_trigger.c:29: warning: Function parameter or member 'indio_dev' not described in 'st_sensors_new_samples_available'
> .../common/st_sensors/st_sensors_trigger.c:29: warning: Function parameter or member 'sdata' not described in 'st_sensors_new_samples_available'
> 
> Describe function parameters where it's appropriate.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied.

Thanks,

Jonathan

> ---
>  drivers/iio/common/st_sensors/st_sensors_trigger.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c
> index 4a2efa00f7f2..e817537cdfb5 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_trigger.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c
> @@ -19,6 +19,9 @@
>  
>  /**
>   * st_sensors_new_samples_available() - check if more samples came in
> + * @indio_dev: IIO device reference.
> + * @sdata: Sensor data.
> + *
>   * returns:
>   * 0 - no new samples available
>   * 1 - new samples available


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

* Re: [PATCH v1 8/9] iio: st_sensors: Drop redundant parameter from st_sensors_of_name_probe()
  2019-12-16 17:38 ` [PATCH v1 8/9] iio: st_sensors: Drop redundant parameter from st_sensors_of_name_probe() Andy Shevchenko
@ 2019-12-23 16:28   ` Jonathan Cameron
  2020-01-13 13:58     ` Andy Shevchenko
  0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2019-12-23 16:28 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Denis Ciocca, Lorenzo Bianconi

On Mon, 16 Dec 2019 19:38:52 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Since we have access to the struct device_driver and thus to the ID table,
> there is no need to supply special parameters to st_sensors_of_name_probe().
> 
> Besides that we have a common API to get driver match data, there is
> no need to do matching separately for OF and ACPI.
> 
> Taking into consideration above, simplify the ST sensors code.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This looks good to me, but its big enough that purely on that basis I'd
like to leave it a little longer to let Denis / Lorezo or someone else have time
to take a look.

If I seem to have lost it by the end of the first week in January, give
me a poke.  I may have drunk a few things before then ;)

Thanks,

Jonathan


> ---
>  drivers/iio/accel/st_accel_spi.c              |  3 +-
>  .../iio/common/st_sensors/st_sensors_core.c   | 38 +++++++++----------
>  .../iio/common/st_sensors/st_sensors_i2c.c    | 21 ----------
>  drivers/iio/gyro/st_gyro_i2c.c                |  3 +-
>  drivers/iio/gyro/st_gyro_spi.c                |  3 +-
>  drivers/iio/magnetometer/st_magn_i2c.c        |  3 +-
>  drivers/iio/magnetometer/st_magn_spi.c        |  3 +-
>  drivers/iio/pressure/st_pressure_i2c.c        | 14 +------
>  drivers/iio/pressure/st_pressure_spi.c        |  3 +-
>  include/linux/iio/common/st_sensors.h         | 12 +-----
>  include/linux/iio/common/st_sensors_i2c.h     | 10 -----
>  11 files changed, 25 insertions(+), 88 deletions(-)
> 
> diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
> index 8af7027d5598..3e25268638e2 100644
> --- a/drivers/iio/accel/st_accel_spi.c
> +++ b/drivers/iio/accel/st_accel_spi.c
> @@ -107,8 +107,7 @@ static int st_accel_spi_probe(struct spi_device *spi)
>  	struct iio_dev *indio_dev;
>  	int err;
>  
> -	st_sensors_of_name_probe(&spi->dev, st_accel_of_match,
> -				 spi->modalias, sizeof(spi->modalias));
> +	st_sensors_dev_name_probe(&spi->dev, spi->modalias, sizeof(spi->modalias));
>  
>  	settings = st_accel_get_settings(spi->modalias);
>  	if (!settings) {
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index 4a3064fb6cd9..42a71a50650f 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -12,6 +12,7 @@
>  #include <linux/slab.h>
>  #include <linux/delay.h>
>  #include <linux/iio/iio.h>
> +#include <linux/property.h>
>  #include <linux/regulator/consumer.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
> @@ -340,42 +341,37 @@ static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
>  
>  	return pdata;
>  }
> +#else
> +static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
> +		struct st_sensors_platform_data *defdata)
> +{
> +	return NULL;
> +}
> +#endif
>  
>  /**
> - * st_sensors_of_name_probe() - device tree probe for ST sensor name
> + * st_sensors_dev_name_probe() - device probe for ST sensor name
>   * @dev: driver model representation of the device.
> - * @match: the OF match table for the device, containing compatible strings
> - *	but also a .data field with the corresponding internal kernel name
> - *	used by this sensor.
>   * @name: device name buffer reference.
>   * @len: device name buffer length.
>   *
> - * In effect this function matches a compatible string to an internal kernel
> + * In effect this function matches an ID to an internal kernel
>   * name for a certain sensor device, so that the rest of the autodetection can
>   * rely on that name from this point on. I2C/SPI devices will be renamed
>   * to match the internal kernel convention.
>   */
> -void st_sensors_of_name_probe(struct device *dev,
> -			      const struct of_device_id *match,
> -			      char *name, int len)
> +void st_sensors_dev_name_probe(struct device *dev, char *name, int len)
>  {
> -	const struct of_device_id *of_id;
> +	const void *match;
>  
> -	of_id = of_match_device(match, dev);
> -	if (!of_id || !of_id->data)
> +	match = device_get_match_data(dev);
> +	if (!match)
>  		return;
>  
> -	/* The name from the OF match takes precedence if present */
> -	strlcpy(name, of_id->data, len);
> +	/* The name from the match takes precedence if present */
> +	strlcpy(name, match, len);
>  }
> -EXPORT_SYMBOL(st_sensors_of_name_probe);
> -#else
> -static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
> -		struct st_sensors_platform_data *defdata)
> -{
> -	return NULL;
> -}
> -#endif
> +EXPORT_SYMBOL(st_sensors_dev_name_probe);
>  
>  int st_sensors_init_sensor(struct iio_dev *indio_dev,
>  					struct st_sensors_platform_data *pdata)
> diff --git a/drivers/iio/common/st_sensors/st_sensors_i2c.c b/drivers/iio/common/st_sensors/st_sensors_i2c.c
> index aa89d54a7c59..286830fb5d35 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_i2c.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_i2c.c
> @@ -11,8 +11,6 @@
>  #include <linux/module.h>
>  #include <linux/slab.h>
>  #include <linux/iio/iio.h>
> -#include <linux/of_device.h>
> -#include <linux/acpi.h>
>  #include <linux/regmap.h>
>  
>  #include <linux/iio/common/st_sensors_i2c.h>
> @@ -68,25 +66,6 @@ int st_sensors_i2c_configure(struct iio_dev *indio_dev,
>  }
>  EXPORT_SYMBOL(st_sensors_i2c_configure);
>  
> -#ifdef CONFIG_ACPI
> -int st_sensors_match_acpi_device(struct device *dev)
> -{
> -	const struct acpi_device_id *acpi_id;
> -	kernel_ulong_t driver_data = 0;
> -
> -	if (ACPI_HANDLE(dev)) {
> -		acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
> -		if (!acpi_id) {
> -			dev_err(dev, "No driver data\n");
> -			return -EINVAL;
> -		}
> -		driver_data = acpi_id->driver_data;
> -	}
> -	return driver_data;
> -}
> -EXPORT_SYMBOL(st_sensors_match_acpi_device);
> -#endif
> -
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics ST-sensors i2c driver");
>  MODULE_LICENSE("GPL v2");
> diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c
> index 05a1a0874bd5..bc0010835ac0 100644
> --- a/drivers/iio/gyro/st_gyro_i2c.c
> +++ b/drivers/iio/gyro/st_gyro_i2c.c
> @@ -70,8 +70,7 @@ static int st_gyro_i2c_probe(struct i2c_client *client,
>  	struct iio_dev *indio_dev;
>  	int err;
>  
> -	st_sensors_of_name_probe(&client->dev, st_gyro_of_match,
> -				 client->name, sizeof(client->name));
> +	st_sensors_dev_name_probe(&client->dev, client->name, sizeof(client->name));
>  
>  	settings = st_gyro_get_settings(client->name);
>  	if (!settings) {
> diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c
> index b5c624251231..07224d5bf299 100644
> --- a/drivers/iio/gyro/st_gyro_spi.c
> +++ b/drivers/iio/gyro/st_gyro_spi.c
> @@ -74,8 +74,7 @@ static int st_gyro_spi_probe(struct spi_device *spi)
>  	struct iio_dev *indio_dev;
>  	int err;
>  
> -	st_sensors_of_name_probe(&spi->dev, st_gyro_of_match,
> -				 spi->modalias, sizeof(spi->modalias));
> +	st_sensors_dev_name_probe(&spi->dev, spi->modalias, sizeof(spi->modalias));
>  
>  	settings = st_gyro_get_settings(spi->modalias);
>  	if (!settings) {
> diff --git a/drivers/iio/magnetometer/st_magn_i2c.c b/drivers/iio/magnetometer/st_magn_i2c.c
> index fdba480a12be..bf63777bbc6e 100644
> --- a/drivers/iio/magnetometer/st_magn_i2c.c
> +++ b/drivers/iio/magnetometer/st_magn_i2c.c
> @@ -62,8 +62,7 @@ static int st_magn_i2c_probe(struct i2c_client *client,
>  	struct iio_dev *indio_dev;
>  	int err;
>  
> -	st_sensors_of_name_probe(&client->dev, st_magn_of_match,
> -				 client->name, sizeof(client->name));
> +	st_sensors_dev_name_probe(&client->dev, client->name, sizeof(client->name));
>  
>  	settings = st_magn_get_settings(client->name);
>  	if (!settings) {
> diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c
> index fbf909bde841..78f846fc120e 100644
> --- a/drivers/iio/magnetometer/st_magn_spi.c
> +++ b/drivers/iio/magnetometer/st_magn_spi.c
> @@ -56,8 +56,7 @@ static int st_magn_spi_probe(struct spi_device *spi)
>  	struct iio_dev *indio_dev;
>  	int err;
>  
> -	st_sensors_of_name_probe(&spi->dev, st_magn_of_match,
> -				 spi->modalias, sizeof(spi->modalias));
> +	st_sensors_dev_name_probe(&spi->dev, spi->modalias, sizeof(spi->modalias));
>  
>  	settings = st_magn_get_settings(spi->modalias);
>  	if (!settings) {
> diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
> index 6203bc9d5c2d..dd1f515ca1f1 100644
> --- a/drivers/iio/pressure/st_pressure_i2c.c
> +++ b/drivers/iio/pressure/st_pressure_i2c.c
> @@ -10,7 +10,6 @@
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/slab.h>
> -#include <linux/acpi.h>
>  #include <linux/i2c.h>
>  #include <linux/iio/iio.h>
>  
> @@ -83,18 +82,7 @@ static int st_press_i2c_probe(struct i2c_client *client,
>  	struct iio_dev *indio_dev;
>  	int ret;
>  
> -	if (client->dev.of_node) {
> -		st_sensors_of_name_probe(&client->dev, st_press_of_match,
> -					 client->name, sizeof(client->name));
> -	} else if (ACPI_HANDLE(&client->dev)) {
> -		ret = st_sensors_match_acpi_device(&client->dev);
> -		if ((ret < 0) || (ret >= ST_PRESS_MAX))
> -			return -ENODEV;
> -
> -		strlcpy(client->name, st_press_id_table[ret].name,
> -			sizeof(client->name));
> -	} else if (!id)
> -		return -ENODEV;
> +	st_sensors_dev_name_probe(&client->dev, client->name, sizeof(client->name));
>  
>  	settings = st_press_get_settings(client->name);
>  	if (!settings) {
> diff --git a/drivers/iio/pressure/st_pressure_spi.c b/drivers/iio/pressure/st_pressure_spi.c
> index 7c8b70221e70..dd31241bf4b4 100644
> --- a/drivers/iio/pressure/st_pressure_spi.c
> +++ b/drivers/iio/pressure/st_pressure_spi.c
> @@ -66,8 +66,7 @@ static int st_press_spi_probe(struct spi_device *spi)
>  	struct iio_dev *indio_dev;
>  	int err;
>  
> -	st_sensors_of_name_probe(&spi->dev, st_press_of_match,
> -				 spi->modalias, sizeof(spi->modalias));
> +	st_sensors_dev_name_probe(&spi->dev, spi->modalias, sizeof(spi->modalias));
>  
>  	settings = st_press_get_settings(spi->modalias);
>  	if (!settings) {
> diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
> index 686be532f4cb..33e939977444 100644
> --- a/include/linux/iio/common/st_sensors.h
> +++ b/include/linux/iio/common/st_sensors.h
> @@ -315,16 +315,6 @@ ssize_t st_sensors_sysfs_sampling_frequency_avail(struct device *dev,
>  ssize_t st_sensors_sysfs_scale_avail(struct device *dev,
>  				struct device_attribute *attr, char *buf);
>  
> -#ifdef CONFIG_OF
> -void st_sensors_of_name_probe(struct device *dev,
> -			      const struct of_device_id *match,
> -			      char *name, int len);
> -#else
> -static inline void st_sensors_of_name_probe(struct device *dev,
> -					    const struct of_device_id *match,
> -					    char *name, int len)
> -{
> -}
> -#endif
> +void st_sensors_dev_name_probe(struct device *dev, char *name, int len);
>  
>  #endif /* ST_SENSORS_H */
> diff --git a/include/linux/iio/common/st_sensors_i2c.h b/include/linux/iio/common/st_sensors_i2c.h
> index 01e424e2af4f..5f15cf01036c 100644
> --- a/include/linux/iio/common/st_sensors_i2c.h
> +++ b/include/linux/iio/common/st_sensors_i2c.h
> @@ -12,18 +12,8 @@
>  
>  #include <linux/i2c.h>
>  #include <linux/iio/common/st_sensors.h>
> -#include <linux/of.h>
>  
>  int st_sensors_i2c_configure(struct iio_dev *indio_dev,
>  			     struct i2c_client *client);
>  
> -#ifdef CONFIG_ACPI
> -int st_sensors_match_acpi_device(struct device *dev);
> -#else
> -static inline int st_sensors_match_acpi_device(struct device *dev)
> -{
> -	return -ENODEV;
> -}
> -#endif
> -
>  #endif /* ST_SENSORS_I2C_H */


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

* Re: [PATCH v1 9/9] iio: st_sensors: Make use of device properties
  2019-12-16 17:38 ` [PATCH v1 9/9] iio: st_sensors: Make use of device properties Andy Shevchenko
@ 2019-12-23 16:30   ` Jonathan Cameron
  2020-01-13 13:58     ` Andy Shevchenko
  0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2019-12-23 16:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, lorenzo.bianconi83, denis.ciocca

On Mon, 16 Dec 2019 19:38:53 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Device property API allows to gather device resources from different sources,
> such as ACPI. Convert the drivers to unleash the power of device property API.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Also looks fine, but will allow a bit more time for others to take a look.

Thanks,

Jonathna

> ---
>  drivers/iio/accel/st_accel_i2c.c              |  6 +-----
>  drivers/iio/accel/st_accel_spi.c              |  6 +-----
>  .../iio/common/st_sensors/st_sensors_core.c   | 21 +++++--------------
>  .../iio/common/st_sensors/st_sensors_spi.c    | 12 ++++++-----
>  drivers/iio/gyro/st_gyro_i2c.c                |  6 +-----
>  drivers/iio/gyro/st_gyro_spi.c                |  6 +-----
>  drivers/iio/magnetometer/st_magn_i2c.c        |  6 +-----
>  drivers/iio/magnetometer/st_magn_spi.c        |  6 +-----
>  drivers/iio/pressure/st_pressure_i2c.c        |  6 +-----
>  drivers/iio/pressure/st_pressure_spi.c        |  6 +-----
>  10 files changed, 20 insertions(+), 61 deletions(-)
> 
> diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c
> index 0f4aef5448e7..633955d764cc 100644
> --- a/drivers/iio/accel/st_accel_i2c.c
> +++ b/drivers/iio/accel/st_accel_i2c.c
> @@ -18,7 +18,6 @@
>  #include <linux/iio/common/st_sensors_i2c.h>
>  #include "st_accel.h"
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id st_accel_of_match[] = {
>  	{
>  		/* An older compatible */
> @@ -108,9 +107,6 @@ static const struct of_device_id st_accel_of_match[] = {
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, st_accel_of_match);
> -#else
> -#define st_accel_of_match NULL
> -#endif
>  
>  #ifdef CONFIG_ACPI
>  static const struct acpi_device_id st_accel_acpi_match[] = {
> @@ -193,7 +189,7 @@ static int st_accel_i2c_remove(struct i2c_client *client)
>  static struct i2c_driver st_accel_driver = {
>  	.driver = {
>  		.name = "st-accel-i2c",
> -		.of_match_table = of_match_ptr(st_accel_of_match),
> +		.of_match_table = st_accel_of_match,
>  		.acpi_match_table = ACPI_PTR(st_accel_acpi_match),
>  	},
>  	.probe_new = st_accel_i2c_probe,
> diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
> index 3e25268638e2..568ff1bae0ee 100644
> --- a/drivers/iio/accel/st_accel_spi.c
> +++ b/drivers/iio/accel/st_accel_spi.c
> @@ -17,7 +17,6 @@
>  #include <linux/iio/common/st_sensors_spi.h>
>  #include "st_accel.h"
>  
> -#ifdef CONFIG_OF
>  /*
>   * For new single-chip sensors use <device_name> as compatible string.
>   * For old single-chip devices keep <device_name>-accel to maintain
> @@ -96,9 +95,6 @@ static const struct of_device_id st_accel_of_match[] = {
>  	{}
>  };
>  MODULE_DEVICE_TABLE(of, st_accel_of_match);
> -#else
> -#define st_accel_of_match	NULL
> -#endif
>  
>  static int st_accel_spi_probe(struct spi_device *spi)
>  {
> @@ -165,7 +161,7 @@ MODULE_DEVICE_TABLE(spi, st_accel_id_table);
>  static struct spi_driver st_accel_driver = {
>  	.driver = {
>  		.name = "st-accel-spi",
> -		.of_match_table = of_match_ptr(st_accel_of_match),
> +		.of_match_table = st_accel_of_match,
>  	},
>  	.probe = st_accel_spi_probe,
>  	.remove = st_accel_spi_remove,
> diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
> index 42a71a50650f..e051edbc43c1 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_core.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_core.c
> @@ -14,8 +14,6 @@
>  #include <linux/iio/iio.h>
>  #include <linux/property.h>
>  #include <linux/regulator/consumer.h>
> -#include <linux/of.h>
> -#include <linux/of_device.h>
>  #include <linux/regmap.h>
>  #include <asm/unaligned.h>
>  #include <linux/iio/common/st_sensors.h>
> @@ -320,34 +318,25 @@ static int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,
>  	return 0;
>  }
>  
> -#ifdef CONFIG_OF
> -static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
> +static struct st_sensors_platform_data *st_sensors_dev_probe(struct device *dev,
>  		struct st_sensors_platform_data *defdata)
>  {
>  	struct st_sensors_platform_data *pdata;
> -	struct device_node *np = dev->of_node;
>  	u32 val;
>  
> -	if (!np)
> +	if (!dev_fwnode(dev))
>  		return NULL;
>  
>  	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> -	if (!of_property_read_u32(np, "st,drdy-int-pin", &val) && (val <= 2))
> +	if (!device_property_read_u32(dev, "st,drdy-int-pin", &val) && (val <= 2))
>  		pdata->drdy_int_pin = (u8) val;
>  	else
>  		pdata->drdy_int_pin = defdata ? defdata->drdy_int_pin : 0;
>  
> -	pdata->open_drain = of_property_read_bool(np, "drive-open-drain");
> +	pdata->open_drain = device_property_read_bool(dev, "drive-open-drain");
>  
>  	return pdata;
>  }
> -#else
> -static struct st_sensors_platform_data *st_sensors_of_probe(struct device *dev,
> -		struct st_sensors_platform_data *defdata)
> -{
> -	return NULL;
> -}
> -#endif
>  
>  /**
>   * st_sensors_dev_name_probe() - device probe for ST sensor name
> @@ -381,7 +370,7 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,
>  	int err = 0;
>  
>  	/* If OF/DT pdata exists, it will take precedence of anything else */
> -	of_pdata = st_sensors_of_probe(indio_dev->dev.parent, pdata);
> +	of_pdata = st_sensors_dev_probe(indio_dev->dev.parent, pdata);
>  	if (of_pdata)
>  		pdata = of_pdata;
>  
> diff --git a/drivers/iio/common/st_sensors/st_sensors_spi.c b/drivers/iio/common/st_sensors/st_sensors_spi.c
> index 2262f81b07c2..1275fb0eda31 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_spi.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_spi.c
> @@ -11,6 +11,7 @@
>  #include <linux/module.h>
>  #include <linux/slab.h>
>  #include <linux/iio/iio.h>
> +#include <linux/property.h>
>  #include <linux/regmap.h>
>  
>  #include <linux/iio/common/st_sensors_spi.h>
> @@ -37,14 +38,15 @@ static const struct regmap_config st_sensors_spi_regmap_multiread_bit_config = {
>   */
>  static bool st_sensors_is_spi_3_wire(struct spi_device *spi)
>  {
> -	struct device_node *np = spi->dev.of_node;
>  	struct st_sensors_platform_data *pdata;
> +	struct device *dev = &spi->dev;
>  
> -	pdata = (struct st_sensors_platform_data *)spi->dev.platform_data;
> -	if ((np && of_property_read_bool(np, "spi-3wire")) ||
> -	    (pdata && pdata->spi_3wire)) {
> +	if (device_property_read_bool(dev, "spi-3wire"))
> +		return true;
> +
> +	pdata = (struct st_sensors_platform_data *)dev->platform_data;
> +	if (pdata && pdata->spi_3wire)
>  		return true;
> -	}
>  
>  	return false;
>  }
> diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c
> index bc0010835ac0..8190966e6ff0 100644
> --- a/drivers/iio/gyro/st_gyro_i2c.c
> +++ b/drivers/iio/gyro/st_gyro_i2c.c
> @@ -17,7 +17,6 @@
>  #include <linux/iio/common/st_sensors_i2c.h>
>  #include "st_gyro.h"
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id st_gyro_of_match[] = {
>  	{
>  		.compatible = "st,l3g4200d-gyro",
> @@ -58,9 +57,6 @@ static const struct of_device_id st_gyro_of_match[] = {
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, st_gyro_of_match);
> -#else
> -#define st_gyro_of_match NULL
> -#endif
>  
>  static int st_gyro_i2c_probe(struct i2c_client *client,
>  			     const struct i2c_device_id *id)
> @@ -121,7 +117,7 @@ MODULE_DEVICE_TABLE(i2c, st_gyro_id_table);
>  static struct i2c_driver st_gyro_driver = {
>  	.driver = {
>  		.name = "st-gyro-i2c",
> -		.of_match_table = of_match_ptr(st_gyro_of_match),
> +		.of_match_table = st_gyro_of_match,
>  	},
>  	.probe = st_gyro_i2c_probe,
>  	.remove = st_gyro_i2c_remove,
> diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c
> index 07224d5bf299..efb862763ca3 100644
> --- a/drivers/iio/gyro/st_gyro_spi.c
> +++ b/drivers/iio/gyro/st_gyro_spi.c
> @@ -17,7 +17,6 @@
>  #include <linux/iio/common/st_sensors_spi.h>
>  #include "st_gyro.h"
>  
> -#ifdef CONFIG_OF
>  /*
>   * For new single-chip sensors use <device_name> as compatible string.
>   * For old single-chip devices keep <device_name>-gyro to maintain
> @@ -63,9 +62,6 @@ static const struct of_device_id st_gyro_of_match[] = {
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, st_gyro_of_match);
> -#else
> -#define st_gyro_of_match	NULL
> -#endif
>  
>  static int st_gyro_spi_probe(struct spi_device *spi)
>  {
> @@ -125,7 +121,7 @@ MODULE_DEVICE_TABLE(spi, st_gyro_id_table);
>  static struct spi_driver st_gyro_driver = {
>  	.driver = {
>  		.name = "st-gyro-spi",
> -		.of_match_table = of_match_ptr(st_gyro_of_match),
> +		.of_match_table = st_gyro_of_match,
>  	},
>  	.probe = st_gyro_spi_probe,
>  	.remove = st_gyro_spi_remove,
> diff --git a/drivers/iio/magnetometer/st_magn_i2c.c b/drivers/iio/magnetometer/st_magn_i2c.c
> index bf63777bbc6e..c6bb4ce77594 100644
> --- a/drivers/iio/magnetometer/st_magn_i2c.c
> +++ b/drivers/iio/magnetometer/st_magn_i2c.c
> @@ -17,7 +17,6 @@
>  #include <linux/iio/common/st_sensors_i2c.h>
>  #include "st_magn.h"
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id st_magn_of_match[] = {
>  	{
>  		.compatible = "st,lsm303dlh-magn",
> @@ -50,9 +49,6 @@ static const struct of_device_id st_magn_of_match[] = {
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, st_magn_of_match);
> -#else
> -#define st_magn_of_match NULL
> -#endif
>  
>  static int st_magn_i2c_probe(struct i2c_client *client,
>  			     const struct i2c_device_id *id)
> @@ -112,7 +108,7 @@ MODULE_DEVICE_TABLE(i2c, st_magn_id_table);
>  static struct i2c_driver st_magn_driver = {
>  	.driver = {
>  		.name = "st-magn-i2c",
> -		.of_match_table = of_match_ptr(st_magn_of_match),
> +		.of_match_table = st_magn_of_match,
>  	},
>  	.probe = st_magn_i2c_probe,
>  	.remove = st_magn_i2c_remove,
> diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c
> index 78f846fc120e..3d08d74c367d 100644
> --- a/drivers/iio/magnetometer/st_magn_spi.c
> +++ b/drivers/iio/magnetometer/st_magn_spi.c
> @@ -17,7 +17,6 @@
>  #include <linux/iio/common/st_sensors_spi.h>
>  #include "st_magn.h"
>  
> -#ifdef CONFIG_OF
>  /*
>   * For new single-chip sensors use <device_name> as compatible string.
>   * For old single-chip devices keep <device_name>-magn to maintain
> @@ -45,9 +44,6 @@ static const struct of_device_id st_magn_of_match[] = {
>  	{}
>  };
>  MODULE_DEVICE_TABLE(of, st_magn_of_match);
> -#else
> -#define st_magn_of_match	NULL
> -#endif
>  
>  static int st_magn_spi_probe(struct spi_device *spi)
>  {
> @@ -103,7 +99,7 @@ MODULE_DEVICE_TABLE(spi, st_magn_id_table);
>  static struct spi_driver st_magn_driver = {
>  	.driver = {
>  		.name = "st-magn-spi",
> -		.of_match_table = of_match_ptr(st_magn_of_match),
> +		.of_match_table = st_magn_of_match,
>  	},
>  	.probe = st_magn_spi_probe,
>  	.remove = st_magn_spi_remove,
> diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
> index dd1f515ca1f1..09c6903f99b8 100644
> --- a/drivers/iio/pressure/st_pressure_i2c.c
> +++ b/drivers/iio/pressure/st_pressure_i2c.c
> @@ -17,7 +17,6 @@
>  #include <linux/iio/common/st_sensors_i2c.h>
>  #include "st_pressure.h"
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id st_press_of_match[] = {
>  	{
>  		.compatible = "st,lps001wp-press",
> @@ -50,9 +49,6 @@ static const struct of_device_id st_press_of_match[] = {
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, st_press_of_match);
> -#else
> -#define st_press_of_match NULL
> -#endif
>  
>  #ifdef CONFIG_ACPI
>  static const struct acpi_device_id st_press_acpi_match[] = {
> @@ -119,7 +115,7 @@ static int st_press_i2c_remove(struct i2c_client *client)
>  static struct i2c_driver st_press_driver = {
>  	.driver = {
>  		.name = "st-press-i2c",
> -		.of_match_table = of_match_ptr(st_press_of_match),
> +		.of_match_table = st_press_of_match,
>  		.acpi_match_table = ACPI_PTR(st_press_acpi_match),
>  	},
>  	.probe = st_press_i2c_probe,
> diff --git a/drivers/iio/pressure/st_pressure_spi.c b/drivers/iio/pressure/st_pressure_spi.c
> index dd31241bf4b4..b5ee3ec2764f 100644
> --- a/drivers/iio/pressure/st_pressure_spi.c
> +++ b/drivers/iio/pressure/st_pressure_spi.c
> @@ -17,7 +17,6 @@
>  #include <linux/iio/common/st_sensors_spi.h>
>  #include "st_pressure.h"
>  
> -#ifdef CONFIG_OF
>  /*
>   * For new single-chip sensors use <device_name> as compatible string.
>   * For old single-chip devices keep <device_name>-press to maintain
> @@ -55,9 +54,6 @@ static const struct of_device_id st_press_of_match[] = {
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, st_press_of_match);
> -#else
> -#define st_press_of_match	NULL
> -#endif
>  
>  static int st_press_spi_probe(struct spi_device *spi)
>  {
> @@ -115,7 +111,7 @@ MODULE_DEVICE_TABLE(spi, st_press_id_table);
>  static struct spi_driver st_press_driver = {
>  	.driver = {
>  		.name = "st-press-spi",
> -		.of_match_table = of_match_ptr(st_press_of_match),
> +		.of_match_table = st_press_of_match,
>  	},
>  	.probe = st_press_spi_probe,
>  	.remove = st_press_spi_remove,


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

* Re: [PATCH v1 8/9] iio: st_sensors: Drop redundant parameter from st_sensors_of_name_probe()
  2019-12-23 16:28   ` Jonathan Cameron
@ 2020-01-13 13:58     ` Andy Shevchenko
  2020-01-13 21:52       ` Jonathan Cameron
  0 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2020-01-13 13:58 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Denis Ciocca, Lorenzo Bianconi

On Mon, Dec 23, 2019 at 04:28:10PM +0000, Jonathan Cameron wrote:
> On Mon, 16 Dec 2019 19:38:52 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > Since we have access to the struct device_driver and thus to the ID table,
> > there is no need to supply special parameters to st_sensors_of_name_probe().
> > 
> > Besides that we have a common API to get driver match data, there is
> > no need to do matching separately for OF and ACPI.
> > 
> > Taking into consideration above, simplify the ST sensors code.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> This looks good to me, but its big enough that purely on that basis I'd
> like to leave it a little longer to let Denis / Lorezo or someone else have time
> to take a look.
> 
> If I seem to have lost it by the end of the first week in January, give
> me a poke.  I may have drunk a few things before then ;)

Gentle ping.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 9/9] iio: st_sensors: Make use of device properties
  2019-12-23 16:30   ` Jonathan Cameron
@ 2020-01-13 13:58     ` Andy Shevchenko
  2020-01-13 21:53       ` Jonathan Cameron
  0 siblings, 1 reply; 22+ messages in thread
From: Andy Shevchenko @ 2020-01-13 13:58 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, lorenzo.bianconi83, denis.ciocca

On Mon, Dec 23, 2019 at 04:30:33PM +0000, Jonathan Cameron wrote:
> On Mon, 16 Dec 2019 19:38:53 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > Device property API allows to gather device resources from different sources,
> > such as ACPI. Convert the drivers to unleash the power of device property API.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Also looks fine, but will allow a bit more time for others to take a look.

Gentle ping.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 8/9] iio: st_sensors: Drop redundant parameter from st_sensors_of_name_probe()
  2020-01-13 13:58     ` Andy Shevchenko
@ 2020-01-13 21:52       ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2020-01-13 21:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Denis Ciocca, Lorenzo Bianconi

On Mon, 13 Jan 2020 15:58:10 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Mon, Dec 23, 2019 at 04:28:10PM +0000, Jonathan Cameron wrote:
> > On Mon, 16 Dec 2019 19:38:52 +0200
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >   
> > > Since we have access to the struct device_driver and thus to the ID table,
> > > there is no need to supply special parameters to st_sensors_of_name_probe().
> > > 
> > > Besides that we have a common API to get driver match data, there is
> > > no need to do matching separately for OF and ACPI.
> > > 
> > > Taking into consideration above, simplify the ST sensors code.
> > > 
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>  
> > This looks good to me, but its big enough that purely on that basis I'd
> > like to leave it a little longer to let Denis / Lorezo or someone else have time
> > to take a look.
> > 
> > If I seem to have lost it by the end of the first week in January, give
> > me a poke.  I may have drunk a few things before then ;)  
> 
> Gentle ping.
> 
Thanks.  Applied to the togreg branch of iio.git and pushed out as testing.

Jonathan


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

* Re: [PATCH v1 9/9] iio: st_sensors: Make use of device properties
  2020-01-13 13:58     ` Andy Shevchenko
@ 2020-01-13 21:53       ` Jonathan Cameron
  0 siblings, 0 replies; 22+ messages in thread
From: Jonathan Cameron @ 2020-01-13 21:53 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, lorenzo.bianconi83, denis.ciocca

On Mon, 13 Jan 2020 15:58:32 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Mon, Dec 23, 2019 at 04:30:33PM +0000, Jonathan Cameron wrote:
> > On Mon, 16 Dec 2019 19:38:53 +0200
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >   
> > > Device property API allows to gather device resources from different sources,
> > > such as ACPI. Convert the drivers to unleash the power of device property API.
> > > 
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>  
> > Also looks fine, but will allow a bit more time for others to take a look.  
> 
> Gentle ping.
> 

Applied.  Thanks for the reminder.

Jonathan

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

end of thread, other threads:[~2020-01-13 21:54 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-16 17:38 [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion Andy Shevchenko
2019-12-16 17:38 ` [PATCH v1 2/9] iio: accel: st_accel: Drop unnecessary #else branch for ACPI Andy Shevchenko
2019-12-23 16:17   ` Jonathan Cameron
2019-12-16 17:38 ` [PATCH v1 3/9] iio: pressure: st_press: " Andy Shevchenko
2019-12-23 16:19   ` Jonathan Cameron
2019-12-16 17:38 ` [PATCH v1 4/9] iio: gyro: st_gyro: Mark gyro_pdata with __maybe_unused Andy Shevchenko
2019-12-23 16:20   ` Jonathan Cameron
2019-12-16 17:38 ` [PATCH v1 5/9] iio: accel: st_accel: Mark default_accel_pdata " Andy Shevchenko
2019-12-23 16:20   ` Jonathan Cameron
2019-12-16 17:38 ` [PATCH v1 6/9] iio: pressure: st_press: Mark default_press_pdata " Andy Shevchenko
2019-12-23 16:21   ` Jonathan Cameron
2019-12-16 17:38 ` [PATCH v1 7/9] iio: st_sensors: Describe function parameters in kernel-doc Andy Shevchenko
2019-12-23 16:22   ` Jonathan Cameron
2019-12-16 17:38 ` [PATCH v1 8/9] iio: st_sensors: Drop redundant parameter from st_sensors_of_name_probe() Andy Shevchenko
2019-12-23 16:28   ` Jonathan Cameron
2020-01-13 13:58     ` Andy Shevchenko
2020-01-13 21:52       ` Jonathan Cameron
2019-12-16 17:38 ` [PATCH v1 9/9] iio: st_sensors: Make use of device properties Andy Shevchenko
2019-12-23 16:30   ` Jonathan Cameron
2020-01-13 13:58     ` Andy Shevchenko
2020-01-13 21:53       ` Jonathan Cameron
2019-12-23 16:15 ` [PATCH v1 1/9] iio: light: st_uvis25: Drop unneeded header inclusion 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).