* [RESEND PATCH 1/3] gpio: max732x: Fix irq-events handler
@ 2015-04-30 17:00 Semen Protsenko
2015-04-30 17:00 ` [RESEND PATCH 2/3] gpio: max732x: Add IRQF_SHARED to irq flags Semen Protsenko
2015-04-30 17:00 ` [RESEND PATCH 3/3] gpio: max732x: Propagate wake-up setting to parent irq controller Semen Protsenko
0 siblings, 2 replies; 3+ messages in thread
From: Semen Protsenko @ 2015-04-30 17:00 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot
Cc: linux-gpio, linux-kernel, Grygorii Strashko
MAX732X clears all pending interrupts on I2C read (when interrupts
register is being read). Driver doesn't need to send any ACKs when
interrupt was handled. So replace handle_edge_irq() with
handle_simple_irq().
Using handle_edge_irq() (w/o .irq_ack callback set) may lead to NULL
pointer dereference in some cases. E.g. this was observed on
hibernation process:
Unable to handle kernel NULL pointer dereference at virtual address 0
Backtrace:
(handle_edge_irq) from (resend_irqs)
(resend_irqs) from (tasklet_action)
(tasklet_action) from (__do_softirq)
(__do_softirq) from (run_ksoftirqd)
(run_ksoftirqd) from (smpboot_thread_fn)
(smpboot_thread_fn) from (kthread)
(kthread) from (ret_from_fork)
Signed-off-by: Semen Protsenko <semen.protsenko@globallogic.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@linaro.org>
---
drivers/gpio/gpio-max732x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 0fa4543..7b6fb68 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -521,7 +521,7 @@ static int max732x_irq_setup(struct max732x_chip *chip,
ret = gpiochip_irqchip_add(&chip->gpio_chip,
&max732x_irq_chip,
irq_base,
- handle_edge_irq,
+ handle_simple_irq,
IRQ_TYPE_NONE);
if (ret) {
dev_err(&client->dev,
--
1.7.9.5
^ permalink raw reply [flat|nested] 3+ messages in thread* [RESEND PATCH 2/3] gpio: max732x: Add IRQF_SHARED to irq flags
2015-04-30 17:00 [RESEND PATCH 1/3] gpio: max732x: Fix irq-events handler Semen Protsenko
@ 2015-04-30 17:00 ` Semen Protsenko
2015-04-30 17:00 ` [RESEND PATCH 3/3] gpio: max732x: Propagate wake-up setting to parent irq controller Semen Protsenko
1 sibling, 0 replies; 3+ messages in thread
From: Semen Protsenko @ 2015-04-30 17:00 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot
Cc: linux-gpio, linux-kernel, Grygorii Strashko
It's possible that multiple MAX732X can be hooked up to the same
interrupt line with the processor. So add IRQF_SHARED in requesting irq.
Signed-off-by: Semen Protsenko <semen.protsenko@globallogic.com>
---
drivers/gpio/gpio-max732x.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 7b6fb68..fafc81b 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -507,12 +507,10 @@ static int max732x_irq_setup(struct max732x_chip *chip,
chip->irq_features = has_irq;
mutex_init(&chip->irq_lock);
- ret = devm_request_threaded_irq(&client->dev,
- client->irq,
- NULL,
- max732x_irq_handler,
- IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
- dev_name(&client->dev), chip);
+ ret = devm_request_threaded_irq(&client->dev, client->irq,
+ NULL, max732x_irq_handler, IRQF_ONESHOT |
+ IRQF_TRIGGER_FALLING | IRQF_SHARED,
+ dev_name(&client->dev), chip);
if (ret) {
dev_err(&client->dev, "failed to request irq %d\n",
client->irq);
--
1.7.9.5
^ permalink raw reply [flat|nested] 3+ messages in thread* [RESEND PATCH 3/3] gpio: max732x: Propagate wake-up setting to parent irq controller
2015-04-30 17:00 [RESEND PATCH 1/3] gpio: max732x: Fix irq-events handler Semen Protsenko
2015-04-30 17:00 ` [RESEND PATCH 2/3] gpio: max732x: Add IRQF_SHARED to irq flags Semen Protsenko
@ 2015-04-30 17:00 ` Semen Protsenko
1 sibling, 0 replies; 3+ messages in thread
From: Semen Protsenko @ 2015-04-30 17:00 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot
Cc: linux-gpio, linux-kernel, Grygorii Strashko
Set .irq_set_wake callback to prevent possible issues on wake-up.
This patch was inspired by this commit:
b80eef95beb04760629822fa130aeed54cdfafca
Signed-off-by: Semen Protsenko <semen.protsenko@globallogic.com>
---
drivers/gpio/gpio-max732x.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index fafc81b..b3c497d 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -429,6 +429,14 @@ static int max732x_irq_set_type(struct irq_data *d, unsigned int type)
return 0;
}
+static int max732x_irq_set_wake(struct irq_data *data, unsigned int on)
+{
+ struct max732x_chip *chip = irq_data_get_irq_chip_data(data);
+
+ irq_set_irq_wake(chip->client->irq, on);
+ return 0;
+}
+
static struct irq_chip max732x_irq_chip = {
.name = "max732x",
.irq_mask = max732x_irq_mask,
@@ -436,6 +444,7 @@ static struct irq_chip max732x_irq_chip = {
.irq_bus_lock = max732x_irq_bus_lock,
.irq_bus_sync_unlock = max732x_irq_bus_sync_unlock,
.irq_set_type = max732x_irq_set_type,
+ .irq_set_wake = max732x_irq_set_wake,
};
static uint8_t max732x_irq_pending(struct max732x_chip *chip)
--
1.7.9.5
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-30 17:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-30 17:00 [RESEND PATCH 1/3] gpio: max732x: Fix irq-events handler Semen Protsenko
2015-04-30 17:00 ` [RESEND PATCH 2/3] gpio: max732x: Add IRQF_SHARED to irq flags Semen Protsenko
2015-04-30 17:00 ` [RESEND PATCH 3/3] gpio: max732x: Propagate wake-up setting to parent irq controller Semen Protsenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®