Linux IIO development
 help / color / mirror / Atom feed
* [PATCH v1 1/1] iio: accel: mma7660: Drop wrong use of ACPI_PTR()
@ 2022-06-16 14:24 Andy Shevchenko
  2022-06-18 15:34 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2022-06-16 14:24 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, linux-kernel
  Cc: Jonathan Cameron, Lars-Peter Clausen, Andy Shevchenko

ACPI_PTR() is more harmful than helpful. For example, in this case
if CONFIG_ACPI=n, the ID table left unused which is not what we want.

Instead of making linker to drop a section, drop ACPI_PTR().

As a side effect this makes driver ACPI and OF clean.

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

diff --git a/drivers/iio/accel/mma7660.c b/drivers/iio/accel/mma7660.c
index 112a5a33c29f..794f2f383303 100644
--- a/drivers/iio/accel/mma7660.c
+++ b/drivers/iio/accel/mma7660.c
@@ -7,8 +7,8 @@
  * IIO driver for Freescale MMA7660FC; 7-bit I2C address: 0x4c.
  */
 
-#include <linux/acpi.h>
 #include <linux/i2c.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -255,7 +255,7 @@ static const struct of_device_id mma7660_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, mma7660_of_match);
 
-static const struct acpi_device_id __maybe_unused mma7660_acpi_id[] = {
+static const struct acpi_device_id mma7660_acpi_id[] = {
 	{"MMA7660", 0},
 	{}
 };
@@ -267,7 +267,7 @@ static struct i2c_driver mma7660_driver = {
 		.name = "mma7660",
 		.pm = pm_sleep_ptr(&mma7660_pm_ops),
 		.of_match_table = mma7660_of_match,
-		.acpi_match_table = ACPI_PTR(mma7660_acpi_id),
+		.acpi_match_table = mma7660_acpi_id,
 	},
 	.probe		= mma7660_probe,
 	.remove		= mma7660_remove,
-- 
2.35.1


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

* Re: [PATCH v1 1/1] iio: accel: mma7660: Drop wrong use of ACPI_PTR()
  2022-06-16 14:24 [PATCH v1 1/1] iio: accel: mma7660: Drop wrong use of ACPI_PTR() Andy Shevchenko
@ 2022-06-18 15:34 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2022-06-18 15:34 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Jonathan Cameron, linux-iio, linux-kernel, Lars-Peter Clausen

On Thu, 16 Jun 2022 17:24:51 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> ACPI_PTR() is more harmful than helpful. For example, in this case
> if CONFIG_ACPI=n, the ID table left unused which is not what we want.
> 
> Instead of making linker to drop a section, drop ACPI_PTR().
> 
> As a side effect this makes driver ACPI and OF clean.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied.

Thanks,

Jonathan

> ---
>  drivers/iio/accel/mma7660.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/accel/mma7660.c b/drivers/iio/accel/mma7660.c
> index 112a5a33c29f..794f2f383303 100644
> --- a/drivers/iio/accel/mma7660.c
> +++ b/drivers/iio/accel/mma7660.c
> @@ -7,8 +7,8 @@
>   * IIO driver for Freescale MMA7660FC; 7-bit I2C address: 0x4c.
>   */
>  
> -#include <linux/acpi.h>
>  #include <linux/i2c.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/module.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> @@ -255,7 +255,7 @@ static const struct of_device_id mma7660_of_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, mma7660_of_match);
>  
> -static const struct acpi_device_id __maybe_unused mma7660_acpi_id[] = {
> +static const struct acpi_device_id mma7660_acpi_id[] = {
>  	{"MMA7660", 0},
>  	{}
>  };
> @@ -267,7 +267,7 @@ static struct i2c_driver mma7660_driver = {
>  		.name = "mma7660",
>  		.pm = pm_sleep_ptr(&mma7660_pm_ops),
>  		.of_match_table = mma7660_of_match,
> -		.acpi_match_table = ACPI_PTR(mma7660_acpi_id),
> +		.acpi_match_table = mma7660_acpi_id,
>  	},
>  	.probe		= mma7660_probe,
>  	.remove		= mma7660_remove,


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

end of thread, other threads:[~2022-06-18 15:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-16 14:24 [PATCH v1 1/1] iio: accel: mma7660: Drop wrong use of ACPI_PTR() Andy Shevchenko
2022-06-18 15:34 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox