public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] iio: imu: st_lsm6dsx: Clean up ACPI/fwnode code paths
@ 2024-08-26 21:22 Andy Shevchenko
  2024-08-26 21:22 ` [PATCH v1 1/2] iio: imu: st_lsm6dsx: Use iio_read_acpi_mount_matrix() helper Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-08-26 21:22 UTC (permalink / raw)
  To: Lorenzo Bianconi, Andy Shevchenko, linux-iio, linux-kernel
  Cc: Jonathan Cameron, Lars-Peter Clausen

Here is a couple of cleanups that should not affect any functionality.

Andy Shevchenko (2):
  iio: imu: st_lsm6dsx: Use iio_read_acpi_mount_matrix() helper
  iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls

 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 93 ++------------------
 1 file changed, 7 insertions(+), 86 deletions(-)

-- 
2.46.0


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

* [PATCH v1 1/2] iio: imu: st_lsm6dsx: Use iio_read_acpi_mount_matrix() helper
  2024-08-26 21:22 [PATCH v1 0/2] iio: imu: st_lsm6dsx: Clean up ACPI/fwnode code paths Andy Shevchenko
@ 2024-08-26 21:22 ` Andy Shevchenko
  2024-08-26 21:22 ` [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls Andy Shevchenko
  2024-08-31 10:53 ` [PATCH v1 0/2] iio: imu: st_lsm6dsx: Clean up ACPI/fwnode code paths Jonathan Cameron
  2 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-08-26 21:22 UTC (permalink / raw)
  To: Lorenzo Bianconi, Andy Shevchenko, linux-iio, linux-kernel
  Cc: Jonathan Cameron, Lars-Peter Clausen

Replace the duplicate ACPI "ROTM" data parsing code with the new
shared iio_read_acpi_mount_matrix() helper.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 70 +-------------------
 1 file changed, 1 insertion(+), 69 deletions(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index 937ff9c5a74c..722b43f9203b 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2646,73 +2646,6 @@ static int st_lsm6dsx_init_regulators(struct device *dev)
 	return 0;
 }
 
-#ifdef CONFIG_ACPI
-
-static int lsm6dsx_get_acpi_mount_matrix(struct device *dev,
-					 struct iio_mount_matrix *orientation)
-{
-	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
-	struct acpi_device *adev = ACPI_COMPANION(dev);
-	union acpi_object *obj, *elements;
-	acpi_status status;
-	int i, j, val[3];
-	char *str;
-
-	if (!has_acpi_companion(dev))
-		return -EINVAL;
-
-	if (!acpi_has_method(adev->handle, "ROTM"))
-		return -EINVAL;
-
-	status = acpi_evaluate_object(adev->handle, "ROTM", NULL, &buffer);
-	if (ACPI_FAILURE(status)) {
-		dev_warn(dev, "Failed to get ACPI mount matrix: %d\n", status);
-		return -EINVAL;
-	}
-
-	obj = buffer.pointer;
-	if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count != 3)
-		goto unknown_format;
-
-	elements = obj->package.elements;
-	for (i = 0; i < 3; i++) {
-		if (elements[i].type != ACPI_TYPE_STRING)
-			goto unknown_format;
-
-		str = elements[i].string.pointer;
-		if (sscanf(str, "%d %d %d", &val[0], &val[1], &val[2]) != 3)
-			goto unknown_format;
-
-		for (j = 0; j < 3; j++) {
-			switch (val[j]) {
-			case -1: str = "-1"; break;
-			case 0:  str = "0";  break;
-			case 1:  str = "1";  break;
-			default: goto unknown_format;
-			}
-			orientation->rotation[i * 3 + j] = str;
-		}
-	}
-
-	kfree(buffer.pointer);
-	return 0;
-
-unknown_format:
-	dev_warn(dev, "Unknown ACPI mount matrix format, ignoring\n");
-	kfree(buffer.pointer);
-	return -EINVAL;
-}
-
-#else
-
-static int lsm6dsx_get_acpi_mount_matrix(struct device *dev,
-					  struct iio_mount_matrix *orientation)
-{
-	return -EOPNOTSUPP;
-}
-
-#endif
-
 int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
 		     struct regmap *regmap)
 {
@@ -2787,8 +2720,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
 			return err;
 	}
 
-	err = lsm6dsx_get_acpi_mount_matrix(hw->dev, &hw->orientation);
-	if (err) {
+	if (!iio_read_acpi_mount_matrix(hw->dev, &hw->orientation, "ROTM")) {
 		err = iio_read_mount_matrix(hw->dev, &hw->orientation);
 		if (err)
 			return err;
-- 
2.46.0


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

* [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls
  2024-08-26 21:22 [PATCH v1 0/2] iio: imu: st_lsm6dsx: Clean up ACPI/fwnode code paths Andy Shevchenko
  2024-08-26 21:22 ` [PATCH v1 1/2] iio: imu: st_lsm6dsx: Use iio_read_acpi_mount_matrix() helper Andy Shevchenko
@ 2024-08-26 21:22 ` Andy Shevchenko
  2024-08-27 15:01   ` kernel test robot
                     ` (3 more replies)
  2024-08-31 10:53 ` [PATCH v1 0/2] iio: imu: st_lsm6dsx: Clean up ACPI/fwnode code paths Jonathan Cameron
  2 siblings, 4 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-08-26 21:22 UTC (permalink / raw)
  To: Lorenzo Bianconi, Andy Shevchenko, linux-iio, linux-kernel
  Cc: Jonathan Cameron, Lars-Peter Clausen

The device property APIs designed that way that they will return an error when
there is no valid fwnode provided. Moreover, the check for NULL of dev_fwnode()
is not fully correct as in some (currently rare) cases it may contain an error
pointer. This is not a problem anyway (see keyword 'valid' above) that's why
the code works properly even without this change.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 23 +++++---------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index 722b43f9203b..a7760c000c8c 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2127,25 +2127,15 @@ static const struct iio_info st_lsm6dsx_gyro_info = {
 	.write_raw_get_fmt = st_lsm6dsx_write_raw_get_fmt,
 };
 
-static int st_lsm6dsx_get_drdy_pin(struct st_lsm6dsx_hw *hw, int *drdy_pin)
-{
-	struct device *dev = hw->dev;
-
-	if (!dev_fwnode(dev))
-		return -EINVAL;
-
-	return device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin);
-}
-
 static int
 st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
 			const struct st_lsm6dsx_reg **drdy_reg)
 {
+	struct device *dev = hw->dev;
 	int err = 0, drdy_pin;
 
-	if (st_lsm6dsx_get_drdy_pin(hw, &drdy_pin) < 0) {
+	if (device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin) < 0) {
 		struct st_sensors_platform_data *pdata;
-		struct device *dev = hw->dev;
 
 		pdata = (struct st_sensors_platform_data *)dev->platform_data;
 		drdy_pin = pdata ? pdata->drdy_int_pin : 1;
@@ -2180,7 +2170,7 @@ static int st_lsm6dsx_init_shub(struct st_lsm6dsx_hw *hw)
 	hub_settings = &hw->settings->shub_settings;
 
 	pdata = (struct st_sensors_platform_data *)dev->platform_data;
-	if ((dev_fwnode(dev) && device_property_read_bool(dev, "st,pullups")) ||
+	if (device_property_read_bool(dev, "st,pullups") ||
 	    (pdata && pdata->pullups)) {
 		if (hub_settings->pullup_en.sec_page) {
 			err = st_lsm6dsx_set_page(hw, true);
@@ -2565,7 +2555,7 @@ static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
 		return err;
 
 	pdata = (struct st_sensors_platform_data *)dev->platform_data;
-	if ((dev_fwnode(dev) && device_property_read_bool(dev, "drive-open-drain")) ||
+	if (device_property_read_bool(dev, "drive-open-drain") ||
 	    (pdata && pdata->open_drain)) {
 		reg = &hw->settings->irq_config.od;
 		err = regmap_update_bits(hw->regmap, reg->addr, reg->mask,
@@ -2693,8 +2683,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
 
 	hub_settings = &hw->settings->shub_settings;
 	if (hub_settings->master_en.addr &&
-	    (!dev_fwnode(dev) ||
-	     !device_property_read_bool(dev, "st,disable-sensor-hub"))) {
+	    !device_property_read_bool(dev, "st,disable-sensor-hub")) {
 		err = st_lsm6dsx_shub_probe(hw, name);
 		if (err < 0)
 			return err;
@@ -2735,7 +2724,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
 			return err;
 	}
 
-	if ((dev_fwnode(dev) && device_property_read_bool(dev, "wakeup-source")) ||
+	if (device_property_read_bool(dev, "wakeup-source") ||
 	    (pdata && pdata->wakeup_source))
 		device_init_wakeup(dev, true);
 
-- 
2.46.0


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

* Re: [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls
  2024-08-26 21:22 ` [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls Andy Shevchenko
@ 2024-08-27 15:01   ` kernel test robot
  2024-08-27 15:22   ` kernel test robot
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2024-08-27 15:01 UTC (permalink / raw)
  To: Andy Shevchenko, Lorenzo Bianconi, linux-iio, linux-kernel
  Cc: oe-kbuild-all, Jonathan Cameron, Lars-Peter Clausen

Hi Andy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on linus/master v6.11-rc5 next-20240827]
[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/Andy-Shevchenko/iio-imu-st_lsm6dsx-Use-iio_read_acpi_mount_matrix-helper/20240827-052617
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20240826212344.866928-3-andy.shevchenko%40gmail.com
patch subject: [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls
config: arc-randconfig-001-20240827 (https://download.01.org/0day-ci/archive/20240827/202408272259.MsdckhWn-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240827/202408272259.MsdckhWn-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408272259.MsdckhWn-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c: In function 'st_lsm6dsx_get_drdy_reg':
>> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:2137:62: warning: passing argument 3 of 'device_property_read_u32' makes pointer from integer without a cast [-Wint-conversion]
    2137 |         if (device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin) < 0) {
         |                                                              ^~~~~~~~
         |                                                              |
         |                                                              int
   In file included from include/linux/acpi.h:16,
                    from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:76:
   include/linux/property.h:229:71: note: expected 'u32 *' {aka 'unsigned int *'} but argument is of type 'int'
     229 |                                            const char *propname, u32 *val)
         |                                                                  ~~~~~^~~
   drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:2137:13: warning: 'drdy_pin' is used uninitialized [-Wuninitialized]
    2137 |         if (device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin) < 0) {
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:2135:22: note: 'drdy_pin' was declared here
    2135 |         int err = 0, drdy_pin;
         |                      ^~~~~~~~


vim +/device_property_read_u32 +2137 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c

  2129	
  2130	static int
  2131	st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
  2132				const struct st_lsm6dsx_reg **drdy_reg)
  2133	{
  2134		struct device *dev = hw->dev;
  2135		int err = 0, drdy_pin;
  2136	
> 2137		if (device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin) < 0) {
  2138			struct st_sensors_platform_data *pdata;
  2139	
  2140			pdata = (struct st_sensors_platform_data *)dev->platform_data;
  2141			drdy_pin = pdata ? pdata->drdy_int_pin : 1;
  2142		}
  2143	
  2144		switch (drdy_pin) {
  2145		case 1:
  2146			hw->irq_routing = &hw->settings->irq_config.irq1_func;
  2147			*drdy_reg = &hw->settings->irq_config.irq1;
  2148			break;
  2149		case 2:
  2150			hw->irq_routing = &hw->settings->irq_config.irq2_func;
  2151			*drdy_reg = &hw->settings->irq_config.irq2;
  2152			break;
  2153		default:
  2154			dev_err(hw->dev, "unsupported data ready pin\n");
  2155			err = -EINVAL;
  2156			break;
  2157		}
  2158	
  2159		return err;
  2160	}
  2161	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls
  2024-08-26 21:22 ` [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls Andy Shevchenko
  2024-08-27 15:01   ` kernel test robot
@ 2024-08-27 15:22   ` kernel test robot
  2024-08-27 15:53   ` kernel test robot
  2024-08-28  4:52   ` kernel test robot
  3 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2024-08-27 15:22 UTC (permalink / raw)
  To: Andy Shevchenko, Lorenzo Bianconi, linux-iio, linux-kernel
  Cc: llvm, oe-kbuild-all, Jonathan Cameron, Lars-Peter Clausen

Hi Andy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on linus/master v6.11-rc5 next-20240827]
[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/Andy-Shevchenko/iio-imu-st_lsm6dsx-Use-iio_read_acpi_mount_matrix-helper/20240827-052617
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20240826212344.866928-3-andy.shevchenko%40gmail.com
patch subject: [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls
config: arm64-randconfig-002-20240827 (https://download.01.org/0day-ci/archive/20240827/202408272315.6tUsOdsF-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240827/202408272315.6tUsOdsF-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408272315.6tUsOdsF-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:2137:55: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'u32 *' (aka 'unsigned int *') [-Wint-conversion]
           if (device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin) < 0) {
                                                                ^~~~~~~~
   include/linux/property.h:229:36: note: passing argument to parameter 'val' here
                                              const char *propname, u32 *val)
                                                                         ^
>> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:2137:55: warning: variable 'drdy_pin' is uninitialized when used here [-Wuninitialized]
           if (device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin) < 0) {
                                                                ^~~~~~~~
   drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:2135:23: note: initialize the variable 'drdy_pin' to silence this warning
           int err = 0, drdy_pin;
                                ^
                                 = 0
   2 warnings generated.


vim +2137 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c

  2129	
  2130	static int
  2131	st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
  2132				const struct st_lsm6dsx_reg **drdy_reg)
  2133	{
  2134		struct device *dev = hw->dev;
  2135		int err = 0, drdy_pin;
  2136	
> 2137		if (device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin) < 0) {
  2138			struct st_sensors_platform_data *pdata;
  2139	
  2140			pdata = (struct st_sensors_platform_data *)dev->platform_data;
  2141			drdy_pin = pdata ? pdata->drdy_int_pin : 1;
  2142		}
  2143	
  2144		switch (drdy_pin) {
  2145		case 1:
  2146			hw->irq_routing = &hw->settings->irq_config.irq1_func;
  2147			*drdy_reg = &hw->settings->irq_config.irq1;
  2148			break;
  2149		case 2:
  2150			hw->irq_routing = &hw->settings->irq_config.irq2_func;
  2151			*drdy_reg = &hw->settings->irq_config.irq2;
  2152			break;
  2153		default:
  2154			dev_err(hw->dev, "unsupported data ready pin\n");
  2155			err = -EINVAL;
  2156			break;
  2157		}
  2158	
  2159		return err;
  2160	}
  2161	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls
  2024-08-26 21:22 ` [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls Andy Shevchenko
  2024-08-27 15:01   ` kernel test robot
  2024-08-27 15:22   ` kernel test robot
@ 2024-08-27 15:53   ` kernel test robot
  2024-08-28  4:52   ` kernel test robot
  3 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2024-08-27 15:53 UTC (permalink / raw)
  To: Andy Shevchenko, Lorenzo Bianconi, linux-iio, linux-kernel
  Cc: llvm, oe-kbuild-all, Jonathan Cameron, Lars-Peter Clausen

Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on linus/master v6.11-rc5 next-20240827]
[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/Andy-Shevchenko/iio-imu-st_lsm6dsx-Use-iio_read_acpi_mount_matrix-helper/20240827-052617
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20240826212344.866928-3-andy.shevchenko%40gmail.com
patch subject: [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20240827/202408272326.NVkKclXF-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 08e5a1de8227512d4774a534b91cb2353cef6284)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240827/202408272326.NVkKclXF-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408272326.NVkKclXF-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:75:
   In file included from include/linux/module.h:19:
   In file included from include/linux/elf.h:6:
   In file included from arch/s390/include/asm/elf.h:181:
   In file included from arch/s390/include/asm/mmu_context.h:11:
   In file included from arch/s390/include/asm/pgalloc.h:18:
   In file included from include/linux/mm.h:2228:
   include/linux/vmstat.h:500:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     500 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     501 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:507:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     507 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     508 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:519:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     519 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     520 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:528:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     528 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     529 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:84:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/s390/include/asm/io.h:93:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     548 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     561 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
         |                                                           ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
     102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
         |                                                      ^
   In file included from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:84:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/s390/include/asm/io.h:93:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     574 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
         |                                                           ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
     115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
         |                                                      ^
   In file included from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:84:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/s390/include/asm/io.h:93:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     585 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     595 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     605 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     693 |         readsb(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     701 |         readsw(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     709 |         readsl(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     718 |         writesb(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     727 |         writesw(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     736 |         writesl(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
>> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:2137:55: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'u32 *' (aka 'unsigned int *') [-Wint-conversion]
    2137 |         if (device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin) < 0) {
         |                                                              ^~~~~~~~
   include/linux/property.h:229:36: note: passing argument to parameter 'val' here
     229 |                                            const char *propname, u32 *val)
         |                                                                       ^
   17 warnings and 1 error generated.


vim +2137 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c

  2129	
  2130	static int
  2131	st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
  2132				const struct st_lsm6dsx_reg **drdy_reg)
  2133	{
  2134		struct device *dev = hw->dev;
  2135		int err = 0, drdy_pin;
  2136	
> 2137		if (device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin) < 0) {
  2138			struct st_sensors_platform_data *pdata;
  2139	
  2140			pdata = (struct st_sensors_platform_data *)dev->platform_data;
  2141			drdy_pin = pdata ? pdata->drdy_int_pin : 1;
  2142		}
  2143	
  2144		switch (drdy_pin) {
  2145		case 1:
  2146			hw->irq_routing = &hw->settings->irq_config.irq1_func;
  2147			*drdy_reg = &hw->settings->irq_config.irq1;
  2148			break;
  2149		case 2:
  2150			hw->irq_routing = &hw->settings->irq_config.irq2_func;
  2151			*drdy_reg = &hw->settings->irq_config.irq2;
  2152			break;
  2153		default:
  2154			dev_err(hw->dev, "unsupported data ready pin\n");
  2155			err = -EINVAL;
  2156			break;
  2157		}
  2158	
  2159		return err;
  2160	}
  2161	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls
  2024-08-26 21:22 ` [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls Andy Shevchenko
                     ` (2 preceding siblings ...)
  2024-08-27 15:53   ` kernel test robot
@ 2024-08-28  4:52   ` kernel test robot
  3 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2024-08-28  4:52 UTC (permalink / raw)
  To: Andy Shevchenko, Lorenzo Bianconi, linux-iio, linux-kernel
  Cc: oe-kbuild-all, Jonathan Cameron, Lars-Peter Clausen

Hi Andy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on linus/master v6.11-rc5 next-20240827]
[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/Andy-Shevchenko/iio-imu-st_lsm6dsx-Use-iio_read_acpi_mount_matrix-helper/20240827-052617
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20240826212344.866928-3-andy.shevchenko%40gmail.com
patch subject: [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls
config: x86_64-randconfig-122-20240828 (https://download.01.org/0day-ci/archive/20240828/202408281240.oT6C3uTj-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240828/202408281240.oT6C3uTj-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408281240.oT6C3uTj-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:2137:62: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected unsigned int [usertype] *val @@     got int drdy_pin @@
   drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:2137:62: sparse:     expected unsigned int [usertype] *val
   drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:2137:62: sparse:     got int drdy_pin
>> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c:2137:62: sparse: sparse: non size-preserving integer to pointer cast

vim +2137 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c

  2129	
  2130	static int
  2131	st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
  2132				const struct st_lsm6dsx_reg **drdy_reg)
  2133	{
  2134		struct device *dev = hw->dev;
  2135		int err = 0, drdy_pin;
  2136	
> 2137		if (device_property_read_u32(dev, "st,drdy-int-pin", drdy_pin) < 0) {
  2138			struct st_sensors_platform_data *pdata;
  2139	
  2140			pdata = (struct st_sensors_platform_data *)dev->platform_data;
  2141			drdy_pin = pdata ? pdata->drdy_int_pin : 1;
  2142		}
  2143	
  2144		switch (drdy_pin) {
  2145		case 1:
  2146			hw->irq_routing = &hw->settings->irq_config.irq1_func;
  2147			*drdy_reg = &hw->settings->irq_config.irq1;
  2148			break;
  2149		case 2:
  2150			hw->irq_routing = &hw->settings->irq_config.irq2_func;
  2151			*drdy_reg = &hw->settings->irq_config.irq2;
  2152			break;
  2153		default:
  2154			dev_err(hw->dev, "unsupported data ready pin\n");
  2155			err = -EINVAL;
  2156			break;
  2157		}
  2158	
  2159		return err;
  2160	}
  2161	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v1 0/2] iio: imu: st_lsm6dsx: Clean up ACPI/fwnode code paths
  2024-08-26 21:22 [PATCH v1 0/2] iio: imu: st_lsm6dsx: Clean up ACPI/fwnode code paths Andy Shevchenko
  2024-08-26 21:22 ` [PATCH v1 1/2] iio: imu: st_lsm6dsx: Use iio_read_acpi_mount_matrix() helper Andy Shevchenko
  2024-08-26 21:22 ` [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls Andy Shevchenko
@ 2024-08-31 10:53 ` Jonathan Cameron
  2024-08-31 11:40   ` Andy Shevchenko
  2 siblings, 1 reply; 9+ messages in thread
From: Jonathan Cameron @ 2024-08-31 10:53 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Lorenzo Bianconi, linux-iio, linux-kernel, Lars-Peter Clausen

On Tue, 27 Aug 2024 00:22:38 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> Here is a couple of cleanups that should not affect any functionality.
> 
> Andy Shevchenko (2):
>   iio: imu: st_lsm6dsx: Use iio_read_acpi_mount_matrix() helper
>   iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls
> 
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 93 ++------------------
>  1 file changed, 7 insertions(+), 86 deletions(-)
> 

Applied the obvious fix for the bot error messages &drdy_pin
and applied to the togreg branch of iio.git (pushed out as testing)

Still time for other reviews however as I'll be rebasing that tree
anyway if Greg takes the pull request I sent last week.
There are some series waiting for fixes to loop back around, hence
this dance.

Jonathan

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

* Re: [PATCH v1 0/2] iio: imu: st_lsm6dsx: Clean up ACPI/fwnode code paths
  2024-08-31 10:53 ` [PATCH v1 0/2] iio: imu: st_lsm6dsx: Clean up ACPI/fwnode code paths Jonathan Cameron
@ 2024-08-31 11:40   ` Andy Shevchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-08-31 11:40 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Lorenzo Bianconi, linux-iio, linux-kernel, Lars-Peter Clausen

On Sat, Aug 31, 2024 at 1:53 PM Jonathan Cameron <jic23@kernel.org> wrote:
> On Tue, 27 Aug 2024 00:22:38 +0300
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
>
> > Here is a couple of cleanups that should not affect any functionality.

...

> Applied the obvious fix for the bot error messages &drdy_pin
> and applied to the togreg branch of iio.git (pushed out as testing)

Thank you and sorry for the inconvenience.

-- 
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2024-08-31 11:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26 21:22 [PATCH v1 0/2] iio: imu: st_lsm6dsx: Clean up ACPI/fwnode code paths Andy Shevchenko
2024-08-26 21:22 ` [PATCH v1 1/2] iio: imu: st_lsm6dsx: Use iio_read_acpi_mount_matrix() helper Andy Shevchenko
2024-08-26 21:22 ` [PATCH v1 2/2] iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls Andy Shevchenko
2024-08-27 15:01   ` kernel test robot
2024-08-27 15:22   ` kernel test robot
2024-08-27 15:53   ` kernel test robot
2024-08-28  4:52   ` kernel test robot
2024-08-31 10:53 ` [PATCH v1 0/2] iio: imu: st_lsm6dsx: Clean up ACPI/fwnode code paths Jonathan Cameron
2024-08-31 11:40   ` Andy Shevchenko

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