+ gpio-pca953x-utilize-the-for_each_set_clump8-macro.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: gpio: pca953x: utilize the for_each_set_clump8 macro
has been added to the -mm tree.  Its filename is
     gpio-pca953x-utilize-the-for_each_set_clump8-macro.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/gpio-pca953x-utilize-the-for_each_set_clump8-macro.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/gpio-pca953x-utilize-the-for_each_set_clump8-macro.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: William Breathitt Gray <vilhelm.gray@xxxxxxxxx>
Subject: gpio: pca953x: utilize the for_each_set_clump8 macro

Replace verbose implementation in set_multiple callback with
for_each_set_clump8 macro to simplify code and improve clarity.

Link: http://lkml.kernel.org/r/3543ffc3668ad4ed4c00e8ebaf14a5559fd6ddf2.1570641097.git.vilhelm.gray@xxxxxxxxx
Signed-off-by: William Breathitt Gray <vilhelm.gray@xxxxxxxxx>
Cc: Phil Reid <preid@xxxxxxxxxxxxxxxxx>
Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Cc: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Cc: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
Cc: Lukas Wunner <lukas@xxxxxxxxx>
Cc: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
Cc: Mathias Duckeck <m.duckeck@xxxxxxxxx>
Cc: Morten Hein Tiljeset <morten.tiljeset@xxxxxxxxx>
Cc: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
Cc: Sean Nyekjaer <sean.nyekjaer@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/gpio/gpio-pca953x.c |   17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

--- a/drivers/gpio/gpio-pca953x.c~gpio-pca953x-utilize-the-for_each_set_clump8-macro
+++ a/drivers/gpio/gpio-pca953x.c
@@ -10,6 +10,7 @@
 
 #include <linux/acpi.h>
 #include <linux/bits.h>
+#include <linux/bitops.h>
 #include <linux/gpio/driver.h>
 #include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
@@ -456,7 +457,8 @@ static void pca953x_gpio_set_multiple(st
 				      unsigned long *mask, unsigned long *bits)
 {
 	struct pca953x_chip *chip = gpiochip_get_data(gc);
-	unsigned int bank_mask, bank_val;
+	unsigned long offset;
+	unsigned long bank_mask;
 	int bank;
 	u8 reg_val[MAX_BANK];
 	int ret;
@@ -466,15 +468,10 @@ static void pca953x_gpio_set_multiple(st
 	if (ret)
 		goto exit;
 
-	for (bank = 0; bank < NBANK(chip); bank++) {
-		bank_mask = mask[bank / sizeof(*mask)] >>
-			   ((bank % sizeof(*mask)) * 8);
-		if (bank_mask) {
-			bank_val = bits[bank / sizeof(*bits)] >>
-				  ((bank % sizeof(*bits)) * 8);
-			bank_val &= bank_mask;
-			reg_val[bank] = (reg_val[bank] & ~bank_mask) | bank_val;
-		}
+	for_each_set_clump8(offset, bank_mask, mask, gc->ngpio) {
+		bank = offset / 8;
+		reg_val[bank] &= ~bank_mask;
+		reg_val[bank] |= bitmap_get_value8(bits, offset) & bank_mask;
 	}
 
 	pca953x_write_regs(chip, chip->regs->output, reg_val);
_

Patches currently in -mm which might be from vilhelm.gray@xxxxxxxxx are

bitops-introduce-the-for_each_set_clump8-macro.patch
lib-test_bitmapc-add-for_each_set_clump8-test-cases.patch
gpio-104-dio-48e-utilize-for_each_set_clump8-macro.patch
gpio-104-idi-48-utilize-for_each_set_clump8-macro.patch
gpio-gpio-mm-utilize-for_each_set_clump8-macro.patch
gpio-ws16c48-utilize-for_each_set_clump8-macro.patch
gpio-pci-idio-16-utilize-for_each_set_clump8-macro.patch
gpio-pcie-idio-24-utilize-for_each_set_clump8-macro.patch
gpio-uniphier-utilize-for_each_set_clump8-macro.patch
gpio-74x164-utilize-the-for_each_set_clump8-macro.patch
thermal-intel-intel_soc_dts_iosf-utilize-for_each_set_clump8-macro.patch
gpio-pisosr-utilize-the-for_each_set_clump8-macro.patch
gpio-max3191x-utilize-the-for_each_set_clump8-macro.patch
gpio-pca953x-utilize-the-for_each_set_clump8-macro.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux