--- /dev/null
+From 53f8d322234649b4d6f1515b20c127a577efd164 Mon Sep 17 00:00:00 2001
+From: Phil Reid <preid@electromag.com.au>
+Date: Tue, 8 Nov 2016 14:00:45 +0800
+Subject: gpio: pca953x: Fix corruption of other gpios in set_multiple.
+
+From: Phil Reid <preid@electromag.com.au>
+
+commit 53f8d322234649b4d6f1515b20c127a577efd164 upstream.
+
+gpiod_set_array_value_complex does not clear the bits field.
+Therefore when the drivers set_multiple funciton is called bits outside
+the mask are undefined and can be either set or not. So bank_val needs
+to be masked with bank_mask before or with the reg_val cache.
+
+Fixes: b4818afeacbd ("gpio: pca953x: Add set_multiple to allow multiple")
+Signed-off-by: Phil Reid <preid@electromag.com.au>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-pca953x.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/gpio/gpio-pca953x.c
++++ b/drivers/gpio/gpio-pca953x.c
+@@ -380,6 +380,7 @@ static void pca953x_gpio_set_multiple(st
+ if(bankmask) {
+ unsigned bankval = bits[bank / sizeof(*bits)] >>
+ ((bank % sizeof(*bits)) * 8);
++ bankval &= bankmask;
+ reg_val[bank] = (reg_val[bank] & ~bankmask) | bankval;
+ }
+ }
--- /dev/null
+From 386377b5473043c09b2de40bfe5abfb0fc87e1b4 Mon Sep 17 00:00:00 2001
+From: Phil Reid <preid@electromag.com.au>
+Date: Tue, 8 Nov 2016 13:18:11 +0800
+Subject: gpio: pca953x: Move memcpy into mutex lock for set multiple
+
+From: Phil Reid <preid@electromag.com.au>
+
+commit 386377b5473043c09b2de40bfe5abfb0fc87e1b4 upstream.
+
+Need to ensure that reg_output is not updated while setting multiple
+bits. This makes the mutex locking behaviour for the set_multiple call
+consistent with that of the set_value call.
+
+Fixes: b4818afeacbd ("gpio: pca953x: Add set_multiple to allow multiple")
+Signed-off-by: Phil Reid <preid@electromag.com.au>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-pca953x.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpio/gpio-pca953x.c
++++ b/drivers/gpio/gpio-pca953x.c
+@@ -372,8 +372,8 @@ static void pca953x_gpio_set_multiple(st
+ break;
+ }
+
+- memcpy(reg_val, chip->reg_output, NBANK(chip));
+ mutex_lock(&chip->i2c_lock);
++ memcpy(reg_val, chip->reg_output, NBANK(chip));
+ for(bank=0; bank<NBANK(chip); bank++) {
+ unsigned bankmask = mask[bank / sizeof(*mask)] >>
+ ((bank % sizeof(*mask)) * 8);
ib-uverbs-fix-leak-of-xrc-target-qps.patch
ib-cm-mark-stale-cm-id-s-whenever-the-mad-agent-was-unregistered.patch
netfilter-nft_dynset-fix-element-timeout-for-hz-1000.patch
+gpio-pca953x-move-memcpy-into-mutex-lock-for-set-multiple.patch
+gpio-pca953x-fix-corruption-of-other-gpios-in-set_multiple.patch