Message ID | 20230324140148.479125-2-u.kleine-koenig@pengutronix.de |
---|---|
State | Superseded |
Headers | show |
Series | [1/2] pinctrl: mcp23s08: Rename and change function that wraps regmap_update_bits() | expand |
Hi Uwe, I love your patch! Perhaps something to improve: [auto build test WARNING on fe15c26ee26efa11741a7b632e9f23b01aca4cc6] url: https://github.com/intel-lab-lkp/linux/commits/Uwe-Kleine-K-nig/pinctrl-mcp23s08-Implement-gpio-bulk-functions/20230324-220530 base: fe15c26ee26efa11741a7b632e9f23b01aca4cc6 patch link: https://lore.kernel.org/r/20230324140148.479125-2-u.kleine-koenig%40pengutronix.de patch subject: [PATCH 2/2] pinctrl: mcp23s08: Implement gpio bulk functions config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230325/202303250001.YzK908so-lkp@intel.com/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/0e7980f9275391601f384ff6fe0c4713114f0f0b git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Uwe-Kleine-K-nig/pinctrl-mcp23s08-Implement-gpio-bulk-functions/20230324-220530 git checkout 0e7980f9275391601f384ff6fe0c4713114f0f0b # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=x86_64 olddefconfig make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303250001.YzK908so-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/pinctrl/pinctrl-mcp23s08.c: In function 'mcp23s08_set_multiple': >> drivers/pinctrl/pinctrl-mcp23s08.c:351:13: warning: unused variable 'ret' [-Wunused-variable] 351 | int ret; | ^~~ vim +/ret +351 drivers/pinctrl/pinctrl-mcp23s08.c 346 347 static void mcp23s08_set_multiple(struct gpio_chip *chip, 348 unsigned long *mask, unsigned long *bits) 349 { 350 struct mcp23s08 *mcp = gpiochip_get_data(chip); > 351 int ret; 352 353 mutex_lock(&mcp->lock); 354 mcp_update_bits(mcp, MCP_OLAT, *mask, *bits); 355 mutex_unlock(&mcp->lock); 356 } 357
On Sat, Mar 25, 2023 at 01:05:58AM +0800, kernel test robot wrote: > Hi Uwe, > > I love your patch! Perhaps something to improve: > > [auto build test WARNING on fe15c26ee26efa11741a7b632e9f23b01aca4cc6] > > url: https://github.com/intel-lab-lkp/linux/commits/Uwe-Kleine-K-nig/pinctrl-mcp23s08-Implement-gpio-bulk-functions/20230324-220530 > base: fe15c26ee26efa11741a7b632e9f23b01aca4cc6 > patch link: https://lore.kernel.org/r/20230324140148.479125-2-u.kleine-koenig%40pengutronix.de > patch subject: [PATCH 2/2] pinctrl: mcp23s08: Implement gpio bulk functions > config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230325/202303250001.YzK908so-lkp@intel.com/config) > compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 > reproduce (this is a W=1 build): > # https://github.com/intel-lab-lkp/linux/commit/0e7980f9275391601f384ff6fe0c4713114f0f0b > git remote add linux-review https://github.com/intel-lab-lkp/linux > git fetch --no-tags linux-review Uwe-Kleine-K-nig/pinctrl-mcp23s08-Implement-gpio-bulk-functions/20230324-220530 > git checkout 0e7980f9275391601f384ff6fe0c4713114f0f0b > # save the config file > mkdir build_dir && cp config build_dir/.config > make W=1 O=build_dir ARCH=x86_64 olddefconfig > make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/ > > If you fix the issue, kindly add following tag where applicable > | Reported-by: kernel test robot <lkp@intel.com> > | Link: https://lore.kernel.org/oe-kbuild-all/202303250001.YzK908so-lkp@intel.com/ > > All warnings (new ones prefixed by >>): > > drivers/pinctrl/pinctrl-mcp23s08.c: In function 'mcp23s08_set_multiple': > >> drivers/pinctrl/pinctrl-mcp23s08.c:351:13: warning: unused variable 'ret' [-Wunused-variable] > 351 | int ret; > | ^~~ FTR: I noticed that myself and there is already a v2 on the list that is older than this bot report. Best regards Uwe
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c index 79a41d418482..a447c77c7ebb 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08.c +++ b/drivers/pinctrl/pinctrl-mcp23s08.c @@ -307,6 +307,28 @@ static int mcp23s08_get(struct gpio_chip *chip, unsigned offset) return status; } +static int mcp23s08_get_multiple(struct gpio_chip *chip, + unsigned long *mask, unsigned long *bits) +{ + struct mcp23s08 *mcp = gpiochip_get_data(chip); + unsigned int status; + int ret; + + mutex_lock(&mcp->lock); + + /* REVISIT reading this clears any IRQ ... */ + ret = mcp_read(mcp, MCP_GPIO, &status); + if (ret < 0) + status = 0; + else { + mcp->cached_gpio = status; + *bits = status; + } + + mutex_unlock(&mcp->lock); + return ret; +} + static int __mcp23s08_set(struct mcp23s08 *mcp, unsigned mask, bool value) { return mcp_update_bits(mcp, MCP_OLAT, mask, value ? mask : 0); @@ -322,6 +344,17 @@ static void mcp23s08_set(struct gpio_chip *chip, unsigned offset, int value) mutex_unlock(&mcp->lock); } +static void mcp23s08_set_multiple(struct gpio_chip *chip, + unsigned long *mask, unsigned long *bits) +{ + struct mcp23s08 *mcp = gpiochip_get_data(chip); + int ret; + + mutex_lock(&mcp->lock); + mcp_update_bits(mcp, MCP_OLAT, *mask, *bits); + mutex_unlock(&mcp->lock); +} + static int mcp23s08_direction_output(struct gpio_chip *chip, unsigned offset, int value) { @@ -546,8 +579,10 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, mcp->chip.direction_input = mcp23s08_direction_input; mcp->chip.get = mcp23s08_get; + mcp->chip.get_multiple = mcp23s08_get_multiple; mcp->chip.direction_output = mcp23s08_direction_output; mcp->chip.set = mcp23s08_set; + mcp->chip.set_multiple = mcp23s08_set_multiple; mcp->chip.base = base; mcp->chip.can_sleep = true;
To speed up some usecases implement reading and writing several IO lines at once. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/pinctrl/pinctrl-mcp23s08.c | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)