lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181203110916.eseh2udxvhi4lf3v@pengutronix.de>
Date:   Mon, 3 Dec 2018 12:09:16 +0100
From:   Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
To:     Bartosz Golaszewski <brgl@...ev.pl>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH 2/2] gpio: mockup: use irq_sim_fire_edge()

On Tue, Nov 20, 2018 at 02:40:32PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@...libre.com>
> 
> We now have a specialized variant of irq_sim_fire() - use it in
> gpio-mockup so that we only generate events of types that were
> requested with the LINEEVENT ioctl().
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
> ---
>  drivers/gpio/gpio-mockup.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
> index a4c054cf9c5f..18563d2c7876 100644
> --- a/drivers/gpio/gpio-mockup.c
> +++ b/drivers/gpio/gpio-mockup.c
> @@ -199,7 +199,7 @@ static ssize_t gpio_mockup_event_write(struct file *file,
>  	struct gpio_mockup_chip *chip;
>  	struct seq_file *sfile;
>  	struct gpio_desc *desc;
> -	int rv, val;
> +	int rv, val, edge;
>  
>  	rv = kstrtoint_from_user(usr_buf, size, 0, &val);
>  	if (rv)
> @@ -213,7 +213,8 @@ static ssize_t gpio_mockup_event_write(struct file *file,
>  	chip = priv->chip;
>  
>  	gpiod_set_value_cansleep(desc, val);
> -	irq_sim_fire(&chip->irqsim, priv->offset);
> +	edge = val == 0 ? IRQ_TYPE_EDGE_FALLING : IRQ_TYPE_EDGE_RISING;
> +	irq_sim_fire_edge(&chip->irqsim, priv->offset, edge);

If I write 0 twice into the debugfs file, does it fire two irqs or only
one? I think it fires two but only one would be the right behaviour?!

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ