All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro
@ 2021-05-10 19:52 Andy Shevchenko
  2021-05-10 23:36   ` kernel test robot
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Andy Shevchenko @ 2021-05-10 19:52 UTC (permalink / raw)
  To: Bartosz Golaszewski, Andy Shevchenko, Kent Gibson, linux-gpio,
	linux-kernel
  Cc: Linus Walleij

In a few places we are using a loop against all GPIO descriptors
for a given device. Replace it with a consolidated for_each tupe
of macro.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib-of.c    | 9 ++++-----
 drivers/gpio/gpiolib-sysfs.c | 3 +--
 drivers/gpio/gpiolib.c       | 7 ++++---
 drivers/gpio/gpiolib.h       | 6 ++++++
 4 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index bbcc7c073f63..fb1bfbfb3fc3 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -711,13 +711,12 @@ static int of_gpiochip_scan_gpios(struct gpio_chip *chip)
 static void of_gpiochip_remove_hog(struct gpio_chip *chip,
 				   struct device_node *hog)
 {
-	struct gpio_desc *descs = chip->gpiodev->descs;
+	struct gpio_desc *desc;
 	unsigned int i;
 
-	for (i = 0; i < chip->ngpio; i++) {
-		if (test_bit(FLAG_IS_HOGGED, &descs[i].flags) &&
-		    descs[i].hog == hog)
-			gpiochip_free_own_desc(&descs[i]);
+	for_each_gpio_desc(i, chip, desc) {
+		if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
+			gpiochip_free_own_desc(desc);
 	}
 }
 
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index ae49bb23c6ed..b0c7a303adde 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -801,8 +801,7 @@ void gpiochip_sysfs_unregister(struct gpio_device *gdev)
 	mutex_unlock(&sysfs_lock);
 
 	/* unregister gpiod class devices owned by sysfs */
-	for (i = 0; i < chip->ngpio; i++) {
-		desc = &gdev->descs[i];
+	for_each_gpio_desc(i, chip, desc) {
 		if (test_and_clear_bit(FLAG_SYSFS, &desc->flags))
 			gpiod_free(desc);
 	}
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 220a9d8dd4e3..d61e11084a09 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -4012,11 +4012,12 @@ int gpiod_hog(struct gpio_desc *desc, const char *name,
  */
 static void gpiochip_free_hogs(struct gpio_chip *gc)
 {
+	struct gpio_desc *desc;
 	int id;
 
-	for (id = 0; id < gc->ngpio; id++) {
-		if (test_bit(FLAG_IS_HOGGED, &gc->gpiodev->descs[id].flags))
-			gpiochip_free_own_desc(&gc->gpiodev->descs[id]);
+	for_each_gpio_desc(id, gc, desc) {
+		if (test_bit(FLAG_IS_HOGGED, &desc->flags))
+			gpiochip_free_own_desc(desc);
 	}
 }
 
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index 30bc3f80f83e..b6d8d71bfbd5 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -82,6 +82,12 @@ struct gpio_array {
 };
 
 struct gpio_desc *gpiochip_get_desc(struct gpio_chip *gc, unsigned int hwnum);
+
+#define for_each_gpio_desc(i, gc, desc)			\
+	for (i = 0, desc = gpiochip_get_desc(gc, i);	\
+	     i < gc->ngpio;				\
+	     i++, desc = gpiochip_get_desc(gc, i))	\
+
 int gpiod_get_array_value_complex(bool raw, bool can_sleep,
 				  unsigned int array_size,
 				  struct gpio_desc **desc_array,
-- 
2.30.2


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

* Re: [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro
  2021-05-10 19:52 [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro Andy Shevchenko
@ 2021-05-10 23:36   ` kernel test robot
  2021-05-11  0:06   ` kernel test robot
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-05-10 23:36 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, Kent Gibson, linux-gpio,
	linux-kernel
  Cc: kbuild-all, Linus Walleij

[-- Attachment #1: Type: text/plain, Size: 2663 bytes --]

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on gpio/for-next]
[also build test WARNING on v5.13-rc1 next-20210510]
[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/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: arm-randconfig-s031-20210510 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
        git checkout ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=arm 

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


sparse warnings: (new ones prefixed by >>)
>> drivers/gpio/gpiolib-of.c:718:50: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned long const volatile *addr @@     got unsigned long flags @@
   drivers/gpio/gpiolib-of.c:718:50: sparse:     expected unsigned long const volatile *addr
   drivers/gpio/gpiolib-of.c:718:50: sparse:     got unsigned long flags

vim +718 drivers/gpio/gpiolib-of.c

   704	
   705	#ifdef CONFIG_OF_DYNAMIC
   706	/**
   707	 * of_gpiochip_remove_hog - Remove all hogs in a hog device node
   708	 * @chip:	gpio chip to act on
   709	 * @hog:	device node describing the hogs
   710	 */
   711	static void of_gpiochip_remove_hog(struct gpio_chip *chip,
   712					   struct device_node *hog)
   713	{
   714		struct gpio_desc *desc;
   715		unsigned int i;
   716	
   717		for_each_gpio_desc(i, chip, desc) {
 > 718			if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
   719				gpiochip_free_own_desc(desc);
   720		}
   721	}
   722	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33599 bytes --]

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

* Re: [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro
@ 2021-05-10 23:36   ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-05-10 23:36 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2725 bytes --]

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on gpio/for-next]
[also build test WARNING on v5.13-rc1 next-20210510]
[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/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: arm-randconfig-s031-20210510 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
        git checkout ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=arm 

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


sparse warnings: (new ones prefixed by >>)
>> drivers/gpio/gpiolib-of.c:718:50: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned long const volatile *addr @@     got unsigned long flags @@
   drivers/gpio/gpiolib-of.c:718:50: sparse:     expected unsigned long const volatile *addr
   drivers/gpio/gpiolib-of.c:718:50: sparse:     got unsigned long flags

vim +718 drivers/gpio/gpiolib-of.c

   704	
   705	#ifdef CONFIG_OF_DYNAMIC
   706	/**
   707	 * of_gpiochip_remove_hog - Remove all hogs in a hog device node
   708	 * @chip:	gpio chip to act on
   709	 * @hog:	device node describing the hogs
   710	 */
   711	static void of_gpiochip_remove_hog(struct gpio_chip *chip,
   712					   struct device_node *hog)
   713	{
   714		struct gpio_desc *desc;
   715		unsigned int i;
   716	
   717		for_each_gpio_desc(i, chip, desc) {
 > 718			if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
   719				gpiochip_free_own_desc(desc);
   720		}
   721	}
   722	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33599 bytes --]

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

* Re: [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro
  2021-05-10 19:52 [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro Andy Shevchenko
@ 2021-05-11  0:06   ` kernel test robot
  2021-05-11  0:06   ` kernel test robot
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-05-11  0:06 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, Kent Gibson, linux-gpio,
	linux-kernel
  Cc: kbuild-all, Linus Walleij

[-- Attachment #1: Type: text/plain, Size: 3673 bytes --]

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on gpio/for-next]
[also build test WARNING on v5.13-rc1 next-20210510]
[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/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: h8300-randconfig-r012-20210510 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
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/ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
        git checkout ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=h8300 

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/gpio/gpiolib-of.c: In function 'of_gpiochip_remove_hog':
>> drivers/gpio/gpiolib-of.c:718:36: warning: passing argument 2 of 'test_bit' makes pointer from integer without a cast [-Wint-conversion]
     718 |   if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
         |                                ~~~~^~~~~~~
         |                                    |
         |                                    long unsigned int
   In file included from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/asm-generic/bug.h:20,
                    from arch/h8300/include/asm/bug.h:8,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:12,
                    from include/asm-generic/current.h:5,
                    from ./arch/h8300/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from drivers/gpio/gpiolib-of.c:10:
   arch/h8300/include/asm/bitops.h:63:66: note: expected 'const volatile long unsigned int *' but argument is of type 'long unsigned int'
      63 | static inline int test_bit(int nr, const volatile unsigned long *addr)
         |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~


vim +/test_bit +718 drivers/gpio/gpiolib-of.c

   704	
   705	#ifdef CONFIG_OF_DYNAMIC
   706	/**
   707	 * of_gpiochip_remove_hog - Remove all hogs in a hog device node
   708	 * @chip:	gpio chip to act on
   709	 * @hog:	device node describing the hogs
   710	 */
   711	static void of_gpiochip_remove_hog(struct gpio_chip *chip,
   712					   struct device_node *hog)
   713	{
   714		struct gpio_desc *desc;
   715		unsigned int i;
   716	
   717		for_each_gpio_desc(i, chip, desc) {
 > 718			if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
   719				gpiochip_free_own_desc(desc);
   720		}
   721	}
   722	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27774 bytes --]

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

* Re: [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro
@ 2021-05-11  0:06   ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-05-11  0:06 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3753 bytes --]

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on gpio/for-next]
[also build test WARNING on v5.13-rc1 next-20210510]
[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/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: h8300-randconfig-r012-20210510 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
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/ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
        git checkout ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=h8300 

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/gpio/gpiolib-of.c: In function 'of_gpiochip_remove_hog':
>> drivers/gpio/gpiolib-of.c:718:36: warning: passing argument 2 of 'test_bit' makes pointer from integer without a cast [-Wint-conversion]
     718 |   if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
         |                                ~~~~^~~~~~~
         |                                    |
         |                                    long unsigned int
   In file included from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/asm-generic/bug.h:20,
                    from arch/h8300/include/asm/bug.h:8,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:12,
                    from include/asm-generic/current.h:5,
                    from ./arch/h8300/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from drivers/gpio/gpiolib-of.c:10:
   arch/h8300/include/asm/bitops.h:63:66: note: expected 'const volatile long unsigned int *' but argument is of type 'long unsigned int'
      63 | static inline int test_bit(int nr, const volatile unsigned long *addr)
         |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~


vim +/test_bit +718 drivers/gpio/gpiolib-of.c

   704	
   705	#ifdef CONFIG_OF_DYNAMIC
   706	/**
   707	 * of_gpiochip_remove_hog - Remove all hogs in a hog device node
   708	 * @chip:	gpio chip to act on
   709	 * @hog:	device node describing the hogs
   710	 */
   711	static void of_gpiochip_remove_hog(struct gpio_chip *chip,
   712					   struct device_node *hog)
   713	{
   714		struct gpio_desc *desc;
   715		unsigned int i;
   716	
   717		for_each_gpio_desc(i, chip, desc) {
 > 718			if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
   719				gpiochip_free_own_desc(desc);
   720		}
   721	}
   722	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27774 bytes --]

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

* Re: [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro
  2021-05-10 19:52 [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro Andy Shevchenko
@ 2021-05-11  1:25   ` kernel test robot
  2021-05-11  0:06   ` kernel test robot
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-05-11  1:25 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, Kent Gibson, linux-gpio,
	linux-kernel
  Cc: kbuild-all, clang-built-linux, Linus Walleij

[-- Attachment #1: Type: text/plain, Size: 5821 bytes --]

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on gpio/for-next]
[also build test WARNING on v5.13-rc1 next-20210510]
[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/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: riscv-randconfig-r011-20210510 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 492173d42b32cb91d5d0d72d5ed84fcab80d059a)
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
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
        git checkout ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv 

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/gpio/gpiolib-of.c:718:32: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const volatile unsigned long *'; take the address with & [-Wint-conversion]
                   if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
                                                ^~~~~~~~~~~
                                                &
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   include/asm-generic/bitops/non-atomic.h:104:66: note: passing argument to parameter 'addr' here
   static inline int test_bit(int nr, const volatile unsigned long *addr)
                                                                    ^
>> drivers/gpio/gpiolib-of.c:718:32: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const volatile unsigned long *'; take the address with & [-Wint-conversion]
                   if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
                                                ^~~~~~~~~~~
                                                &
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                               ^~~~
   include/asm-generic/bitops/non-atomic.h:104:66: note: passing argument to parameter 'addr' here
   static inline int test_bit(int nr, const volatile unsigned long *addr)
                                                                    ^
>> drivers/gpio/gpiolib-of.c:718:32: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const volatile unsigned long *'; take the address with & [-Wint-conversion]
                   if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
                                                ^~~~~~~~~~~
                                                &
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   include/asm-generic/bitops/non-atomic.h:104:66: note: passing argument to parameter 'addr' here
   static inline int test_bit(int nr, const volatile unsigned long *addr)
                                                                    ^
   3 warnings generated.


vim +718 drivers/gpio/gpiolib-of.c

   704	
   705	#ifdef CONFIG_OF_DYNAMIC
   706	/**
   707	 * of_gpiochip_remove_hog - Remove all hogs in a hog device node
   708	 * @chip:	gpio chip to act on
   709	 * @hog:	device node describing the hogs
   710	 */
   711	static void of_gpiochip_remove_hog(struct gpio_chip *chip,
   712					   struct device_node *hog)
   713	{
   714		struct gpio_desc *desc;
   715		unsigned int i;
   716	
   717		for_each_gpio_desc(i, chip, desc) {
 > 718			if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
   719				gpiochip_free_own_desc(desc);
   720		}
   721	}
   722	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37838 bytes --]

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

* Re: [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro
@ 2021-05-11  1:25   ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-05-11  1:25 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5924 bytes --]

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on gpio/for-next]
[also build test WARNING on v5.13-rc1 next-20210510]
[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/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: riscv-randconfig-r011-20210510 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 492173d42b32cb91d5d0d72d5ed84fcab80d059a)
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
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
        git checkout ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv 

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/gpio/gpiolib-of.c:718:32: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const volatile unsigned long *'; take the address with & [-Wint-conversion]
                   if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
                                                ^~~~~~~~~~~
                                                &
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   include/asm-generic/bitops/non-atomic.h:104:66: note: passing argument to parameter 'addr' here
   static inline int test_bit(int nr, const volatile unsigned long *addr)
                                                                    ^
>> drivers/gpio/gpiolib-of.c:718:32: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const volatile unsigned long *'; take the address with & [-Wint-conversion]
                   if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
                                                ^~~~~~~~~~~
                                                &
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                               ^~~~
   include/asm-generic/bitops/non-atomic.h:104:66: note: passing argument to parameter 'addr' here
   static inline int test_bit(int nr, const volatile unsigned long *addr)
                                                                    ^
>> drivers/gpio/gpiolib-of.c:718:32: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const volatile unsigned long *'; take the address with & [-Wint-conversion]
                   if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
                                                ^~~~~~~~~~~
                                                &
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   include/asm-generic/bitops/non-atomic.h:104:66: note: passing argument to parameter 'addr' here
   static inline int test_bit(int nr, const volatile unsigned long *addr)
                                                                    ^
   3 warnings generated.


vim +718 drivers/gpio/gpiolib-of.c

   704	
   705	#ifdef CONFIG_OF_DYNAMIC
   706	/**
   707	 * of_gpiochip_remove_hog - Remove all hogs in a hog device node
   708	 * @chip:	gpio chip to act on
   709	 * @hog:	device node describing the hogs
   710	 */
   711	static void of_gpiochip_remove_hog(struct gpio_chip *chip,
   712					   struct device_node *hog)
   713	{
   714		struct gpio_desc *desc;
   715		unsigned int i;
   716	
   717		for_each_gpio_desc(i, chip, desc) {
 > 718			if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
   719				gpiochip_free_own_desc(desc);
   720		}
   721	}
   722	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37838 bytes --]

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

* Re: [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro
  2021-05-10 23:36   ` kernel test robot
@ 2021-05-11  7:22     ` Andy Shevchenko
  -1 siblings, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2021-05-11  7:22 UTC (permalink / raw)
  To: kernel test robot
  Cc: Bartosz Golaszewski, Kent Gibson, linux-gpio, linux-kernel,
	kbuild-all, Linus Walleij

On Tue, May 11, 2021 at 07:36:58AM +0800, kernel test robot wrote:
> Hi Andy,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on gpio/for-next]
> [also build test WARNING on v5.13-rc1 next-20210510]
> [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/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
> config: arm-randconfig-s031-20210510 (attached as .config)
> compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # apt-get install sparse
>         # sparse version: v0.6.3-341-g8af24329-dirty
>         # https://github.com/0day-ci/linux/commit/ceaf41face19ca3a36b81b3b866c1708a90cb4e2
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Andy-Shevchenko/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
>         git checkout ceaf41face19ca3a36b81b3b866c1708a90cb4e2
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=arm 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>

Right, I missed OF part compilation, thanks for reminder, I'll fix my kernel
configuration and the patch in v2.


-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro
@ 2021-05-11  7:22     ` Andy Shevchenko
  0 siblings, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2021-05-11  7:22 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1847 bytes --]

On Tue, May 11, 2021 at 07:36:58AM +0800, kernel test robot wrote:
> Hi Andy,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on gpio/for-next]
> [also build test WARNING on v5.13-rc1 next-20210510]
> [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/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
> config: arm-randconfig-s031-20210510 (attached as .config)
> compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # apt-get install sparse
>         # sparse version: v0.6.3-341-g8af24329-dirty
>         # https://github.com/0day-ci/linux/commit/ceaf41face19ca3a36b81b3b866c1708a90cb4e2
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Andy-Shevchenko/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
>         git checkout ceaf41face19ca3a36b81b3b866c1708a90cb4e2
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=arm 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>

Right, I missed OF part compilation, thanks for reminder, I'll fix my kernel
configuration and the patch in v2.


-- 
With Best Regards,
Andy Shevchenko


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

* Re: [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro
  2021-05-10 19:52 [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro Andy Shevchenko
@ 2021-05-12 13:08   ` kernel test robot
  2021-05-11  0:06   ` kernel test robot
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-05-12 13:08 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, Kent Gibson, linux-gpio,
	linux-kernel
  Cc: kbuild-all, Linus Walleij

[-- Attachment #1: Type: text/plain, Size: 2660 bytes --]

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on gpio/for-next]
[also build test WARNING on v5.13-rc1 next-20210512]
[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/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: m68k-randconfig-s032-20210512 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
        git checkout ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=m68k 

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


sparse warnings: (new ones prefixed by >>)
>> drivers/gpio/gpiolib-of.c:718:50: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned long const volatile *vaddr @@     got unsigned long flags @@
   drivers/gpio/gpiolib-of.c:718:50: sparse:     expected unsigned long const volatile *vaddr
   drivers/gpio/gpiolib-of.c:718:50: sparse:     got unsigned long flags

vim +718 drivers/gpio/gpiolib-of.c

   704	
   705	#ifdef CONFIG_OF_DYNAMIC
   706	/**
   707	 * of_gpiochip_remove_hog - Remove all hogs in a hog device node
   708	 * @chip:	gpio chip to act on
   709	 * @hog:	device node describing the hogs
   710	 */
   711	static void of_gpiochip_remove_hog(struct gpio_chip *chip,
   712					   struct device_node *hog)
   713	{
   714		struct gpio_desc *desc;
   715		unsigned int i;
   716	
   717		for_each_gpio_desc(i, chip, desc) {
 > 718			if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
   719				gpiochip_free_own_desc(desc);
   720		}
   721	}
   722	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25246 bytes --]

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

* Re: [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro
@ 2021-05-12 13:08   ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-05-12 13:08 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2722 bytes --]

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on gpio/for-next]
[also build test WARNING on v5.13-rc1 next-20210512]
[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/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: m68k-randconfig-s032-20210512 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/gpiolib-Introduce-for_each_gpio_desc-macro/20210511-035305
        git checkout ceaf41face19ca3a36b81b3b866c1708a90cb4e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=m68k 

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


sparse warnings: (new ones prefixed by >>)
>> drivers/gpio/gpiolib-of.c:718:50: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned long const volatile *vaddr @@     got unsigned long flags @@
   drivers/gpio/gpiolib-of.c:718:50: sparse:     expected unsigned long const volatile *vaddr
   drivers/gpio/gpiolib-of.c:718:50: sparse:     got unsigned long flags

vim +718 drivers/gpio/gpiolib-of.c

   704	
   705	#ifdef CONFIG_OF_DYNAMIC
   706	/**
   707	 * of_gpiochip_remove_hog - Remove all hogs in a hog device node
   708	 * @chip:	gpio chip to act on
   709	 * @hog:	device node describing the hogs
   710	 */
   711	static void of_gpiochip_remove_hog(struct gpio_chip *chip,
   712					   struct device_node *hog)
   713	{
   714		struct gpio_desc *desc;
   715		unsigned int i;
   716	
   717		for_each_gpio_desc(i, chip, desc) {
 > 718			if (test_bit(FLAG_IS_HOGGED, desc->flags) && desc->hog == hog)
   719				gpiochip_free_own_desc(desc);
   720		}
   721	}
   722	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 25246 bytes --]

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

end of thread, other threads:[~2021-05-12 13:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 19:52 [PATCH v1 1/1] gpiolib: Introduce for_each_gpio_desc() macro Andy Shevchenko
2021-05-10 23:36 ` kernel test robot
2021-05-10 23:36   ` kernel test robot
2021-05-11  7:22   ` Andy Shevchenko
2021-05-11  7:22     ` Andy Shevchenko
2021-05-11  0:06 ` kernel test robot
2021-05-11  0:06   ` kernel test robot
2021-05-11  1:25 ` kernel test robot
2021-05-11  1:25   ` kernel test robot
2021-05-12 13:08 ` kernel test robot
2021-05-12 13:08   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.