aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-11-18 11:47:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-11-18 11:47:47 -0500
commitbd2bc2b8e63f872f8aa0f3536a40ffce6e1840bb (patch)
tree281452c6a7e19dba44bf4c4e688b44624b4a6bff
parent12b70ec0d3a6eb2696f3c091af6ecac31d2f8e66 (diff)
parentf9c22ec6c1c511285dc539b83aabdabdb6baf245 (diff)
Merge tag 'gpio-v4.9-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO fixes from Linus Walleij: "These are hopefully the last GPIO fixes for v4.9. The most important is that it fixes the UML randconfig builds that have been nagging me for some time and me being confused about where the problem was really sitting, now this fix give this nice feeling that everything is solid and builds fine. Summary: - Finally, after being puzzled by a bunch of recurrent UML build failures on randconfigs from the build robot, Keno Fischer nailed it: GPIO_DEVRES is optional and depends on HAS_IOMEM even though many users just unconditionally rely on it to be available. And it *should* be available: garbage collection is nice for this and it *certainly* has nothing to do with having IOMEM. So we got rid of it, and now the UML builds should JustWork(TM). - Do not call .get_direction() on sleeping GPIO chips on the fastpath when locking GPIOs for interrupts: it is done from atomic context, no way. - Some driver fixes" * tag 'gpio-v4.9-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpio: Remove GPIO_DEVRES option gpio: tc3589x: fix up .get_direction() gpio: do not double-check direction on sleeping chips gpio: pca953x: Move memcpy into mutex lock for set multiple gpio: pca953x: Fix corruption of other gpios in set_multiple.
-rw-r--r--drivers/gpio/Kconfig4
-rw-r--r--drivers/gpio/Makefile2
-rw-r--r--drivers/gpio/gpio-pca953x.c4
-rw-r--r--drivers/gpio/gpio-tc3589x.c2
-rw-r--r--drivers/gpio/gpiolib.c7
5 files changed, 9 insertions, 10 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index d011cb89d25e..ed37e5908b91 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -22,10 +22,6 @@ menuconfig GPIOLIB
22 22
23if GPIOLIB 23if GPIOLIB
24 24
25config GPIO_DEVRES
26 def_bool y
27 depends on HAS_IOMEM
28
29config OF_GPIO 25config OF_GPIO
30 def_bool y 26 def_bool y
31 depends on OF 27 depends on OF
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index ab28a2daeacc..d074c2299393 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -2,7 +2,7 @@
2 2
3ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG 3ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG
4 4
5obj-$(CONFIG_GPIO_DEVRES) += devres.o 5obj-$(CONFIG_GPIOLIB) += devres.o
6obj-$(CONFIG_GPIOLIB) += gpiolib.o 6obj-$(CONFIG_GPIOLIB) += gpiolib.o
7obj-$(CONFIG_GPIOLIB) += gpiolib-legacy.o 7obj-$(CONFIG_GPIOLIB) += gpiolib-legacy.o
8obj-$(CONFIG_OF_GPIO) += gpiolib-of.o 8obj-$(CONFIG_OF_GPIO) += gpiolib-of.o
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index e422568e14ad..fe731f094257 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -372,14 +372,15 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc,
372 372
373 bank_shift = fls((chip->gpio_chip.ngpio - 1) / BANK_SZ); 373 bank_shift = fls((chip->gpio_chip.ngpio - 1) / BANK_SZ);
374 374
375 memcpy(reg_val, chip->reg_output, NBANK(chip));
376 mutex_lock(&chip->i2c_lock); 375 mutex_lock(&chip->i2c_lock);
376 memcpy(reg_val, chip->reg_output, NBANK(chip));
377 for (bank = 0; bank < NBANK(chip); bank++) { 377 for (bank = 0; bank < NBANK(chip); bank++) {
378 bank_mask = mask[bank / sizeof(*mask)] >> 378 bank_mask = mask[bank / sizeof(*mask)] >>
379 ((bank % sizeof(*mask)) * 8); 379 ((bank % sizeof(*mask)) * 8);
380 if (bank_mask) { 380 if (bank_mask) {
381 bank_val = bits[bank / sizeof(*bits)] >> 381 bank_val = bits[bank / sizeof(*bits)] >>
382 ((bank % sizeof(*bits)) * 8); 382 ((bank % sizeof(*bits)) * 8);
383 bank_val &= bank_mask;
383 reg_val[bank] = (reg_val[bank] & ~bank_mask) | bank_val; 384 reg_val[bank] = (reg_val[bank] & ~bank_mask) | bank_val;
384 } 385 }
385 } 386 }
@@ -607,7 +608,6 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
607 608
608 if (client->irq && irq_base != -1 609 if (client->irq && irq_base != -1
609 && (chip->driver_data & PCA_INT)) { 610 && (chip->driver_data & PCA_INT)) {
610
611 ret = pca953x_read_regs(chip, 611 ret = pca953x_read_regs(chip,
612 chip->regs->input, chip->irq_stat); 612 chip->regs->input, chip->irq_stat);
613 if (ret) 613 if (ret)
diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
index 5a5a6cb00eea..d6e21f1a70a9 100644
--- a/drivers/gpio/gpio-tc3589x.c
+++ b/drivers/gpio/gpio-tc3589x.c
@@ -97,7 +97,7 @@ static int tc3589x_gpio_get_direction(struct gpio_chip *chip,
97 if (ret < 0) 97 if (ret < 0)
98 return ret; 98 return ret;
99 99
100 return !!(ret & BIT(pos)); 100 return !(ret & BIT(pos));
101} 101}
102 102
103static int tc3589x_gpio_set_single_ended(struct gpio_chip *chip, 103static int tc3589x_gpio_set_single_ended(struct gpio_chip *chip,
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 93ed0e00c578..868128a676ba 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2737,8 +2737,11 @@ int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
2737 if (IS_ERR(desc)) 2737 if (IS_ERR(desc))
2738 return PTR_ERR(desc); 2738 return PTR_ERR(desc);
2739 2739
2740 /* Flush direction if something changed behind our back */ 2740 /*
2741 if (chip->get_direction) { 2741 * If it's fast: flush the direction setting if something changed
2742 * behind our back
2743 */
2744 if (!chip->can_sleep && chip->get_direction) {
2742 int dir = chip->get_direction(chip, offset); 2745 int dir = chip->get_direction(chip, offset);
2743 2746
2744 if (dir) 2747 if (dir)