When ones changes the state of any input pins of a PCA9555 chip before setting up the IRQ mask through i.e. SysFS e.g. echo "both" > /sys/class/gpio/gpioXYZ/edge the epoll_wait shall not exit on the subsequent change of the GPIO state. The reason behind i
diff mbox series

Message ID 20190530211832.23889-1-tomasz.motyl@se.com
State New
Headers show
Series
  • When ones changes the state of any input pins of a PCA9555 chip before setting up the IRQ mask through i.e. SysFS e.g. echo "both" > /sys/class/gpio/gpioXYZ/edge the epoll_wait shall not exit on the subsequent change of the GPIO state. The reason behind i
Related show

Commit Message

Tomasz Kazimierz Motyl May 30, 2019, 9:18 p.m. UTC
---
 drivers/gpio/gpio-pca953x.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Bartosz Golaszewski May 31, 2019, 6:46 a.m. UTC | #1
czw., 30 maj 2019 o 23:18 Tomasz Kazimierz Motyl
<tomasz.motyl666@gmail.com> napisaƂ(a):
>
> ---
>  drivers/gpio/gpio-pca953x.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index 7e76830b3368..088bef902156 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -716,13 +716,16 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, u8 *pending)
>                 trigger[i] = (cur_stat[i] ^ old_stat[i]) & chip->irq_mask[i];
>                 if (trigger[i])
>                         trigger_seen = true;
> +
> +    /* We want the current status recorded in the chip->irq stat regardless the
> +     * chip->irq_mask setting in order to have a change detected when the interrupt
> +     * mask gets changed i.e. echo "both" > /sys/class/gpioXYZ/edge */
> +    chip->irq_stat[i] = cur_stat[i];
>         }
>
>         if (!trigger_seen)
>                 return false;
>
> -       memcpy(chip->irq_stat, cur_stat, NBANK(chip));
> -
>         for (i = 0; i < NBANK(chip); i++) {
>                 pending[i] = (old_stat[i] & chip->irq_trig_fall[i]) |
>                         (cur_stat[i] & chip->irq_trig_raise[i]);
> --
> 2.17.1
>

Hi Tomasz,

please format your patch correctly. Give it a short summary line in
title (no longer than 75 characters) and put the detailed description
below.

Bart

Patch
diff mbox series

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 7e76830b3368..088bef902156 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -716,13 +716,16 @@  static bool pca953x_irq_pending(struct pca953x_chip *chip, u8 *pending)
 		trigger[i] = (cur_stat[i] ^ old_stat[i]) & chip->irq_mask[i];
 		if (trigger[i])
 			trigger_seen = true;
+
+    /* We want the current status recorded in the chip->irq stat regardless the
+     * chip->irq_mask setting in order to have a change detected when the interrupt
+     * mask gets changed i.e. echo "both" > /sys/class/gpioXYZ/edge */
+    chip->irq_stat[i] = cur_stat[i];
 	}
 
 	if (!trigger_seen)
 		return false;
 
-	memcpy(chip->irq_stat, cur_stat, NBANK(chip));
-
 	for (i = 0; i < NBANK(chip); i++) {
 		pending[i] = (old_stat[i] & chip->irq_trig_fall[i]) |
 			(cur_stat[i] & chip->irq_trig_raise[i]);