diff mbox series

[v1,2/8] iio: accel: adxl345: Set driver_data for OF enumeration

Message ID 20220221233235.86893-2-andriy.shevchenko@linux.intel.com (mailing list archive)
State Superseded
Headers show
Series [v1,1/8] iio: accel: adxl345: Convert to use dev_err_probe() | expand

Commit Message

Andy Shevchenko Feb. 21, 2022, 11:32 p.m. UTC
In order to enable this driver on mode platforms, assign driver_data
field in the OF device ID table.

While at it, make sure that device type is not 0 which may be wrongly
interpreted by device property APIs in the future.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/accel/adxl345.h     | 4 ++--
 drivers/iio/accel/adxl345_i2c.c | 4 ++--
 drivers/iio/accel/adxl345_spi.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

Comments

kernel test robot Feb. 22, 2022, 2:15 a.m. UTC | #1
Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on v5.17-rc5 next-20220217]
[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]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/iio-accel-adxl345-Convert-to-use-dev_err_probe/20220222-073422
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: hexagon-randconfig-r036-20220221 (https://download.01.org/0day-ci/archive/20220222/202202221020.VX0nc5j6-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/2d02dfc34a92b731790a911491fbb13cf2e6e882
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/iio-accel-adxl345-Convert-to-use-dev_err_probe/20220222-073422
        git checkout 2d02dfc34a92b731790a911491fbb13cf2e6e882
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/iio/accel/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/iio/accel/adxl345_spi.c:48:33: warning: incompatible integer to pointer conversion initializing 'const void *' with an expression of type 'int' [-Wint-conversion]
           { .compatible = "adi,adxl345", ADXL345 },
                                          ^~~~~~~
   drivers/iio/accel/adxl345_spi.c:49:33: warning: incompatible integer to pointer conversion initializing 'const void *' with an expression of type 'int' [-Wint-conversion]
           { .compatible = "adi,adxl375", ADXL375 },
                                          ^~~~~~~
   2 warnings generated.


vim +48 drivers/iio/accel/adxl345_spi.c

    46	
    47	static const struct of_device_id adxl345_of_match[] = {
  > 48		{ .compatible = "adi,adxl345", ADXL345 },
    49		{ .compatible = "adi,adxl375", ADXL375 },
    50		{ },
    51	};
    52	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Feb. 22, 2022, 2:46 a.m. UTC | #2
Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on v5.17-rc5 next-20220217]
[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]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/iio-accel-adxl345-Convert-to-use-dev_err_probe/20220222-073422
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: i386-randconfig-a014-20220221 (https://download.01.org/0day-ci/archive/20220222/202202221026.cREU7Drv-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/2d02dfc34a92b731790a911491fbb13cf2e6e882
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/iio-accel-adxl345-Convert-to-use-dev_err_probe/20220222-073422
        git checkout 2d02dfc34a92b731790a911491fbb13cf2e6e882
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/iio/accel/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/iio/accel/adxl345_i2c.c:32:25: error: use of undeclared identifier 'spi'
                   return dev_err_probe(&spi->dev, PTR_ERR(regmap), "Error initializing regmap\n");
                                         ^
>> drivers/iio/accel/adxl345_i2c.c:47:33: warning: incompatible integer to pointer conversion initializing 'const void *' with an expression of type 'int' [-Wint-conversion]
           { .compatible = "adi,adxl345", ADXL345 },
                                          ^~~~~~~
   drivers/iio/accel/adxl345_i2c.c:48:33: warning: incompatible integer to pointer conversion initializing 'const void *' with an expression of type 'int' [-Wint-conversion]
           { .compatible = "adi,adxl375", ADXL375 },
                                          ^~~~~~~
   2 warnings and 1 error generated.
--
>> drivers/iio/accel/adxl345_spi.c:48:33: warning: incompatible integer to pointer conversion initializing 'const void *' with an expression of type 'int' [-Wint-conversion]
           { .compatible = "adi,adxl345", ADXL345 },
                                          ^~~~~~~
   drivers/iio/accel/adxl345_spi.c:49:33: warning: incompatible integer to pointer conversion initializing 'const void *' with an expression of type 'int' [-Wint-conversion]
           { .compatible = "adi,adxl375", ADXL375 },
                                          ^~~~~~~
   2 warnings generated.


vim +47 drivers/iio/accel/adxl345_i2c.c

    45	
    46	static const struct of_device_id adxl345_of_match[] = {
  > 47		{ .compatible = "adi,adxl345", ADXL345 },
    48		{ .compatible = "adi,adxl375", ADXL375 },
    49		{ },
    50	};
    51	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/iio/accel/adxl345.h b/drivers/iio/accel/adxl345.h
index af0fdd02c4f2..5a68d4dac717 100644
--- a/drivers/iio/accel/adxl345.h
+++ b/drivers/iio/accel/adxl345.h
@@ -9,8 +9,8 @@ 
 #define _ADXL345_H_
 
 enum adxl345_device_type {
-	ADXL345,
-	ADXL375,
+	ADXL345	= 1,
+	ADXL375 = 2,
 };
 
 int adxl345_core_probe(struct device *dev, struct regmap *regmap,
diff --git a/drivers/iio/accel/adxl345_i2c.c b/drivers/iio/accel/adxl345_i2c.c
index d6dd715bf404..478ffc671035 100644
--- a/drivers/iio/accel/adxl345_i2c.c
+++ b/drivers/iio/accel/adxl345_i2c.c
@@ -44,8 +44,8 @@  static const struct i2c_device_id adxl345_i2c_id[] = {
 MODULE_DEVICE_TABLE(i2c, adxl345_i2c_id);
 
 static const struct of_device_id adxl345_of_match[] = {
-	{ .compatible = "adi,adxl345" },
-	{ .compatible = "adi,adxl375" },
+	{ .compatible = "adi,adxl345", ADXL345 },
+	{ .compatible = "adi,adxl375", ADXL375 },
 	{ },
 };
 
diff --git a/drivers/iio/accel/adxl345_spi.c b/drivers/iio/accel/adxl345_spi.c
index 6984b13f32e8..79f9428e39f8 100644
--- a/drivers/iio/accel/adxl345_spi.c
+++ b/drivers/iio/accel/adxl345_spi.c
@@ -45,8 +45,8 @@  static const struct spi_device_id adxl345_spi_id[] = {
 MODULE_DEVICE_TABLE(spi, adxl345_spi_id);
 
 static const struct of_device_id adxl345_of_match[] = {
-	{ .compatible = "adi,adxl345" },
-	{ .compatible = "adi,adxl375" },
+	{ .compatible = "adi,adxl345", ADXL345 },
+	{ .compatible = "adi,adxl375", ADXL375 },
 	{ },
 };