* Re: [PATCH 4/5] gpio: xilinx: Utilize generic bitmap_get_value and _set_value
@ 2020-12-26 15:13 kernel test robot
0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-12-26 15:13 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 6908 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <5041c8cfc423f046ca9cf4f8f0a8bd03552ab6ea.1608963095.git.syednwaris@gmail.com>
References: <5041c8cfc423f046ca9cf4f8f0a8bd03552ab6ea.1608963095.git.syednwaris@gmail.com>
TO: Syed Nayyar Waris <syednwaris@gmail.com>
Hi Syed,
I love your patch! Perhaps something to improve:
[auto build test WARNING on bbe2ba04c5a92a49db8a42c850a5a2f6481e47eb]
url: https://github.com/0day-ci/linux/commits/Syed-Nayyar-Waris/Introduce-the-for_each_set_clump-macro/20201226-144926
base: bbe2ba04c5a92a49db8a42c850a5a2f6481e47eb
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago
config: mips-randconfig-s032-20201226 (attached as .config)
compiler: mips64-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-184-g1b896707-dirty
# https://github.com/0day-ci/linux/commit/668f2f620cce361abead957de41153c84fbed6c9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Syed-Nayyar-Waris/Introduce-the-for_each_set_clump-macro/20201226-144926
git checkout 668f2f620cce361abead957de41153c84fbed6c9
# 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__' ARCH=mips
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 >>)"
command-line: note: in included file:
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
builtin:0:0: sparse: this was the original definition
drivers/gpio/gpio-xilinx.c: note: in included file:
>> include/../drivers/gpio/clump_bits.h:48:30: sparse: sparse: invalid access past the end of 'new' (8 8)
include/../drivers/gpio/clump_bits.h:49:63: sparse: sparse: shift too big (64) for type unsigned long
vim +/new +48 include/../drivers/gpio/clump_bits.h
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 5
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 6 /**
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 7 * find_next_clump - find next clump with set bits in a memory region
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 8 * @clump: location to store copy of found clump
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 9 * @addr: address to base the search on
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 10 * @size: bitmap size in number of bits
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 11 * @offset: bit offset at which to start searching
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 12 * @clump_size: clump size in bits
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 13 *
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 14 * Returns the bit offset for the next set clump; the found clump value is
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 15 * copied to the location pointed by @clump. If no bits are set, returns @size.
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 16 */
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 17 extern unsigned long find_next_clump(unsigned long *clump,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 18 const unsigned long *addr,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 19 unsigned long size, unsigned long offset,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 20 unsigned long clump_size);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 21
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 22 #define find_first_clump(clump, bits, size, clump_size) \
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 23 find_next_clump((clump), (bits), (size), 0, (clump_size))
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 24
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 25 /**
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 26 * bitmap_get_value - get a value of n-bits from the memory region
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 27 * @map: address to the bitmap memory region
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 28 * @start: bit offset of the n-bit value
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 29 * @nbits: size of value in bits (must be between 1 and BITS_PER_LONG inclusive).
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 30 *
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 31 * Returns value of nbits located at the @start bit offset within the @map
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 32 * memory region.
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 33 */
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 34 static inline unsigned long bitmap_get_value(const unsigned long *map,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 35 unsigned long start,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 36 unsigned long nbits)
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 37 {
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 38 const size_t index = BIT_WORD(start);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 39 const unsigned long offset = start % BITS_PER_LONG;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 40 const unsigned long ceiling = round_up(start + 1, BITS_PER_LONG);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 41 const unsigned long space = ceiling - start;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 42 unsigned long value_low, value_high;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 43
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 44 if (space >= nbits)
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 45 return (map[index] >> offset) & GENMASK(nbits - 1, 0);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 46 else {
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 47 value_low = map[index] & BITMAP_FIRST_WORD_MASK(start);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 @48 value_high = map[index + 1] & BITMAP_LAST_WORD_MASK(start + nbits);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 49 return (value_low >> offset) | (value_high << space);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 50 }
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 51 }
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 52
---
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: 26254 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] gpio: xilinx: Utilize generic bitmap_get_value and _set_value
2020-12-27 21:29 ` Linus Walleij
@ 2021-01-05 11:04 ` Michal Simek
-1 siblings, 0 replies; 10+ messages in thread
From: Michal Simek @ 2021-01-05 11:04 UTC (permalink / raw)
To: Linus Walleij, Syed Nayyar Waris, Srinivas Neeli
Cc: Andy Shevchenko, William Breathitt Gray, Michal Simek,
Arnd Bergmann, Robert Richter, Bartosz Golaszewski,
Masahiro Yamada, Andrew Morton, Zhang Rui, Daniel Lezcano,
(Exiting) Amit Kucheria, Linux-Arch, open list:GPIO SUBSYSTEM,
linux-kernel, Linux ARM, Linux PM list
Hi, +Srinivas,
On 27. 12. 20 22:29, Linus Walleij wrote:
> On Sat, Dec 26, 2020 at 7:44 AM Syed Nayyar Waris <syednwaris@gmail.com> wrote:
>
>> This patch reimplements the xgpio_set_multiple() function in
>> drivers/gpio/gpio-xilinx.c to use the new generic functions:
>> bitmap_get_value() and bitmap_set_value(). The code is now simpler
>> to read and understand. Moreover, instead of looping for each bit
>> in xgpio_set_multiple() function, now we can check each channel at
>> a time and save cycles.
>>
>> Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
>> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>> Cc: Michal Simek <michal.simek@xilinx.com>
>> Signed-off-by: Syed Nayyar Waris <syednwaris@gmail.com>
>
> (...)
>
>> +#include <../drivers/gpio/clump_bits.h>
>
> What is this?
>
> Isn't a simple
>
> #include "clump_bits.h"
>
> enough?
>
> We need an ACK from the Xilinx people that they think this
> actually improves the readability and maintainability of their
> driver.
Srinivas is going to send some patches against this driver. That's why
please take a look if both of these changes are fitting together.
Thanks,
Michal
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] gpio: xilinx: Utilize generic bitmap_get_value and _set_value
@ 2021-01-05 11:04 ` Michal Simek
0 siblings, 0 replies; 10+ messages in thread
From: Michal Simek @ 2021-01-05 11:04 UTC (permalink / raw)
To: Linus Walleij, Syed Nayyar Waris, Srinivas Neeli
Cc: Linux-Arch, (Exiting) Amit Kucheria, Arnd Bergmann,
Masahiro Yamada, linux-kernel, open list:GPIO SUBSYSTEM,
Daniel Lezcano, William Breathitt Gray, Michal Simek,
Bartosz Golaszewski, Robert Richter, Linux PM list,
Andrew Morton, Andy Shevchenko, Zhang Rui, Linux ARM
Hi, +Srinivas,
On 27. 12. 20 22:29, Linus Walleij wrote:
> On Sat, Dec 26, 2020 at 7:44 AM Syed Nayyar Waris <syednwaris@gmail.com> wrote:
>
>> This patch reimplements the xgpio_set_multiple() function in
>> drivers/gpio/gpio-xilinx.c to use the new generic functions:
>> bitmap_get_value() and bitmap_set_value(). The code is now simpler
>> to read and understand. Moreover, instead of looping for each bit
>> in xgpio_set_multiple() function, now we can check each channel at
>> a time and save cycles.
>>
>> Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
>> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>> Cc: Michal Simek <michal.simek@xilinx.com>
>> Signed-off-by: Syed Nayyar Waris <syednwaris@gmail.com>
>
> (...)
>
>> +#include <../drivers/gpio/clump_bits.h>
>
> What is this?
>
> Isn't a simple
>
> #include "clump_bits.h"
>
> enough?
>
> We need an ACK from the Xilinx people that they think this
> actually improves the readability and maintainability of their
> driver.
Srinivas is going to send some patches against this driver. That's why
please take a look if both of these changes are fitting together.
Thanks,
Michal
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] gpio: xilinx: Utilize generic bitmap_get_value and _set_value
2020-12-26 6:44 ` Syed Nayyar Waris
` (2 preceding siblings ...)
(?)
@ 2020-12-29 0:50 ` kernel test robot
-1 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-12-29 0:50 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4791 bytes --]
Hi Syed,
I love your patch! Perhaps something to improve:
[auto build test WARNING on bbe2ba04c5a92a49db8a42c850a5a2f6481e47eb]
url: https://github.com/0day-ci/linux/commits/Syed-Nayyar-Waris/Introduce-the-for_each_set_clump-macro/20201226-144926
base: bbe2ba04c5a92a49db8a42c850a5a2f6481e47eb
:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago
config: i386-randconfig-s002-20201226 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-184-g1b896707-dirty
# https://github.com/0day-ci/linux/commit/668f2f620cce361abead957de41153c84fbed6c9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Syed-Nayyar-Waris/Introduce-the-for_each_set_clump-macro/20201226-144926
git checkout 668f2f620cce361abead957de41153c84fbed6c9
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <rong.a.chen@intel.com>
"sparse warnings: (new ones prefixed by >>)"
drivers/gpio/gpio-xilinx.c: note: in included file:
>> include/../drivers/gpio/clump_bits.h:84:44: sparse: sparse: shift too big (32) for type unsigned long
include/../drivers/gpio/clump_bits.h:49:63: sparse: sparse: shift too big (32) for type unsigned long
vim +84 include/../drivers/gpio/clump_bits.h
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 52
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 53 /**
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 54 * bitmap_set_value - set value within a memory region
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 55 * @map: address to the bitmap memory region
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 56 * @nbits: size of map in bits
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 57 * @value: value of clump
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 58 * @value_width: size of value in bits (must be between 1 and BITS_PER_LONG inclusive)
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 59 * @start: bit offset of the value
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 60 */
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 61 static inline void bitmap_set_value(unsigned long *map, unsigned long nbits,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 62 unsigned long value, unsigned long value_width,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 63 unsigned long start)
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 64 {
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 65 const unsigned long index = BIT_WORD(start);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 66 const unsigned long length = BIT_WORD(nbits);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 67 const unsigned long offset = start % BITS_PER_LONG;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 68 const unsigned long ceiling = round_up(start + 1, BITS_PER_LONG);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 69 const unsigned long space = ceiling - start;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 70
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 71 value &= GENMASK(value_width - 1, 0);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 72
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 73 if (space >= value_width) {
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 74 map[index] &= ~(GENMASK(value_width - 1, 0) << offset);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 75 map[index] |= value << offset;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 76 } else {
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 77 map[index + 0] &= ~BITMAP_FIRST_WORD_MASK(start);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 78 map[index + 0] |= value << offset;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 79
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 80 if (index + 1 >= length)
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 81 __builtin_unreachable();
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 82
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 83 map[index + 1] &= ~BITMAP_LAST_WORD_MASK(start + value_width);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 @84 map[index + 1] |= value >> space;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 85 }
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 86 }
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 87
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32854 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] gpio: xilinx: Utilize generic bitmap_get_value and _set_value
2020-12-26 6:44 ` Syed Nayyar Waris
(?)
(?)
@ 2020-12-29 0:50 ` kernel test robot
-1 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-12-29 0:50 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 6810 bytes --]
Hi Syed,
I love your patch! Perhaps something to improve:
[auto build test WARNING on bbe2ba04c5a92a49db8a42c850a5a2f6481e47eb]
url: https://github.com/0day-ci/linux/commits/Syed-Nayyar-Waris/Introduce-the-for_each_set_clump-macro/20201226-144926
base: bbe2ba04c5a92a49db8a42c850a5a2f6481e47eb
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago
config: mips-randconfig-s032-20201226 (attached as .config)
compiler: mips64-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-184-g1b896707-dirty
# https://github.com/0day-ci/linux/commit/668f2f620cce361abead957de41153c84fbed6c9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Syed-Nayyar-Waris/Introduce-the-for_each_set_clump-macro/20201226-144926
git checkout 668f2f620cce361abead957de41153c84fbed6c9
# 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__' ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <rong.a.chen@intel.com>
"sparse warnings: (new ones prefixed by >>)"
command-line: note: in included file:
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
builtin:0:0: sparse: this was the original definition
drivers/gpio/gpio-xilinx.c: note: in included file:
>> include/../drivers/gpio/clump_bits.h:48:30: sparse: sparse: invalid access past the end of 'new' (8 8)
include/../drivers/gpio/clump_bits.h:49:63: sparse: sparse: shift too big (64) for type unsigned long
vim +/new +48 include/../drivers/gpio/clump_bits.h
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 5
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 6 /**
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 7 * find_next_clump - find next clump with set bits in a memory region
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 8 * @clump: location to store copy of found clump
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 9 * @addr: address to base the search on
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 10 * @size: bitmap size in number of bits
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 11 * @offset: bit offset at which to start searching
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 12 * @clump_size: clump size in bits
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 13 *
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 14 * Returns the bit offset for the next set clump; the found clump value is
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 15 * copied to the location pointed by @clump. If no bits are set, returns @size.
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 16 */
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 17 extern unsigned long find_next_clump(unsigned long *clump,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 18 const unsigned long *addr,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 19 unsigned long size, unsigned long offset,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 20 unsigned long clump_size);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 21
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 22 #define find_first_clump(clump, bits, size, clump_size) \
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 23 find_next_clump((clump), (bits), (size), 0, (clump_size))
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 24
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 25 /**
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 26 * bitmap_get_value - get a value of n-bits from the memory region
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 27 * @map: address to the bitmap memory region
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 28 * @start: bit offset of the n-bit value
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 29 * @nbits: size of value in bits (must be between 1 and BITS_PER_LONG inclusive).
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 30 *
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 31 * Returns value of nbits located at the @start bit offset within the @map
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 32 * memory region.
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 33 */
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 34 static inline unsigned long bitmap_get_value(const unsigned long *map,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 35 unsigned long start,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 36 unsigned long nbits)
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 37 {
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 38 const size_t index = BIT_WORD(start);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 39 const unsigned long offset = start % BITS_PER_LONG;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 40 const unsigned long ceiling = round_up(start + 1, BITS_PER_LONG);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 41 const unsigned long space = ceiling - start;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 42 unsigned long value_low, value_high;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 43
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 44 if (space >= nbits)
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 45 return (map[index] >> offset) & GENMASK(nbits - 1, 0);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 46 else {
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 47 value_low = map[index] & BITMAP_FIRST_WORD_MASK(start);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 @48 value_high = map[index + 1] & BITMAP_LAST_WORD_MASK(start + nbits);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 49 return (value_low >> offset) | (value_high << space);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 50 }
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 51 }
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 52
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26254 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] gpio: xilinx: Utilize generic bitmap_get_value and _set_value
2020-12-26 6:44 ` Syed Nayyar Waris
@ 2020-12-27 21:29 ` Linus Walleij
-1 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2020-12-27 21:29 UTC (permalink / raw)
To: Syed Nayyar Waris
Cc: Andy Shevchenko, William Breathitt Gray, Michal Simek,
Arnd Bergmann, Robert Richter, Bartosz Golaszewski,
Masahiro Yamada, Andrew Morton, Zhang Rui, Daniel Lezcano,
(Exiting) Amit Kucheria, Linux-Arch, open list:GPIO SUBSYSTEM,
linux-kernel, Linux ARM, Linux PM list
On Sat, Dec 26, 2020 at 7:44 AM Syed Nayyar Waris <syednwaris@gmail.com> wrote:
> This patch reimplements the xgpio_set_multiple() function in
> drivers/gpio/gpio-xilinx.c to use the new generic functions:
> bitmap_get_value() and bitmap_set_value(). The code is now simpler
> to read and understand. Moreover, instead of looping for each bit
> in xgpio_set_multiple() function, now we can check each channel at
> a time and save cycles.
>
> Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Syed Nayyar Waris <syednwaris@gmail.com>
(...)
> +#include <../drivers/gpio/clump_bits.h>
What is this?
Isn't a simple
#include "clump_bits.h"
enough?
We need an ACK from the Xilinx people that they think this
actually improves the readability and maintainability of their
driver.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] gpio: xilinx: Utilize generic bitmap_get_value and _set_value
@ 2020-12-27 21:29 ` Linus Walleij
0 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2020-12-27 21:29 UTC (permalink / raw)
To: Syed Nayyar Waris
Cc: Linux-Arch, (Exiting) Amit Kucheria, Arnd Bergmann,
Masahiro Yamada, linux-kernel, open list:GPIO SUBSYSTEM,
Daniel Lezcano, William Breathitt Gray, Michal Simek,
Bartosz Golaszewski, Robert Richter, Linux PM list,
Andrew Morton, Andy Shevchenko, Zhang Rui, Linux ARM
On Sat, Dec 26, 2020 at 7:44 AM Syed Nayyar Waris <syednwaris@gmail.com> wrote:
> This patch reimplements the xgpio_set_multiple() function in
> drivers/gpio/gpio-xilinx.c to use the new generic functions:
> bitmap_get_value() and bitmap_set_value(). The code is now simpler
> to read and understand. Moreover, instead of looping for each bit
> in xgpio_set_multiple() function, now we can check each channel at
> a time and save cycles.
>
> Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Syed Nayyar Waris <syednwaris@gmail.com>
(...)
> +#include <../drivers/gpio/clump_bits.h>
What is this?
Isn't a simple
#include "clump_bits.h"
enough?
We need an ACK from the Xilinx people that they think this
actually improves the readability and maintainability of their
driver.
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/5] gpio: xilinx: Utilize generic bitmap_get_value and _set_value
@ 2020-12-26 15:24 kernel test robot
0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2020-12-26 15:24 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4889 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <5041c8cfc423f046ca9cf4f8f0a8bd03552ab6ea.1608963095.git.syednwaris@gmail.com>
References: <5041c8cfc423f046ca9cf4f8f0a8bd03552ab6ea.1608963095.git.syednwaris@gmail.com>
TO: Syed Nayyar Waris <syednwaris@gmail.com>
Hi Syed,
I love your patch! Perhaps something to improve:
[auto build test WARNING on bbe2ba04c5a92a49db8a42c850a5a2f6481e47eb]
url: https://github.com/0day-ci/linux/commits/Syed-Nayyar-Waris/Introduce-the-for_each_set_clump-macro/20201226-144926
base: bbe2ba04c5a92a49db8a42c850a5a2f6481e47eb
:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago
config: i386-randconfig-s002-20201226 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-184-g1b896707-dirty
# https://github.com/0day-ci/linux/commit/668f2f620cce361abead957de41153c84fbed6c9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Syed-Nayyar-Waris/Introduce-the-for_each_set_clump-macro/20201226-144926
git checkout 668f2f620cce361abead957de41153c84fbed6c9
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
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/gpio-xilinx.c: note: in included file:
>> include/../drivers/gpio/clump_bits.h:84:44: sparse: sparse: shift too big (32) for type unsigned long
include/../drivers/gpio/clump_bits.h:49:63: sparse: sparse: shift too big (32) for type unsigned long
vim +84 include/../drivers/gpio/clump_bits.h
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 52
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 53 /**
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 54 * bitmap_set_value - set value within a memory region
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 55 * @map: address to the bitmap memory region
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 56 * @nbits: size of map in bits
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 57 * @value: value of clump
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 58 * @value_width: size of value in bits (must be between 1 and BITS_PER_LONG inclusive)
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 59 * @start: bit offset of the value
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 60 */
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 61 static inline void bitmap_set_value(unsigned long *map, unsigned long nbits,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 62 unsigned long value, unsigned long value_width,
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 63 unsigned long start)
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 64 {
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 65 const unsigned long index = BIT_WORD(start);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 66 const unsigned long length = BIT_WORD(nbits);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 67 const unsigned long offset = start % BITS_PER_LONG;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 68 const unsigned long ceiling = round_up(start + 1, BITS_PER_LONG);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 69 const unsigned long space = ceiling - start;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 70
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 71 value &= GENMASK(value_width - 1, 0);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 72
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 73 if (space >= value_width) {
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 74 map[index] &= ~(GENMASK(value_width - 1, 0) << offset);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 75 map[index] |= value << offset;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 76 } else {
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 77 map[index + 0] &= ~BITMAP_FIRST_WORD_MASK(start);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 78 map[index + 0] |= value << offset;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 79
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 80 if (index + 1 >= length)
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 81 __builtin_unreachable();
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 82
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 83 map[index + 1] &= ~BITMAP_LAST_WORD_MASK(start + value_width);
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 @84 map[index + 1] |= value >> space;
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 85 }
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 86 }
d14f564f0d6c963 Syed Nayyar Waris 2020-12-26 87
---
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: 32854 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/5] gpio: xilinx: Utilize generic bitmap_get_value and _set_value
2020-12-26 6:41 [PATCH 0/5] Introduce the for_each_set_clump macro Syed Nayyar Waris
@ 2020-12-26 6:44 ` Syed Nayyar Waris
0 siblings, 0 replies; 10+ messages in thread
From: Syed Nayyar Waris @ 2020-12-26 6:44 UTC (permalink / raw)
To: linus.walleij
Cc: andriy.shevchenko, vilhelm.gray, michal.simek, arnd, rrichter,
linus.walleij, bgolaszewski, yamada.masahiro, akpm, rui.zhang,
daniel.lezcano, amit.kucheria, linux-arch, linux-gpio,
linux-kernel, linux-arm-kernel, linux-pm
This patch reimplements the xgpio_set_multiple() function in
drivers/gpio/gpio-xilinx.c to use the new generic functions:
bitmap_get_value() and bitmap_set_value(). The code is now simpler
to read and understand. Moreover, instead of looping for each bit
in xgpio_set_multiple() function, now we can check each channel at
a time and save cycles.
Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Syed Nayyar Waris <syednwaris@gmail.com>
---
drivers/gpio/gpio-xilinx.c | 66 +++++++++++++++++++-------------------
1 file changed, 33 insertions(+), 33 deletions(-)
diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
index 67f9f82e0db0..d565fbf128b7 100644
--- a/drivers/gpio/gpio-xilinx.c
+++ b/drivers/gpio/gpio-xilinx.c
@@ -14,6 +14,7 @@
#include <linux/io.h>
#include <linux/gpio/driver.h>
#include <linux/slab.h>
+#include <../drivers/gpio/clump_bits.h>
/* Register Offset Definitions */
#define XGPIO_DATA_OFFSET (0x0) /* Data register */
@@ -138,37 +139,37 @@ static void xgpio_set_multiple(struct gpio_chip *gc, unsigned long *mask,
{
unsigned long flags;
struct xgpio_instance *chip = gpiochip_get_data(gc);
- int index = xgpio_index(chip, 0);
- int offset, i;
-
- spin_lock_irqsave(&chip->gpio_lock[index], flags);
-
- /* Write to GPIO signals */
- for (i = 0; i < gc->ngpio; i++) {
- if (*mask == 0)
- break;
- /* Once finished with an index write it out to the register */
- if (index != xgpio_index(chip, i)) {
- xgpio_writereg(chip->regs + XGPIO_DATA_OFFSET +
- index * XGPIO_CHANNEL_OFFSET,
- chip->gpio_state[index]);
- spin_unlock_irqrestore(&chip->gpio_lock[index], flags);
- index = xgpio_index(chip, i);
- spin_lock_irqsave(&chip->gpio_lock[index], flags);
- }
- if (__test_and_clear_bit(i, mask)) {
- offset = xgpio_offset(chip, i);
- if (test_bit(i, bits))
- chip->gpio_state[index] |= BIT(offset);
- else
- chip->gpio_state[index] &= ~BIT(offset);
- }
- }
-
- xgpio_writereg(chip->regs + XGPIO_DATA_OFFSET +
- index * XGPIO_CHANNEL_OFFSET, chip->gpio_state[index]);
-
- spin_unlock_irqrestore(&chip->gpio_lock[index], flags);
+ u32 *const state = chip->gpio_state;
+ unsigned int *const width = chip->gpio_width;
+
+ DECLARE_BITMAP(old, 64);
+ DECLARE_BITMAP(new, 64);
+ DECLARE_BITMAP(changed, 64);
+
+ spin_lock_irqsave(&chip->gpio_lock[0], flags);
+ spin_lock(&chip->gpio_lock[1]);
+
+ bitmap_set_value(old, 64, state[0], width[0], 0);
+ bitmap_set_value(old, 64, state[1], width[1], width[0]);
+ bitmap_replace(new, old, bits, mask, gc->ngpio);
+
+ bitmap_set_value(old, 64, state[0], 32, 0);
+ bitmap_set_value(old, 64, state[1], 32, 32);
+ state[0] = bitmap_get_value(new, 0, width[0]);
+ state[1] = bitmap_get_value(new, width[0], width[1]);
+ bitmap_set_value(new, 64, state[0], 32, 0);
+ bitmap_set_value(new, 64, state[1], 32, 32);
+ bitmap_xor(changed, old, new, 64);
+
+ if (((u32 *)changed)[0])
+ xgpio_writereg(chip->regs + XGPIO_DATA_OFFSET,
+ state[0]);
+ if (((u32 *)changed)[1])
+ xgpio_writereg(chip->regs + XGPIO_DATA_OFFSET +
+ XGPIO_CHANNEL_OFFSET, state[1]);
+
+ spin_unlock(&chip->gpio_lock[1]);
+ spin_unlock_irqrestore(&chip->gpio_lock[0], flags);
}
/**
@@ -292,6 +293,7 @@ static int xgpio_probe(struct platform_device *pdev)
chip->gpio_width[0] = 32;
spin_lock_init(&chip->gpio_lock[0]);
+ spin_lock_init(&chip->gpio_lock[1]);
if (of_property_read_u32(np, "xlnx,is-dual", &is_dual))
is_dual = 0;
@@ -313,8 +315,6 @@ static int xgpio_probe(struct platform_device *pdev)
if (of_property_read_u32(np, "xlnx,gpio2-width",
&chip->gpio_width[1]))
chip->gpio_width[1] = 32;
-
- spin_lock_init(&chip->gpio_lock[1]);
}
chip->gc.base = -1;
--
2.29.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/5] gpio: xilinx: Utilize generic bitmap_get_value and _set_value
@ 2020-12-26 6:44 ` Syed Nayyar Waris
0 siblings, 0 replies; 10+ messages in thread
From: Syed Nayyar Waris @ 2020-12-26 6:44 UTC (permalink / raw)
To: linus.walleij
Cc: linux-arch, amit.kucheria, arnd, yamada.masahiro, linux-kernel,
linus.walleij, daniel.lezcano, vilhelm.gray, michal.simek,
bgolaszewski, rrichter, linux-gpio, linux-pm, akpm,
andriy.shevchenko, rui.zhang, linux-arm-kernel
This patch reimplements the xgpio_set_multiple() function in
drivers/gpio/gpio-xilinx.c to use the new generic functions:
bitmap_get_value() and bitmap_set_value(). The code is now simpler
to read and understand. Moreover, instead of looping for each bit
in xgpio_set_multiple() function, now we can check each channel at
a time and save cycles.
Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Syed Nayyar Waris <syednwaris@gmail.com>
---
drivers/gpio/gpio-xilinx.c | 66 +++++++++++++++++++-------------------
1 file changed, 33 insertions(+), 33 deletions(-)
diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
index 67f9f82e0db0..d565fbf128b7 100644
--- a/drivers/gpio/gpio-xilinx.c
+++ b/drivers/gpio/gpio-xilinx.c
@@ -14,6 +14,7 @@
#include <linux/io.h>
#include <linux/gpio/driver.h>
#include <linux/slab.h>
+#include <../drivers/gpio/clump_bits.h>
/* Register Offset Definitions */
#define XGPIO_DATA_OFFSET (0x0) /* Data register */
@@ -138,37 +139,37 @@ static void xgpio_set_multiple(struct gpio_chip *gc, unsigned long *mask,
{
unsigned long flags;
struct xgpio_instance *chip = gpiochip_get_data(gc);
- int index = xgpio_index(chip, 0);
- int offset, i;
-
- spin_lock_irqsave(&chip->gpio_lock[index], flags);
-
- /* Write to GPIO signals */
- for (i = 0; i < gc->ngpio; i++) {
- if (*mask == 0)
- break;
- /* Once finished with an index write it out to the register */
- if (index != xgpio_index(chip, i)) {
- xgpio_writereg(chip->regs + XGPIO_DATA_OFFSET +
- index * XGPIO_CHANNEL_OFFSET,
- chip->gpio_state[index]);
- spin_unlock_irqrestore(&chip->gpio_lock[index], flags);
- index = xgpio_index(chip, i);
- spin_lock_irqsave(&chip->gpio_lock[index], flags);
- }
- if (__test_and_clear_bit(i, mask)) {
- offset = xgpio_offset(chip, i);
- if (test_bit(i, bits))
- chip->gpio_state[index] |= BIT(offset);
- else
- chip->gpio_state[index] &= ~BIT(offset);
- }
- }
-
- xgpio_writereg(chip->regs + XGPIO_DATA_OFFSET +
- index * XGPIO_CHANNEL_OFFSET, chip->gpio_state[index]);
-
- spin_unlock_irqrestore(&chip->gpio_lock[index], flags);
+ u32 *const state = chip->gpio_state;
+ unsigned int *const width = chip->gpio_width;
+
+ DECLARE_BITMAP(old, 64);
+ DECLARE_BITMAP(new, 64);
+ DECLARE_BITMAP(changed, 64);
+
+ spin_lock_irqsave(&chip->gpio_lock[0], flags);
+ spin_lock(&chip->gpio_lock[1]);
+
+ bitmap_set_value(old, 64, state[0], width[0], 0);
+ bitmap_set_value(old, 64, state[1], width[1], width[0]);
+ bitmap_replace(new, old, bits, mask, gc->ngpio);
+
+ bitmap_set_value(old, 64, state[0], 32, 0);
+ bitmap_set_value(old, 64, state[1], 32, 32);
+ state[0] = bitmap_get_value(new, 0, width[0]);
+ state[1] = bitmap_get_value(new, width[0], width[1]);
+ bitmap_set_value(new, 64, state[0], 32, 0);
+ bitmap_set_value(new, 64, state[1], 32, 32);
+ bitmap_xor(changed, old, new, 64);
+
+ if (((u32 *)changed)[0])
+ xgpio_writereg(chip->regs + XGPIO_DATA_OFFSET,
+ state[0]);
+ if (((u32 *)changed)[1])
+ xgpio_writereg(chip->regs + XGPIO_DATA_OFFSET +
+ XGPIO_CHANNEL_OFFSET, state[1]);
+
+ spin_unlock(&chip->gpio_lock[1]);
+ spin_unlock_irqrestore(&chip->gpio_lock[0], flags);
}
/**
@@ -292,6 +293,7 @@ static int xgpio_probe(struct platform_device *pdev)
chip->gpio_width[0] = 32;
spin_lock_init(&chip->gpio_lock[0]);
+ spin_lock_init(&chip->gpio_lock[1]);
if (of_property_read_u32(np, "xlnx,is-dual", &is_dual))
is_dual = 0;
@@ -313,8 +315,6 @@ static int xgpio_probe(struct platform_device *pdev)
if (of_property_read_u32(np, "xlnx,gpio2-width",
&chip->gpio_width[1]))
chip->gpio_width[1] = 32;
-
- spin_lock_init(&chip->gpio_lock[1]);
}
chip->gc.base = -1;
--
2.29.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-01-05 11:06 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-26 15:13 [PATCH 4/5] gpio: xilinx: Utilize generic bitmap_get_value and _set_value kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2020-12-26 15:24 kernel test robot
2020-12-26 6:41 [PATCH 0/5] Introduce the for_each_set_clump macro Syed Nayyar Waris
2020-12-26 6:44 ` [PATCH 4/5] gpio: xilinx: Utilize generic bitmap_get_value and _set_value Syed Nayyar Waris
2020-12-26 6:44 ` Syed Nayyar Waris
2020-12-27 21:29 ` Linus Walleij
2020-12-27 21:29 ` Linus Walleij
2021-01-05 11:04 ` Michal Simek
2021-01-05 11:04 ` Michal Simek
2020-12-29 0:50 ` kernel test robot
2020-12-29 0:50 ` 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.