lkml.org 
[lkml]   [2018]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] gpio: mockup: use irq_sim_fire_edge()
Date
From: Bartosz Golaszewski <bgolaszewski@baylibre.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@baylibre.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);

return size;
}
--
2.19.1
\
 
 \ /
  Last update: 2018-11-20 14:41    [W:0.187 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site