* [PATCH 1/1] gpio: pca953x: Move memcpy into mutex lock for set multiple function.
@ 2016-11-08 5:18 Phil Reid
2016-11-08 8:32 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Phil Reid @ 2016-11-08 5:18 UTC (permalink / raw)
To: linus.walleij, gnurou, preid, ben.dooks, yong.b.li, linux-gpio
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.
Signed-off-by: Phil Reid <preid@electromag.com.au>
---
drivers/gpio/gpio-pca953x.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index e422568..b0eb113 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -372,8 +372,8 @@ static void pca953x_gpio_set_multiple(struct gpio_chip *gc,
bank_shift = fls((chip->gpio_chip.ngpio - 1) / BANK_SZ);
- 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++) {
bank_mask = mask[bank / sizeof(*mask)] >>
((bank % sizeof(*mask)) * 8);
@@ -607,7 +607,6 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
if (client->irq && irq_base != -1
&& (chip->driver_data & PCA_INT)) {
-
ret = pca953x_read_regs(chip,
chip->regs->input, chip->irq_stat);
if (ret)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] gpio: pca953x: Move memcpy into mutex lock for set multiple function.
2016-11-08 5:18 [PATCH 1/1] gpio: pca953x: Move memcpy into mutex lock for set multiple function Phil Reid
@ 2016-11-08 8:32 ` Linus Walleij
2016-11-08 9:03 ` Phil Reid
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2016-11-08 8:32 UTC (permalink / raw)
To: Phil Reid; +Cc: Alexandre Courbot, Ben Dooks, Yong Li, linux-gpio
On Tue, Nov 8, 2016 at 6:18 AM, Phil Reid <preid@electromag.com.au> wrote:
> 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.
>
> Signed-off-by: Phil Reid <preid@electromag.com.au>
Patch applied for fixes.
Stable? Fixes:?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] gpio: pca953x: Move memcpy into mutex lock for set multiple function.
2016-11-08 8:32 ` Linus Walleij
@ 2016-11-08 9:03 ` Phil Reid
0 siblings, 0 replies; 3+ messages in thread
From: Phil Reid @ 2016-11-08 9:03 UTC (permalink / raw)
To: Linus Walleij; +Cc: Alexandre Courbot, Ben Dooks, Yong Li, linux-gpio
On 8/11/2016 16:32, Linus Walleij wrote:
> On Tue, Nov 8, 2016 at 6:18 AM, Phil Reid <preid@electromag.com.au> wrote:
>
>> 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.
>>
>> Signed-off-by: Phil Reid <preid@electromag.com.au>
>
> Patch applied for fixes.
>
> Stable? Fixes:?
>
> Yours,
> Linus Walleij
>
>
It looks like it was broken in my original implementation of the set_multiple call.
fixes commit: b4818afeacbd81821f89a89951471cffcb6a65e0
This one is pretty nasty, it should go into stable.
--
Regards
Phil Reid
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-08 9:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08 5:18 [PATCH 1/1] gpio: pca953x: Move memcpy into mutex lock for set multiple function Phil Reid
2016-11-08 8:32 ` Linus Walleij
2016-11-08 9:03 ` Phil Reid
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.