Skip to contentSkip to conversation

IIO: Clean up ACPI_PTR() usage.

PATCH In review Jonathan Cameron 3 participants 31 messages Dec 31, 2023 – Jan 7, 2024

Subsystems (2)
lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

cover IIO: Clean up ACPI_PTR() usage.

From: Jonathan Cameron <[email protected]>

Many of these patches touch ancient drivers so the authors have long moved on to other things. As such I'd appreciate it if anyone has time to take a look!

The initial part of this series deals with cases where unused variable warnings are generated with !CONFIG_ACPI but they most date back long enough to predate this being reported by lkp in general and the lkp folk have gotten push back not to push out such reports due to the high level of noise. I think some of these were reported to me directly on my Huawei.com account but aren't on lore.kernel.org. If I can easily track down appropriate closes tags I will add them when applying.

The last few patches are for drivers that did have the right protections but where the usage was so trivial I'm not convinced they took the best approach. In the interests of not leaving cases of what I consider an undesirable pattern around for people to copy I have dropped the ACPI_PTR() usage and config guards from those as well.

There are 3 remaining cases of ACPI_PTR() in IIO. In each of those there is a significant chunk of ACPI specific handling so the relevant guards are there anyway and the complexity is more easily justified. I have not intent to touch those at this time.

Jonathan Cameron (24):
iio: accel: da280: Stop using ACPI_PTR()
iio: accel: kxcjk-1013: Move acpi_device_id table under ifdef
CONFIG_ACPI
iio: accel: mma9551: Drop ACPI_PTR() usage
iio: accel: mma9553: Drop ACPI_PTR() usage
iio: accel: mxc4005: Drop ACPI_PTR() usage
iio: accel: mxc6255: Drop ACPI_PTR() usage
iio: accel: stk8ba50: Drop ACPI_PTR() usage
iio: accel: bmc150: Drop ACPI_PTR()
iio: gyro: bmg160: Drop ACPI_PTR() usage
iio: humidity: hts221: Drop ACPI_PTR() usage
iio: imu: fxos8700: Drop ACPI_PTR() usage
iio: imu: kmx61: Drop ACPI_PTR() usage
iio: light: jsa1212: Drop ACPI_PTR() usage
iio: light: ltr501: Drop ACPI_PTR() usage
iio: light: rpr0521: Drop ACPI_PTR() usage
iio: light: stk3310: Drop ACPI_PTR() usage
iio: light: us5182d: Drop ACPI_PTR() usage
iio: magnetometer: bmc150: Drop ACPI_PTR() usage
iio: magnetometer: mmc35240: Drop ACPI_PTR() usage
iio: potentiometer: max5487: Drop ACPI_PTR() usage
iio: st_sensors: drop ACPI_PTR() and CONFIG_ACPI guards
iio: pressure: hp206c: drop ACPI_PTR() and CONFIG_ACPI guards
iio: light: max44000: drop ACPI_PTR() and CONFIG_ACPI guards
iio: adc: ti-adc109s102: drop ACPI_PTR() and CONFIG_ACPI guards

 drivers/iio/accel/bmc150-accel-i2c.c       |  2 +-
 drivers/iio/accel/bmc150-accel-spi.c       |  3 +-
 drivers/iio/accel/da280.c                  |  2 +-
 drivers/iio/accel/kxcjk-1013.c             | 33 +++++++++++-----------
 drivers/iio/accel/mma9551.c                |  4 +--
 drivers/iio/accel/mma9553.c                |  4 +--
 drivers/iio/accel/mxc4005.c                |  4 +--
 drivers/iio/accel/mxc6255.c                |  4 +--
 drivers/iio/accel/st_accel_i2c.c           |  5 +---
 drivers/iio/accel/stk8ba50.c               |  4 +--
 drivers/iio/adc/ti-adc108s102.c            |  4 +--
 drivers/iio/gyro/bmg160_i2c.c              |  4 +--
 drivers/iio/humidity/hts221_i2c.c          |  4 +--
 drivers/iio/imu/fxos8700_i2c.c             |  3 +-
 drivers/iio/imu/fxos8700_spi.c             |  3 +-
 drivers/iio/imu/kmx61.c                    |  2 +-
 drivers/iio/light/jsa1212.c                |  4 +--
 drivers/iio/light/ltr501.c                 |  3 +-
 drivers/iio/light/max44000.c               |  6 ++--
 drivers/iio/light/rpr0521.c                |  4 +--
 drivers/iio/light/stk3310.c                |  4 +--
 drivers/iio/light/us5182d.c                |  4 +--
 drivers/iio/magnetometer/bmc150_magn_i2c.c |  3 +-
 drivers/iio/magnetometer/bmc150_magn_spi.c |  3 +-
 drivers/iio/magnetometer/mmc35240.c        |  4 +--
 drivers/iio/potentiometer/max5487.c        |  4 +--
 drivers/iio/pressure/hp206c.c              |  6 ++--
 drivers/iio/pressure/st_pressure_i2c.c     |  5 +---
 28 files changed, 60 insertions(+), 75 deletions(-)
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 1/24 iio: accel: da280: Stop using ACPI_PTR()

From: Jonathan Cameron <[email protected]>

In general using ACPI_PTR() leads to more fragile code for a very minor saving in storage in the case of !CONFIG_ACPI so in IIO we prefer not to use it if the only ACPI specific code is the acpi_device_id table.

In this case will also suppress a unused variable warning.

---
 drivers/iio/accel/da280.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/da280.c +1 -1
index 572bfe9694b0..d792d2d20344 100644
@@ -186,7 +186,7 @@ MODULE_DEVICE_TABLE(i2c, da280_i2c_id);
 static struct i2c_driver da280_driver = {
 	.driver = {
 		.name = "da280",
-		.acpi_match_table = ACPI_PTR(da280_acpi_match),
+		.acpi_match_table = da280_acpi_match,
 		.pm = pm_sleep_ptr(&da280_pm_ops),
 	},
 	.probe		= da280_probe,
Signature · 1 line
2.43.0
Reviewed-by on v1 1/24
#2 lore raw

Re: [PATCH 01/24] iio: accel: da280: Stop using ACPI_PTR()

Hi,

Quoted 7 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

In general using ACPI_PTR() leads to more fragile code for a very minor saving in storage in the case of !CONFIG_ACPI so in IIO we prefer not to use it if the only ACPI specific code is the acpi_device_id table.

Quoted 6 lines

In this case will also suppress a unused variable warning.

Thanks, patch looks good to me:

Regards,

Hans

Quoted 17 lines
---
 drivers/iio/accel/da280.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/da280.c +1 -1
index 572bfe9694b0..d792d2d20344 100644
@@ -186,7 +186,7 @@ MODULE_DEVICE_TABLE(i2c, da280_i2c_id);
 static struct i2c_driver da280_driver = {
 	.driver = {
 		.name = "da280",
-		.acpi_match_table = ACPI_PTR(da280_acpi_match),
+		.acpi_match_table = da280_acpi_match,
 		.pm = pm_sleep_ptr(&da280_pm_ops),
 	},
 	.probe		= da280_probe,
author maintainer
#3 lore raw

PATCH 2/24 iio: accel: kxcjk-1013: Move acpi_device_id table under ifdef CONFIG_ACPI

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

This avoids a build warning due to the use of ACPI_PTR(). Given the driver already has APCI specific code under CONFIG_ACPI move the table rather than removing the ACPI_PTR() call as we already have the complexity of CONFIG_ACPI.

---
 drivers/iio/accel/kxcjk-1013.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)
drivers/iio/accel/kxcjk-1013.c +17 -16
index 894709286b0c..7f084f73da84 100644
@@ -422,6 +422,23 @@ static int kiox010a_dsm(struct device *dev, int fn_index)
 	ACPI_FREE(obj);
 	return 0;
 }
+
+static const struct acpi_device_id kx_acpi_match[] = {
+	{"KXCJ1013", KXCJK1013},
+	{"KXCJ1008", KXCJ91008},
+	{"KXCJ9000", KXCJ91008},
+	{"KIOX0008", KXCJ91008},
+	{"KIOX0009", KXTJ21009},
+	{"KIOX000A", KXCJ91008},
+	{"KIOX010A", KXCJ91008}, /* KXCJ91008 in the display of a yoga 2-in-1 */
+	{"KIOX020A", KXCJ91008}, /* KXCJ91008 in the base of a yoga 2-in-1 */
+	{"KXTJ1009", KXTJ21009},
+	{"KXJ2109",  KXTJ21009},
+	{"SMO8500",  KXCJ91008},
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, kx_acpi_match);
+
 #endif
 
 static int kxcjk1013_set_mode(struct kxcjk1013_data *data,
@@ -1687,22 +1704,6 @@ static const struct dev_pm_ops kxcjk1013_pm_ops = {
 			   kxcjk1013_runtime_resume, NULL)
 };
 
-static const struct acpi_device_id kx_acpi_match[] = {
-	{"KXCJ1013", KXCJK1013},
-	{"KXCJ1008", KXCJ91008},
-	{"KXCJ9000", KXCJ91008},
-	{"KIOX0008", KXCJ91008},
-	{"KIOX0009", KXTJ21009},
-	{"KIOX000A", KXCJ91008},
-	{"KIOX010A", KXCJ91008}, /* KXCJ91008 in the display of a yoga 2-in-1 */
-	{"KIOX020A", KXCJ91008}, /* KXCJ91008 in the base of a yoga 2-in-1 */
-	{"KXTJ1009", KXTJ21009},
-	{"KXJ2109",  KXTJ21009},
-	{"SMO8500",  KXCJ91008},
-	{ },
-};
-MODULE_DEVICE_TABLE(acpi, kx_acpi_match);
-
 static const struct i2c_device_id kxcjk1013_id[] = {
 	{"kxcjk1013", KXCJK1013},
 	{"kxcj91008", KXCJ91008},
Signature · 1 line
2.43.0
Reviewed-by on v1 2/24
#4 lore raw

Re: [PATCH 02/24] iio: accel: kxcjk-1013: Move acpi_device_id table under ifdef CONFIG_ACPI

Hi,

Quoted 9 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

This avoids a build warning due to the use of ACPI_PTR(). Given the driver already has APCI specific code under CONFIG_ACPI move the table rather than removing the ACPI_PTR() call as we already have the complexity of CONFIG_ACPI.

Thanks, patch looks good to me:

Regards,

Hans

Quoted 55 lines
---
 drivers/iio/accel/kxcjk-1013.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)
drivers/iio/accel/kxcjk-1013.c +17 -16
index 894709286b0c..7f084f73da84 100644
@@ -422,6 +422,23 @@ static int kiox010a_dsm(struct device *dev, int fn_index)
 	ACPI_FREE(obj);
 	return 0;
 }
+
+static const struct acpi_device_id kx_acpi_match[] = {
+	{"KXCJ1013", KXCJK1013},
+	{"KXCJ1008", KXCJ91008},
+	{"KXCJ9000", KXCJ91008},
+	{"KIOX0008", KXCJ91008},
+	{"KIOX0009", KXTJ21009},
+	{"KIOX000A", KXCJ91008},
+	{"KIOX010A", KXCJ91008}, /* KXCJ91008 in the display of a yoga 2-in-1 */
+	{"KIOX020A", KXCJ91008}, /* KXCJ91008 in the base of a yoga 2-in-1 */
+	{"KXTJ1009", KXTJ21009},
+	{"KXJ2109",  KXTJ21009},
+	{"SMO8500",  KXCJ91008},
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, kx_acpi_match);
+
 #endif
 
 static int kxcjk1013_set_mode(struct kxcjk1013_data *data,
@@ -1687,22 +1704,6 @@ static const struct dev_pm_ops kxcjk1013_pm_ops = {
 			   kxcjk1013_runtime_resume, NULL)
 };
 
-static const struct acpi_device_id kx_acpi_match[] = {
-	{"KXCJ1013", KXCJK1013},
-	{"KXCJ1008", KXCJ91008},
-	{"KXCJ9000", KXCJ91008},
-	{"KIOX0008", KXCJ91008},
-	{"KIOX0009", KXTJ21009},
-	{"KIOX000A", KXCJ91008},
-	{"KIOX010A", KXCJ91008}, /* KXCJ91008 in the display of a yoga 2-in-1 */
-	{"KIOX020A", KXCJ91008}, /* KXCJ91008 in the base of a yoga 2-in-1 */
-	{"KXTJ1009", KXTJ21009},
-	{"KXJ2109",  KXTJ21009},
-	{"SMO8500",  KXCJ91008},
-	{ },
-};
-MODULE_DEVICE_TABLE(acpi, kx_acpi_match);
-
 static const struct i2c_device_id kxcjk1013_id[] = {
 	{"kxcjk1013", KXCJK1013},
 	{"kxcj91008", KXCJ91008},
#5 lore raw

Re: [PATCH 02/24] iio: accel: kxcjk-1013: Move acpi_device_id table under ifdef CONFIG_ACPI

In reply to Jonathan Cameron
Quoted 7 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

This avoids a build warning due to the use of ACPI_PTR(). Given the driver already has APCI specific code under CONFIG_ACPI move the table rather than removing the ACPI_PTR() call as we already have the complexity of CONFIG_ACPI.

...

Quoted 4 lines
drivers/iio/accel/kxcjk-1013.c +4 -0
+static const struct acpi_device_id kx_acpi_match[] = {
+       {"KXCJ1013", KXCJK1013},
+       {"KXCJ1008", KXCJ91008},
+       {"KXCJ9000", KXCJ91008},

drivers/iio/accel/kxcjk-1013.c static int kiox010a_dsm(struct device *dev, int fn_index)

Quoted 10 lines
drivers/iio/accel/kxcjk-1013.c +9 -0
+       {"KIOX0008", KXCJ91008},
+       {"KIOX0009", KXTJ21009},
+       {"KIOX000A", KXCJ91008},
+       {"KIOX010A", KXCJ91008}, /* KXCJ91008 in the display of a yoga 2-in-1 */
+       {"KIOX020A", KXCJ91008}, /* KXCJ91008 in the base of a yoga 2-in-1 */
+       {"KXTJ1009", KXTJ21009},
+       {"KXJ2109",  KXTJ21009},
+       {"SMO8500",  KXCJ91008},
 
+       { },

Can you drop the comma, while at it?

Quoted 1 line

+};

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

PATCH 3/24 iio: accel: mma9551: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Whilst here tidy up a trivial bit of unusual indentation.

---
 drivers/iio/accel/mma9551.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/mma9551.c +2 -2
index d823f2edc6d4..083c08f65baf 100644
@@ -604,9 +604,9 @@ MODULE_DEVICE_TABLE(i2c, mma9551_id);
 static struct i2c_driver mma9551_driver = {
 	.driver = {
 		   .name = MMA9551_DRV_NAME,
-		   .acpi_match_table = ACPI_PTR(mma9551_acpi_match),
+		   .acpi_match_table = mma9551_acpi_match,
 		   .pm = pm_ptr(&mma9551_pm_ops),
-		   },
+	},
 	.probe = mma9551_probe,
 	.remove = mma9551_remove,
 	.id_table = mma9551_id,
Signature · 1 line
2.43.0
author maintainer
#7 lore raw

PATCH 4/24 iio: accel: mma9553: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Whilst here tidy up a trivial bit of unusual indentation.

---
 drivers/iio/accel/mma9553.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/mma9553.c +2 -2
index d01aba4aecba..3cbd0fd4e624 100644
@@ -1243,9 +1243,9 @@ MODULE_DEVICE_TABLE(i2c, mma9553_id);
 static struct i2c_driver mma9553_driver = {
 	.driver = {
 		   .name = MMA9553_DRV_NAME,
-		   .acpi_match_table = ACPI_PTR(mma9553_acpi_match),
+		   .acpi_match_table = mma9553_acpi_match,
 		   .pm = pm_ptr(&mma9553_pm_ops),
-		   },
+	},
 	.probe = mma9553_probe,
 	.remove = mma9553_remove,
 	.id_table = mma9553_id,
Signature · 1 line
2.43.0
author maintainer
#8 lore raw

PATCH 5/24 iio: accel: mxc4005: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Switch include to mod_devicetable.h as that contains the only acpi specific definitions needed in this driver.

---
 drivers/iio/accel/mxc4005.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/mxc4005.c +2 -2
index 82e8d0b39049..8118cc13614a 100644
@@ -8,7 +8,7 @@
 #include <linux/module.h>
 #include <linux/i2c.h>
 #include <linux/iio/iio.h>
-#include <linux/acpi.h>
+#include <linux/mod_devicetable.h>
 #include <linux/regmap.h>
 #include <linux/iio/sysfs.h>
 #include <linux/iio/trigger.h>
@@ -493,7 +493,7 @@ MODULE_DEVICE_TABLE(i2c, mxc4005_id);
 static struct i2c_driver mxc4005_driver = {
 	.driver = {
 		.name = MXC4005_DRV_NAME,
-		.acpi_match_table = ACPI_PTR(mxc4005_acpi_match),
+		.acpi_match_table = mxc4005_acpi_match,
 		.of_match_table = mxc4005_of_match,
 	},
 	.probe		= mxc4005_probe,
Signature · 1 line
2.43.0
#9 lore raw

Re: [PATCH 05/24] iio: accel: mxc4005: Drop ACPI_PTR() usage

Quoted 9 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Switch include to mod_devicetable.h as that contains the only acpi specific definitions needed in this driver.

ACPI

(and in other commit messages that repeat this text)

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

PATCH 6/24 iio: accel: mxc6255: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Switch include to mod_devicetable.h as that contains the only acpi specific definitions needed in this driver.

---
I can only find this one reported in a much larger build report (where it was noise) so no obvious closes tag to use.

---
 drivers/iio/accel/mxc6255.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/mxc6255.c +2 -2
index 33c2253561e6..ac228128c4f9 100644
@@ -12,7 +12,7 @@
 #include <linux/init.h>
 #include <linux/iio/iio.h>
 #include <linux/delay.h>
-#include <linux/acpi.h>
+#include <linux/mod_devicetable.h>
 #include <linux/regmap.h>
 #include <linux/iio/sysfs.h>
 
@@ -181,7 +181,7 @@ MODULE_DEVICE_TABLE(i2c, mxc6255_id);
 static struct i2c_driver mxc6255_driver = {
 	.driver = {
 		.name = MXC6255_DRV_NAME,
-		.acpi_match_table = ACPI_PTR(mxc6255_acpi_match),
+		.acpi_match_table = mxc6255_acpi_match,
 	},
 	.probe		= mxc6255_probe,
 	.id_table	= mxc6255_id,
Signature · 1 line
2.43.0
author maintainer
#11 lore raw

PATCH 7/24 iio: accel: stk8ba50: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Switch include to mod_devicetable.h as that contains the only acpi specific definitions needed in this driver.

---
 drivers/iio/accel/stk8ba50.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/stk8ba50.c +2 -2
index 3415ac1b4495..668edc88c89d 100644
@@ -7,11 +7,11 @@
  * STK8BA50 7-bit I2C address: 0x18.
  */
 
-#include <linux/acpi.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/iio/buffer.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -541,7 +541,7 @@ static struct i2c_driver stk8ba50_driver = {
 	.driver = {
 		.name = "stk8ba50",
 		.pm = pm_sleep_ptr(&stk8ba50_pm_ops),
-		.acpi_match_table = ACPI_PTR(stk8ba50_acpi_id),
+		.acpi_match_table = stk8ba50_acpi_id,
 	},
 	.probe =        stk8ba50_probe,
 	.remove =           stk8ba50_remove,
Signature · 1 line
2.43.0
author maintainer
#12 lore raw

PATCH 8/24 iio: accel: bmc150: Drop ACPI_PTR()

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

In general the complexity of avoiding maybe unused variable warnings is not worth dealing with for the small amount of data saved. In thie case, the i2c driver does include some other code under a CONFIG_ACPI guard but remove the ACPI_PTR() usage anyway to bring keep it inline with the spi driver.

Drop include of linux/acpi.h in the spi driver that doesn't need it as struct acpi_device_id is defined in mod_devicetable.h which is already included.

---
 drivers/iio/accel/bmc150-accel-i2c.c | 2 +-
 drivers/iio/accel/bmc150-accel-spi.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/iio/accel/bmc150-accel-i2c.c +1 -1
index ee1ba134ad42..f08594b372cf 100644
@@ -266,7 +266,7 @@ static struct i2c_driver bmc150_accel_driver = {
 	.driver = {
 		.name	= "bmc150_accel_i2c",
 		.of_match_table = bmc150_accel_of_match,
-		.acpi_match_table = ACPI_PTR(bmc150_accel_acpi_match),
+		.acpi_match_table = bmc150_accel_acpi_match,
 		.pm	= &bmc150_accel_pm_ops,
 	},
 	.probe		= bmc150_accel_probe,
drivers/iio/accel/bmc150-accel-spi.c +1 -2
index 921fb46be0b8..a6b9f599eb7b 100644
@@ -7,7 +7,6 @@
 #include <linux/device.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/acpi.h>
 #include <linux/regmap.h>
 #include <linux/spi/spi.h>
 
@@ -70,7 +69,7 @@ MODULE_DEVICE_TABLE(spi, bmc150_accel_id);
 static struct spi_driver bmc150_accel_driver = {
 	.driver = {
 		.name	= "bmc150_accel_spi",
-		.acpi_match_table = ACPI_PTR(bmc150_accel_acpi_match),
+		.acpi_match_table = bmc150_accel_acpi_match,
 		.pm	= &bmc150_accel_pm_ops,
 	},
 	.probe		= bmc150_accel_probe,
Signature · 1 line
2.43.0
author maintainer
#13 lore raw

PATCH 9/24 iio: gyro: bmg160: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Switch include to mod_devicetable.h as that contains the only acpi specific definitions needed in this driver.

---
 drivers/iio/gyro/bmg160_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/gyro/bmg160_i2c.c +2 -2
index 2f9675596138..9c8e20c25e96 100644
@@ -3,7 +3,7 @@
 #include <linux/regmap.h>
 #include <linux/iio/iio.h>
 #include <linux/module.h>
-#include <linux/acpi.h>
+#include <linux/mod_devicetable.h>
 
 #include "bmg160.h"
 
@@ -66,7 +66,7 @@ MODULE_DEVICE_TABLE(of, bmg160_of_match);
 static struct i2c_driver bmg160_i2c_driver = {
 	.driver = {
 		.name	= "bmg160_i2c",
-		.acpi_match_table = ACPI_PTR(bmg160_acpi_match),
+		.acpi_match_table = bmg160_acpi_match,
 		.of_match_table = bmg160_of_match,
 		.pm	= &bmg160_pm_ops,
 	},
Signature · 1 line
2.43.0
author maintainer
#14 lore raw

PATCH 10/24 iio: humidity: hts221: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Switch include to mod_devicetable.h as that contains the only ACPI specific definitions needed in this driver.

---
 drivers/iio/humidity/hts221_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/humidity/hts221_i2c.c +2 -2
index 30f2068ea156..5cb263e0ef5a 100644
@@ -9,7 +9,7 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/acpi.h>
+#include <linux/mod_devicetable.h>
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <linux/regmap.h>
@@ -63,7 +63,7 @@ static struct i2c_driver hts221_driver = {
 		.name = "hts221_i2c",
 		.pm = pm_sleep_ptr(&hts221_pm_ops),
 		.of_match_table = hts221_i2c_of_match,
-		.acpi_match_table = ACPI_PTR(hts221_acpi_match),
+		.acpi_match_table = hts221_acpi_match,
 	},
 	.probe = hts221_i2c_probe,
 	.id_table = hts221_i2c_id_table,
Signature · 1 line
2.43.0
author maintainer
#15 lore raw

PATCH 11/24 iio: imu: fxos8700: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Drop unused acpi.h include.

---
 drivers/iio/imu/fxos8700_i2c.c | 3 +--
 drivers/iio/imu/fxos8700_spi.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/iio/imu/fxos8700_i2c.c +1 -2
index 2ace306d0f9a..e99677ad96a2 100644
@@ -10,7 +10,6 @@
  *      1    |  0    |  0x1C
  *      1    |  1    |  0x1F
  */
-#include <linux/acpi.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
@@ -57,7 +56,7 @@ MODULE_DEVICE_TABLE(of, fxos8700_of_match);
 static struct i2c_driver fxos8700_i2c_driver = {
 	.driver = {
 		.name                   = "fxos8700_i2c",
-		.acpi_match_table       = ACPI_PTR(fxos8700_acpi_match),
+		.acpi_match_table       = fxos8700_acpi_match,
 		.of_match_table         = fxos8700_of_match,
 	},
 	.probe          = fxos8700_i2c_probe,
drivers/iio/imu/fxos8700_spi.c +1 -2
index 27e694cce173..6b0dc7a776b9 100644
@@ -2,7 +2,6 @@
 /*
  * FXOS8700 - NXP IMU, SPI bits
  */
-#include <linux/acpi.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
 #include <linux/regmap.h>
@@ -46,7 +45,7 @@ static struct spi_driver fxos8700_spi_driver = {
 	.probe          = fxos8700_spi_probe,
 	.id_table       = fxos8700_spi_id,
 	.driver = {
-		.acpi_match_table       = ACPI_PTR(fxos8700_acpi_match),
+		.acpi_match_table       = fxos8700_acpi_match,
 		.of_match_table         = fxos8700_of_match,
 		.name                   = "fxos8700_spi",
 	},
Signature · 1 line
2.43.0
author maintainer
#16 lore raw

PATCH 12/24 iio: imu: kmx61: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

---
 drivers/iio/imu/kmx61.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/kmx61.c +1 -1
index 958167b31241..7d3e061f3046 100644
@@ -1514,7 +1514,7 @@ MODULE_DEVICE_TABLE(i2c, kmx61_id);
 static struct i2c_driver kmx61_driver = {
 	.driver = {
 		.name = KMX61_DRV_NAME,
-		.acpi_match_table = ACPI_PTR(kmx61_acpi_match),
+		.acpi_match_table = kmx61_acpi_match,
 		.pm = pm_ptr(&kmx61_pm_ops),
 	},
 	.probe		= kmx61_probe,
Signature · 1 line
2.43.0
author maintainer
#17 lore raw

PATCH 13/24 iio: light: jsa1212: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Switch include from acpi.h to mod_devicetable.h which includes the definition of struct acpi_device_id.

---
 drivers/iio/light/jsa1212.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/light/jsa1212.c +2 -2
index 37e2807041a1..869196746045 100644
@@ -12,10 +12,10 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/delay.h>
 #include <linux/i2c.h>
 #include <linux/mutex.h>
-#include <linux/acpi.h>
 #include <linux/regmap.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -438,7 +438,7 @@ static struct i2c_driver jsa1212_driver = {
 	.driver = {
 		.name	= JSA1212_DRIVER_NAME,
 		.pm	= pm_sleep_ptr(&jsa1212_pm_ops),
-		.acpi_match_table = ACPI_PTR(jsa1212_acpi_match),
+		.acpi_match_table = jsa1212_acpi_match,
 	},
 	.probe		= jsa1212_probe,
 	.remove		= jsa1212_remove,
Signature · 1 line
2.43.0
author maintainer
#18 lore raw

PATCH 14/24 iio: light: ltr501: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Include linux/mod_devicetable.h which includes the definition of struct acpi_device_id (hence somewhat related to the main change)

---
 drivers/iio/light/ltr501.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/light/ltr501.c +2 -1
index 061c122fdc5e..8c516ede9116 100644
@@ -10,6 +10,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/i2c.h>
 #include <linux/err.h>
 #include <linux/delay.h>
@@ -1639,7 +1640,7 @@ static struct i2c_driver ltr501_driver = {
 		.name   = LTR501_DRV_NAME,
 		.of_match_table = ltr501_of_match,
 		.pm	= pm_sleep_ptr(&ltr501_pm_ops),
-		.acpi_match_table = ACPI_PTR(ltr_acpi_match),
+		.acpi_match_table = ltr_acpi_match,
 	},
 	.probe = ltr501_probe,
 	.remove	= ltr501_remove,
Signature · 1 line
2.43.0
author maintainer
#19 lore raw

PATCH 15/24 iio: light: rpr0521: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Switch include from acpi.h to mod_devicetable.h which includes the definition of struct acpi_device_id.

---
 drivers/iio/light/rpr0521.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/light/rpr0521.c +2 -2
index bbb8581622f2..40d5732b5e32 100644
@@ -10,11 +10,11 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/regmap.h>
 #include <linux/delay.h>
-#include <linux/acpi.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
@@ -1119,7 +1119,7 @@ static struct i2c_driver rpr0521_driver = {
 	.driver = {
 		.name	= RPR0521_DRV_NAME,
 		.pm	= pm_ptr(&rpr0521_pm_ops),
-		.acpi_match_table = ACPI_PTR(rpr0521_acpi_match),
+		.acpi_match_table = rpr0521_acpi_match,
 	},
 	.probe		= rpr0521_probe,
 	.remove		= rpr0521_remove,
Signature · 1 line
2.43.0
author maintainer
#20 lore raw

PATCH 16/24 iio: light: stk3310: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Switch include from acpi.h to mod_devicetable.h which includes the definition of struct acpi_device_id.

---
The report I can immediately find is in a much larger set of unrelated errors hence no closes tag.

---
 drivers/iio/light/stk3310.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/light/stk3310.c +2 -2
index 72b08d870d33..7b71ad71d78d 100644
@@ -7,11 +7,11 @@
  * IIO driver for STK3310/STK3311. 7-bit I2C address: 0x48.
  */
 
-#include <linux/acpi.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/regmap.h>
 #include <linux/iio/events.h>
 #include <linux/iio/iio.h>
@@ -712,7 +712,7 @@ static struct i2c_driver stk3310_driver = {
 		.name = "stk3310",
 		.of_match_table = stk3310_of_match,
 		.pm = pm_sleep_ptr(&stk3310_pm_ops),
-		.acpi_match_table = ACPI_PTR(stk3310_acpi_id),
+		.acpi_match_table = stk3310_acpi_id,
 	},
 	.probe =        stk3310_probe,
 	.remove =           stk3310_remove,
Signature · 1 line
2.43.0
author maintainer
#21 lore raw

PATCH 17/24 iio: light: us5182d: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Switch include from acpi.h to mod_devicetable.h which includes the definition of struct acpi_device_id.

---
 drivers/iio/light/us5182d.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/light/us5182d.c +2 -2
index 61b3b2aea626..9189a1d4d7e1 100644
@@ -9,7 +9,7 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/acpi.h>
+#include <linux/mod_devicetable.h>
 #include <linux/delay.h>
 #include <linux/i2c.h>
 #include <linux/iio/events.h>
@@ -972,7 +972,7 @@ static struct i2c_driver us5182d_driver = {
 		.name = US5182D_DRV_NAME,
 		.pm = pm_ptr(&us5182d_pm_ops),
 		.of_match_table = us5182d_of_match,
-		.acpi_match_table = ACPI_PTR(us5182d_acpi_match),
+		.acpi_match_table = us5182d_acpi_match,
 	},
 	.probe = us5182d_probe,
 	.remove = us5182d_remove,
Signature · 1 line
2.43.0
author maintainer
#22 lore raw

PATCH 18/24 iio: magnetometer: bmc150: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Drop unused linux/acpi.h includes.

---
 drivers/iio/magnetometer/bmc150_magn_i2c.c | 3 +--
 drivers/iio/magnetometer/bmc150_magn_spi.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/iio/magnetometer/bmc150_magn_i2c.c +1 -2
index 281d1fa31c8e..48d9c698f520 100644
@@ -11,7 +11,6 @@
 #include <linux/mod_devicetable.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
-#include <linux/acpi.h>
 #include <linux/regmap.h>
 
 #include "bmc150_magn.h"
@@ -68,7 +67,7 @@ static struct i2c_driver bmc150_magn_driver = {
 	.driver = {
 		.name	= "bmc150_magn_i2c",
 		.of_match_table = bmc150_magn_of_match,
-		.acpi_match_table = ACPI_PTR(bmc150_magn_acpi_match),
+		.acpi_match_table = bmc150_magn_acpi_match,
 		.pm	= &bmc150_magn_pm_ops,
 	},
 	.probe		= bmc150_magn_i2c_probe,
drivers/iio/magnetometer/bmc150_magn_spi.c +1 -2
index 882987721071..abc75a05c46a 100644
@@ -10,7 +10,6 @@
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
-#include <linux/acpi.h>
 #include <linux/regmap.h>
 
 #include "bmc150_magn.h"
@@ -55,7 +54,7 @@ static struct spi_driver bmc150_magn_spi_driver = {
 	.remove		= bmc150_magn_spi_remove,
 	.id_table	= bmc150_magn_spi_id,
 	.driver = {
-		.acpi_match_table = ACPI_PTR(bmc150_magn_acpi_match),
+		.acpi_match_table = bmc150_magn_acpi_match,
 		.name	= "bmc150_magn_spi",
 	},
 };
Signature · 1 line
2.43.0
author maintainer
#23 lore raw

PATCH 19/24 iio: magnetometer: mmc35240: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Switch include from acpi.h to mod_devicetable.h which includes the definition of struct acpi_device_id.

---
 drivers/iio/magnetometer/mmc35240.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/magnetometer/mmc35240.c +2 -2
index b495b8a63928..6b9f4b056191 100644
@@ -10,11 +10,11 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/delay.h>
 #include <linux/regmap.h>
-#include <linux/acpi.h>
 #include <linux/pm.h>
 
 #include <linux/iio/iio.h>
@@ -573,7 +573,7 @@ static struct i2c_driver mmc35240_driver = {
 		.name = MMC35240_DRV_NAME,
 		.of_match_table = mmc35240_of_match,
 		.pm = pm_sleep_ptr(&mmc35240_pm_ops),
-		.acpi_match_table = ACPI_PTR(mmc35240_acpi_match),
+		.acpi_match_table = mmc35240_acpi_match,
 	},
 	.probe		= mmc35240_probe,
 	.id_table	= mmc35240_id,
Signature · 1 line
2.43.0
author maintainer
#24 lore raw

PATCH 20/24 iio: potentiometer: max5487: Drop ACPI_PTR() usage

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Avoiding unused variable warnings when using this macro adds complexity that in simple cases like this one is not justified for the small saving in data.

Switch include from acpi.h to mod_devicetable.h which includes the definition of struct acpi_device_id.

---

I can't find a specific listing for this one so no closes tag.

---
 drivers/iio/potentiometer/max5487.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/potentiometer/max5487.c +2 -2
index 42723c996c9f..4838d2e72f53 100644
@@ -5,8 +5,8 @@
  * Copyright (C) 2016 Cristina-Gabriela Moraru <[email protected]>
  */
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
-#include <linux/acpi.h>
 
 #include <linux/iio/sysfs.h>
 #include <linux/iio/iio.h>
@@ -144,7 +144,7 @@ MODULE_DEVICE_TABLE(acpi, max5487_acpi_match);
 static struct spi_driver max5487_driver = {
 	.driver = {
 		.name = "max5487",
-		.acpi_match_table = ACPI_PTR(max5487_acpi_match),
+		.acpi_match_table = max5487_acpi_match,
 	},
 	.id_table = max5487_id,
 	.probe = max5487_spi_probe,
Signature · 1 line
2.43.0
author maintainer
#25 lore raw

PATCH 21/24 iio: st_sensors: drop ACPI_PTR() and CONFIG_ACPI guards

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

The complexity of config guards needed for ACPI_PTR() is not worthwhile for the small amount of saved data. This example was doing it correctly but I am proposing dropping this so as to reduce chance of cut and paste where it is done wrong. Also drop now unneeded linux/acpi.h include.

Cc Linus Walleij <[email protected]>
Cc Denis CIOCCA <[email protected]>
---
 drivers/iio/accel/st_accel_i2c.c       | 5 +----
 drivers/iio/pressure/st_pressure_i2c.c | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)
drivers/iio/accel/st_accel_i2c.c +1 -4
index 71ee861b2980..fd3749871121 100644
@@ -10,7 +10,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
-#include <linux/acpi.h>
 #include <linux/i2c.h>
 #include <linux/iio/iio.h>
 
@@ -127,14 +126,12 @@ static const struct of_device_id st_accel_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
 
-#ifdef CONFIG_ACPI
 static const struct acpi_device_id st_accel_acpi_match[] = {
 	{"SMO8840", (kernel_ulong_t)LIS2DH12_ACCEL_DEV_NAME},
 	{"SMO8A90", (kernel_ulong_t)LNG2DM_ACCEL_DEV_NAME},
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, st_accel_acpi_match);
-#endif
 
 static const struct i2c_device_id st_accel_id_table[] = {
 	{ LSM303DLH_ACCEL_DEV_NAME },
@@ -204,7 +201,7 @@ static struct i2c_driver st_accel_driver = {
 	.driver = {
 		.name = "st-accel-i2c",
 		.of_match_table = st_accel_of_match,
-		.acpi_match_table = ACPI_PTR(st_accel_acpi_match),
+		.acpi_match_table = st_accel_acpi_match,
 	},
 	.probe = st_accel_i2c_probe,
 	.id_table = st_accel_id_table,
drivers/iio/pressure/st_pressure_i2c.c +1 -4
index 5101552e3f38..389523d6ae32 100644
@@ -7,7 +7,6 @@
  * Denis Ciocca <[email protected]>
  */
 
-#include <linux/acpi.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
@@ -55,13 +54,11 @@ static const struct of_device_id st_press_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, st_press_of_match);
 
-#ifdef CONFIG_ACPI
 static const struct acpi_device_id st_press_acpi_match[] = {
 	{"SNO9210", LPS22HB},
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, st_press_acpi_match);
-#endif
 
 static const struct i2c_device_id st_press_id_table[] = {
 	{ LPS001WP_PRESS_DEV_NAME, LPS001WP },
@@ -114,7 +111,7 @@ static struct i2c_driver st_press_driver = {
 	.driver = {
 		.name = "st-press-i2c",
 		.of_match_table = st_press_of_match,
-		.acpi_match_table = ACPI_PTR(st_press_acpi_match),
+		.acpi_match_table = st_press_acpi_match,
 	},
 	.probe = st_press_i2c_probe,
 	.id_table = st_press_id_table,
Signature · 1 line
2.43.0
author maintainer
#26 lore raw

PATCH 22/24 iio: pressure: hp206c: drop ACPI_PTR() and CONFIG_ACPI guards

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

The complexity of config guards needed for ACPI_PTR() is not worthwhile for the small amount of saved data. This example was doing it correctly but I am proposing dropping this so as to reduce chance of cut and paste where it is done wrong. Also drop now unneeded linux/acpi.h include and added linux/mod_devicetable.h for struct acpi_device_id definition.

---
 drivers/iio/pressure/hp206c.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/pressure/hp206c.c +2 -4
index a072de6cb59c..261af1562827 100644
@@ -11,12 +11,12 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/i2c.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 #include <linux/delay.h>
 #include <linux/util_macros.h>
-#include <linux/acpi.h>
 
 #include <asm/unaligned.h>
 
@@ -400,20 +400,18 @@ static const struct i2c_device_id hp206c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, hp206c_id);
 
-#ifdef CONFIG_ACPI
 static const struct acpi_device_id hp206c_acpi_match[] = {
 	{"HOP206C", 0},
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, hp206c_acpi_match);
-#endif
 
 static struct i2c_driver hp206c_driver = {
 	.probe = hp206c_probe,
 	.id_table = hp206c_id,
 	.driver = {
 		.name = "hp206c",
-		.acpi_match_table = ACPI_PTR(hp206c_acpi_match),
+		.acpi_match_table = hp206c_acpi_match,
 	},
 };
 
Signature · 1 line
2.43.0
author maintainer
#27 lore raw

PATCH 23/24 iio: light: max44000: drop ACPI_PTR() and CONFIG_ACPI guards

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

The complexity of config guards needed for ACPI_PTR() is not worthwhile for the small amount of saved data. This example was doing it correctly but I am proposing dropping this so as to reduce chance of cut and paste where it is done wrong. Also drop now unneeded linux/acpi.h include and added linux/mod_devicetable.h for struct acpi_device_id definition.

---
 drivers/iio/light/max44000.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/light/max44000.c +2 -4
index db96c5b73100..26b464b1b650 100644
@@ -10,6 +10,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/regmap.h>
@@ -19,7 +20,6 @@
 #include <linux/iio/buffer.h>
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
-#include <linux/acpi.h>
 
 #define MAX44000_DRV_NAME		"max44000"
 
@@ -603,18 +603,16 @@ static const struct i2c_device_id max44000_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, max44000_id);
 
-#ifdef CONFIG_ACPI
 static const struct acpi_device_id max44000_acpi_match[] = {
 	{"MAX44000", 0},
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, max44000_acpi_match);
-#endif
 
 static struct i2c_driver max44000_driver = {
 	.driver = {
 		.name	= MAX44000_DRV_NAME,
-		.acpi_match_table = ACPI_PTR(max44000_acpi_match),
+		.acpi_match_table = max44000_acpi_match,
 	},
 	.probe		= max44000_probe,
 	.id_table	= max44000_id,
Signature · 1 line
2.43.0
author maintainer
#28 lore raw

PATCH 24/24 iio: adc: ti-adc109s102: drop ACPI_PTR() and CONFIG_ACPI guards

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

The complexity of config guards needed for ACPI_PTR() is not worthwhile for the small amount of saved data. This example was doing it correctly but I am proposing dropping this so as to reduce chance of cut and paste where it is done wrong.

---
 drivers/iio/adc/ti-adc108s102.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iio/adc/ti-adc108s102.c +1 -3
index c82a161630e1..69fcbbc7e418 100644
@@ -293,13 +293,11 @@ static const struct of_device_id adc108s102_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, adc108s102_of_match);
 
-#ifdef CONFIG_ACPI
 static const struct acpi_device_id adc108s102_acpi_ids[] = {
 	{ "INT3495", 0 },
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, adc108s102_acpi_ids);
-#endif
 
 static const struct spi_device_id adc108s102_id[] = {
 	{ "adc108s102", 0 },
@@ -311,7 +309,7 @@ static struct spi_driver adc108s102_driver = {
 	.driver = {
 		.name   = "adc108s102",
 		.of_match_table = adc108s102_of_match,
-		.acpi_match_table = ACPI_PTR(adc108s102_acpi_ids),
+		.acpi_match_table = adc108s102_acpi_ids,
 	},
 	.probe		= adc108s102_probe,
 	.id_table	= adc108s102_id,
Signature · 1 line
2.43.0
Reviewed-by on the v1 series
#29 lore raw
In reply to Jonathan Cameron
Quoted 21 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Many of these patches touch ancient drivers so the authors have long moved on to other things. As such I'd appreciate it if anyone has time to take a look!

The initial part of this series deals with cases where unused variable warnings are generated with !CONFIG_ACPI but they most date back long enough to predate this being reported by lkp in general and the lkp folk have gotten push back not to push out such reports due to the high level of noise. I think some of these were reported to me directly on my Huawei.com account but aren't on lore.kernel.org. If I can easily track down appropriate closes tags I will add them when applying.

The last few patches are for drivers that did have the right protections but where the usage was so trivial I'm not convinced they took the best approach. In the interests of not leaving cases of what I consider an undesirable pattern around for people to copy I have dropped the ACPI_PTR() usage and config guards from those as well.

Quoted 4 lines

There are 3 remaining cases of ACPI_PTR() in IIO. In each of those there is a significant chunk of ACPI specific handling so the relevant guards are there anyway and the complexity is more easily justified. I have not intent to touch those at this time.

Long awaited series, thanks for doing it!

(with some individual nit-picks that you may fix whilst applying)

Side note: We now have: array_size.h, container_of.h, hex.h, kstrtox.h, sprintf.h.
You may start considering replacing "proxy" headers such as kernel.h in the code.

Quoted 60 lines

Jonathan Cameron (24):
iio: accel: da280: Stop using ACPI_PTR()
iio: accel: kxcjk-1013: Move acpi_device_id table under ifdef
CONFIG_ACPI
iio: accel: mma9551: Drop ACPI_PTR() usage
iio: accel: mma9553: Drop ACPI_PTR() usage
iio: accel: mxc4005: Drop ACPI_PTR() usage
iio: accel: mxc6255: Drop ACPI_PTR() usage
iio: accel: stk8ba50: Drop ACPI_PTR() usage
iio: accel: bmc150: Drop ACPI_PTR()
iio: gyro: bmg160: Drop ACPI_PTR() usage
iio: humidity: hts221: Drop ACPI_PTR() usage
iio: imu: fxos8700: Drop ACPI_PTR() usage
iio: imu: kmx61: Drop ACPI_PTR() usage
iio: light: jsa1212: Drop ACPI_PTR() usage
iio: light: ltr501: Drop ACPI_PTR() usage
iio: light: rpr0521: Drop ACPI_PTR() usage
iio: light: stk3310: Drop ACPI_PTR() usage
iio: light: us5182d: Drop ACPI_PTR() usage
iio: magnetometer: bmc150: Drop ACPI_PTR() usage
iio: magnetometer: mmc35240: Drop ACPI_PTR() usage
iio: potentiometer: max5487: Drop ACPI_PTR() usage
iio: st_sensors: drop ACPI_PTR() and CONFIG_ACPI guards
iio: pressure: hp206c: drop ACPI_PTR() and CONFIG_ACPI guards
iio: light: max44000: drop ACPI_PTR() and CONFIG_ACPI guards
iio: adc: ti-adc109s102: drop ACPI_PTR() and CONFIG_ACPI guards

 drivers/iio/accel/bmc150-accel-i2c.c       |  2 +-
 drivers/iio/accel/bmc150-accel-spi.c       |  3 +-
 drivers/iio/accel/da280.c                  |  2 +-
 drivers/iio/accel/kxcjk-1013.c             | 33 +++++++++++-----------
 drivers/iio/accel/mma9551.c                |  4 +--
 drivers/iio/accel/mma9553.c                |  4 +--
 drivers/iio/accel/mxc4005.c                |  4 +--
 drivers/iio/accel/mxc6255.c                |  4 +--
 drivers/iio/accel/st_accel_i2c.c           |  5 +---
 drivers/iio/accel/stk8ba50.c               |  4 +--
 drivers/iio/adc/ti-adc108s102.c            |  4 +--
 drivers/iio/gyro/bmg160_i2c.c              |  4 +--
 drivers/iio/humidity/hts221_i2c.c          |  4 +--
 drivers/iio/imu/fxos8700_i2c.c             |  3 +-
 drivers/iio/imu/fxos8700_spi.c             |  3 +-
 drivers/iio/imu/kmx61.c                    |  2 +-
 drivers/iio/light/jsa1212.c                |  4 +--
 drivers/iio/light/ltr501.c                 |  3 +-
 drivers/iio/light/max44000.c               |  6 ++--
 drivers/iio/light/rpr0521.c                |  4 +--
 drivers/iio/light/stk3310.c                |  4 +--
 drivers/iio/light/us5182d.c                |  4 +--
 drivers/iio/magnetometer/bmc150_magn_i2c.c |  3 +-
 drivers/iio/magnetometer/bmc150_magn_spi.c |  3 +-
 drivers/iio/magnetometer/mmc35240.c        |  4 +--
 drivers/iio/potentiometer/max5487.c        |  4 +--
 drivers/iio/pressure/hp206c.c              |  6 ++--
 drivers/iio/pressure/st_pressure_i2c.c     |  5 +---
 28 files changed, 60 insertions(+), 75 deletions(-)

--
2.43.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#30 lore raw
Quoted 22 lines · On Tue, 2 Jan 2024 01:48:07 +0200 Andy Shevchenko <[email protected]>…
Quoted 21 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Many of these patches touch ancient drivers so the authors have long moved on to other things. As such I'd appreciate it if anyone has time to take a look!

The initial part of this series deals with cases where unused variable warnings are generated with !CONFIG_ACPI but they most date back long enough to predate this being reported by lkp in general and the lkp folk have gotten push back not to push out such reports due to the high level of noise. I think some of these were reported to me directly on my Huawei.com account but aren't on lore.kernel.org. If I can easily track down appropriate closes tags I will add them when applying.

The last few patches are for drivers that did have the right protections but where the usage was so trivial I'm not convinced they took the best approach. In the interests of not leaving cases of what I consider an undesirable pattern around for people to copy I have dropped the ACPI_PTR() usage and config guards from those as well.

Quoted 8 lines
Quoted 4 lines

There are 3 remaining cases of ACPI_PTR() in IIO. In each of those there is a significant chunk of ACPI specific handling so the relevant guards are there anyway and the complexity is more easily justified. I have not intent to touch those at this time.

Long awaited series, thanks for doing it!

(with some individual nit-picks that you may fix whilst applying)

Thanks. Mostly so I can forget about this series, I've made the tweaks and applied the lot to the togreg branch of iio.git which will get rebased on rc1 in a few weeks time. Happy to add more tags etc or indeed drop any problematic patches if I get any more feedback in the meantime!

Quoted 5 lines

Side note: We now have: array_size.h, container_of.h, hex.h, kstrtox.h, sprintf.h.
You may start considering replacing "proxy" headers such as kernel.h in the code.

Hmm. That's more of a nice to have than this set where it's about getting 0-day to stop pestering me :)

Worth doing at some point though, perhaps as part of more substantial driver clean ups.

Thanks,

Jonathan

Quoted 63 lines
Quoted 61 lines

Jonathan Cameron (24):
iio: accel: da280: Stop using ACPI_PTR()
iio: accel: kxcjk-1013: Move acpi_device_id table under ifdef
CONFIG_ACPI
iio: accel: mma9551: Drop ACPI_PTR() usage
iio: accel: mma9553: Drop ACPI_PTR() usage
iio: accel: mxc4005: Drop ACPI_PTR() usage
iio: accel: mxc6255: Drop ACPI_PTR() usage
iio: accel: stk8ba50: Drop ACPI_PTR() usage
iio: accel: bmc150: Drop ACPI_PTR()
iio: gyro: bmg160: Drop ACPI_PTR() usage
iio: humidity: hts221: Drop ACPI_PTR() usage
iio: imu: fxos8700: Drop ACPI_PTR() usage
iio: imu: kmx61: Drop ACPI_PTR() usage
iio: light: jsa1212: Drop ACPI_PTR() usage
iio: light: ltr501: Drop ACPI_PTR() usage
iio: light: rpr0521: Drop ACPI_PTR() usage
iio: light: stk3310: Drop ACPI_PTR() usage
iio: light: us5182d: Drop ACPI_PTR() usage
iio: magnetometer: bmc150: Drop ACPI_PTR() usage
iio: magnetometer: mmc35240: Drop ACPI_PTR() usage
iio: potentiometer: max5487: Drop ACPI_PTR() usage
iio: st_sensors: drop ACPI_PTR() and CONFIG_ACPI guards
iio: pressure: hp206c: drop ACPI_PTR() and CONFIG_ACPI guards
iio: light: max44000: drop ACPI_PTR() and CONFIG_ACPI guards
iio: adc: ti-adc109s102: drop ACPI_PTR() and CONFIG_ACPI guards

 drivers/iio/accel/bmc150-accel-i2c.c       |  2 +-
 drivers/iio/accel/bmc150-accel-spi.c       |  3 +-
 drivers/iio/accel/da280.c                  |  2 +-
 drivers/iio/accel/kxcjk-1013.c             | 33 +++++++++++-----------
 drivers/iio/accel/mma9551.c                |  4 +--
 drivers/iio/accel/mma9553.c                |  4 +--
 drivers/iio/accel/mxc4005.c                |  4 +--
 drivers/iio/accel/mxc6255.c                |  4 +--
 drivers/iio/accel/st_accel_i2c.c           |  5 +---
 drivers/iio/accel/stk8ba50.c               |  4 +--
 drivers/iio/adc/ti-adc108s102.c            |  4 +--
 drivers/iio/gyro/bmg160_i2c.c              |  4 +--
 drivers/iio/humidity/hts221_i2c.c          |  4 +--
 drivers/iio/imu/fxos8700_i2c.c             |  3 +-
 drivers/iio/imu/fxos8700_spi.c             |  3 +-
 drivers/iio/imu/kmx61.c                    |  2 +-
 drivers/iio/light/jsa1212.c                |  4 +--
 drivers/iio/light/ltr501.c                 |  3 +-
 drivers/iio/light/max44000.c               |  6 ++--
 drivers/iio/light/rpr0521.c                |  4 +--
 drivers/iio/light/stk3310.c                |  4 +--
 drivers/iio/light/us5182d.c                |  4 +--
 drivers/iio/magnetometer/bmc150_magn_i2c.c |  3 +-
 drivers/iio/magnetometer/bmc150_magn_spi.c |  3 +-
 drivers/iio/magnetometer/mmc35240.c        |  4 +--
 drivers/iio/potentiometer/max5487.c        |  4 +--
 drivers/iio/pressure/hp206c.c              |  6 ++--
 drivers/iio/pressure/st_pressure_i2c.c     |  5 +---
 28 files changed, 60 insertions(+), 75 deletions(-)

--
2.43.0