diff mbox series

iio: st_sensors: Add ACPI support for lsm303d to the LSM9DS0 IMU driver

Message ID 20230412223627.442963-5-mail@mariushoch.de (mailing list archive)
State Superseded
Headers show
Series iio: st_sensors: Add ACPI support for lsm303d to the LSM9DS0 IMU driver | expand

Commit Message

Marius Hoch April 12, 2023, 10:36 p.m. UTC
From: Marius Hoch <mail@mariushoch.de>

The lsm303d can be found as ACCL0001 on various Lenovo devices,
including the Lenovo Yoga Tablet 2 1051-F, where I tested this
patch.

Signed-off-by: Marius Hoch <mail@mariushoch.de>
---
 drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c | 10 ++++++++++
 drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c | 10 ++++++++++
 2 files changed, 20 insertions(+)

Comments

kernel test robot April 13, 2023, 12:27 a.m. UTC | #1
Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on linus/master v6.3-rc6 next-20230412]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/mail-mariushoch-de/iio-st_sensors-Add-ACPI-support-for-lsm303d-to-the-LSM9DS0-IMU-driver/20230413-064417
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20230412223627.442963-5-mail%40mariushoch.de
patch subject: [PATCH] iio: st_sensors: Add ACPI support for lsm303d to the LSM9DS0 IMU driver
config: x86_64-allmodconfig (https://download.01.org/0day-ci/archive/20230413/202304130858.DbtHpwcV-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/ec35631841a31e357cf4f6781b4c8f78a468a4ef
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review mail-mariushoch-de/iio-st_sensors-Add-ACPI-support-for-lsm303d-to-the-LSM9DS0-IMU-driver/20230413-064417
        git checkout ec35631841a31e357cf4f6781b4c8f78a468a4ef
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/iio/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304130858.DbtHpwcV-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c:38:38: error: 'LSM303D_IMU_DEV_NAME' undeclared here (not in a function); did you mean 'LSM9DS0_IMU_DEV_NAME'?
      38 |         {"ACCL0001", (kernel_ulong_t)LSM303D_IMU_DEV_NAME},
         |                                      ^~~~~~~~~~~~~~~~~~~~
         |                                      LSM9DS0_IMU_DEV_NAME
--
>> drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c:38:38: error: 'LSM303D_IMU_DEV_NAME' undeclared here (not in a function); did you mean 'LSM9DS0_IMU_DEV_NAME'?
      38 |         {"ACCL0001", (kernel_ulong_t)LSM303D_IMU_DEV_NAME},
         |                                      ^~~~~~~~~~~~~~~~~~~~
         |                                      LSM9DS0_IMU_DEV_NAME


vim +38 drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c

    35	
    36	#ifdef CONFIG_ACPI
    37	static const struct acpi_device_id st_lsm9ds0_acpi_match[] = {
  > 38		{"ACCL0001", (kernel_ulong_t)LSM303D_IMU_DEV_NAME},
    39		{ },
    40	};
    41	MODULE_DEVICE_TABLE(acpi, st_lsm9ds0_acpi_match);
    42	#endif
    43
diff mbox series

Patch

diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c
index 64fa77d302e2..79be8d28d965 100644
--- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c
+++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_i2c.c
@@ -12,6 +12,7 @@ 
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
 #include <linux/regmap.h>
+#include <linux/acpi.h>
 
 #include <linux/iio/common/st_sensors_i2c.h>
 
@@ -37,6 +38,14 @@  static const struct i2c_device_id st_lsm9ds0_id_table[] = {
 };
 MODULE_DEVICE_TABLE(i2c, st_lsm9ds0_id_table);
 
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id st_lsm9ds0_acpi_match[] = {
+	{"ACCL0001", (kernel_ulong_t)LSM303D_IMU_DEV_NAME},
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, st_lsm9ds0_acpi_match);
+#endif
+
 static const struct regmap_config st_lsm9ds0_regmap_config = {
 	.reg_bits	= 8,
 	.val_bits	= 8,
@@ -73,6 +82,7 @@  static struct i2c_driver st_lsm9ds0_driver = {
 	.driver = {
 		.name = "st-lsm9ds0-i2c",
 		.of_match_table = st_lsm9ds0_of_match,
+		.acpi_match_table = ACPI_PTR(st_lsm9ds0_acpi_match),
 	},
 	.probe_new = st_lsm9ds0_i2c_probe,
 	.id_table = st_lsm9ds0_id_table,
diff --git a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c
index 997b5ff792be..27c5d99ce0e3 100644
--- a/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c
+++ b/drivers/iio/imu/st_lsm9ds0/st_lsm9ds0_spi.c
@@ -12,6 +12,7 @@ 
 #include <linux/mod_devicetable.h>
 #include <linux/regmap.h>
 #include <linux/spi/spi.h>
+#include <linux/acpi.h>
 
 #include <linux/iio/common/st_sensors_spi.h>
 
@@ -37,6 +38,14 @@  static const struct spi_device_id st_lsm9ds0_id_table[] = {
 };
 MODULE_DEVICE_TABLE(spi, st_lsm9ds0_id_table);
 
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id st_lsm9ds0_acpi_match[] = {
+	{"ACCL0001", (kernel_ulong_t)LSM303D_IMU_DEV_NAME},
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, st_lsm9ds0_acpi_match);
+#endif
+
 static const struct regmap_config st_lsm9ds0_regmap_config = {
 	.reg_bits	= 8,
 	.val_bits	= 8,
@@ -72,6 +81,7 @@  static struct spi_driver st_lsm9ds0_driver = {
 	.driver = {
 		.name = "st-lsm9ds0-spi",
 		.of_match_table = st_lsm9ds0_of_match,
+		.acpi_match_table = ACPI_PTR(st_lsm9ds0_acpi_match),
 	},
 	.probe = st_lsm9ds0_spi_probe,
 	.id_table = st_lsm9ds0_id_table,