The patch titled Subject: gpio: pca953x: reduce stack usage in couple of functions has been added to the -mm tree. Its filename is gpio-pca953x-convert-to-use-bitmap-api-fix.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/gpio-pca953x-convert-to-use-bitmap-api-fix.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/gpio-pca953x-convert-to-use-bitmap-api-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Subject: gpio: pca953x: reduce stack usage in couple of functions Simple bitmap operations are safe against in-place modifications. Due to above we may get rid of temporary variables in some cases. Link: http://lkml.kernel.org/r/20191023153056.64262-1-andriy.shevchenko@xxxxxxxxxxxxxxx Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Cc: William Breathitt Gray <vilhelm.gray@xxxxxxxxx> Cc: Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxx> Cc: Marek Vasut <marek.vasut+renesas@xxxxxxxxx> Cc: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx> Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> Cc: Linus Walleij <linus.walleij@xxxxxxxxxx> Cc: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> Cc: Yury Norov <yury.norov@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/gpio/gpio-pca953x.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/drivers/gpio/gpio-pca953x.c~gpio-pca953x-convert-to-use-bitmap-api-fix +++ a/drivers/gpio/gpio-pca953x.c @@ -466,7 +466,6 @@ static void pca953x_gpio_set_multiple(st { struct pca953x_chip *chip = gpiochip_get_data(gc); DECLARE_BITMAP(reg_val, MAX_LINE); - DECLARE_BITMAP(new_val, MAX_LINE); int ret; mutex_lock(&chip->i2c_lock); @@ -474,9 +473,9 @@ static void pca953x_gpio_set_multiple(st if (ret) goto exit; - bitmap_replace(new_val, reg_val, bits, mask, gc->ngpio); + bitmap_replace(reg_val, reg_val, bits, mask, gc->ngpio); - pca953x_write_regs(chip, chip->regs->output, new_val); + pca953x_write_regs(chip, chip->regs->output, reg_val); exit: mutex_unlock(&chip->i2c_lock); } @@ -603,7 +602,6 @@ static void pca953x_irq_bus_sync_unlock( struct pca953x_chip *chip = gpiochip_get_data(gc); DECLARE_BITMAP(irq_mask, MAX_LINE); DECLARE_BITMAP(reg_direction, MAX_LINE); - DECLARE_BITMAP(new_irqs, MAX_LINE); int level; pca953x_read_regs(chip, chip->regs->direction, reg_direction); @@ -618,8 +616,8 @@ static void pca953x_irq_bus_sync_unlock( pca953x_write_regs(chip, PCAL953X_INT_MASK, irq_mask); } - bitmap_or(new_irqs, chip->irq_trig_fall, chip->irq_trig_raise, gc->ngpio); - bitmap_and(irq_mask, new_irqs, reg_direction, gc->ngpio); + bitmap_or(irq_mask, chip->irq_trig_fall, chip->irq_trig_raise, gc->ngpio); + bitmap_and(irq_mask, irq_mask, reg_direction, gc->ngpio); /* Look for any newly setup interrupt */ for_each_set_bit(level, irq_mask, gc->ngpio) _ Patches currently in -mm which might be from andriy.shevchenko@xxxxxxxxxxxxxxx are lib-test_bitmap-force-argument-of-bitmap_parselist_user-to-proper-address-space.patch lib-test_bitmap-undefine-macros-after-use.patch lib-test_bitmap-name-exp_bytes-properly.patch lib-test_bitmap-rename-exp-to-exp1-to-avoid-ambiguous-name.patch lib-test_bitmap-move-exp1-and-exp2-upper-for-others-to-use.patch lib-test_bitmap-fix-comment-about-this-file.patch bitmap-introduce-bitmap_replace-helper.patch gpio-pca953x-remove-redundant-variable-and-check-in-irq-handler.patch gpio-pca953x-use-input-from-regs-structure-in-pca953x_irq_pending.patch gpio-pca953x-convert-to-use-bitmap-api.patch gpio-pca953x-convert-to-use-bitmap-api-fix.patch gpio-pca953x-tight-up-indentation.patch