summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kiselev <bigunclemax@gmail.com>2021-02-17 16:10:00 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-03 19:44:44 +0300
commit828d937f52d82604dc430ed889b7dfb008c874ad (patch)
tree382c3aea11ca809406ea2be8dc6f4d0815212b9f
parente540571d692c7b3f7efc2d5208585d32753f67d2 (diff)
downloadlinux-828d937f52d82604dc430ed889b7dfb008c874ad.tar.xz
gpio: pcf857x: Fix missing first interrupt
commit a8002a35935aaefcd6a42ad3289f62bab947f2ca upstream. If no n_latch value will be provided at driver probe then all pins will be used as an input: gpio->out = ~n_latch; In that case initial state for all pins is "one": gpio->status = gpio->out; So if pcf857x IRQ happens with change pin value from "zero" to "one" then we miss it, because of "one" from IRQ and "one" from initial state leaves corresponding pin unchanged: change = (gpio->status ^ status) & gpio->irq_enabled; The right solution will be to read actual state at driver probe. Cc: stable@vger.kernel.org Fixes: 6e20a0a429bd ("gpio: pcf857x: enable gpio_to_irq() support") Signed-off-by: Maxim Kiselev <bigunclemax@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpio/gpio-pcf857x.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
index d168410e2338..2e6081e5ad0b 100644
--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -370,7 +370,7 @@ static int pcf857x_probe(struct i2c_client *client,
* reset state. Otherwise it flags pins to be driven low.
*/
gpio->out = ~n_latch;
- gpio->status = gpio->out;
+ gpio->status = gpio->read(gpio->client);
status = devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio);
if (status < 0)