Commit 88fce76c authored by Phil Reid's avatar Phil Reid Committed by Greg Kroah-Hartman

gpio: pca953x: Move memcpy into mutex lock for set multiple

commit 386377b5 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: b4818afe ("gpio: pca953x: Add set_multiple to allow multiple")
Signed-off-by: default avatarPhil Reid <preid@electromag.com.au>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9a7b8089
...@@ -372,8 +372,8 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc, ...@@ -372,8 +372,8 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc,
break; break;
} }
memcpy(reg_val, chip->reg_output, NBANK(chip));
mutex_lock(&chip->i2c_lock); mutex_lock(&chip->i2c_lock);
memcpy(reg_val, chip->reg_output, NBANK(chip));
for(bank=0; bank<NBANK(chip); bank++) { for(bank=0; bank<NBANK(chip); bank++) {
unsigned bankmask = mask[bank / sizeof(*mask)] >> unsigned bankmask = mask[bank / sizeof(*mask)] >>
((bank % sizeof(*mask)) * 8); ((bank % sizeof(*mask)) * 8);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment