Commit 66d93d7f authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Greg Kroah-Hartman

staging: greybus: Fix the irq API abuse

Nothing outside of low level architecture code is supposed to look up
interrupt descriptors and fiddle with them.

Replace the open coded abuse by calling generic_handle_irq().

This still does not explain why and in which context this connection
magic is injecting interrupts in the first place and why this is correct
and safe, but at least the API abuse is gone.

Fixes: 036aad9d ("greybus: gpio: add interrupt handling support")
Fixes: 2611ebef ("greybus: gpio: don't call irq-flow handler directly")
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarJohan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/87o8t9boqq.fsf@nanos.tec.linutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent add1a2fa
...@@ -364,8 +364,7 @@ static int gb_gpio_request_handler(struct gb_operation *op) ...@@ -364,8 +364,7 @@ static int gb_gpio_request_handler(struct gb_operation *op)
struct gb_message *request; struct gb_message *request;
struct gb_gpio_irq_event_request *event; struct gb_gpio_irq_event_request *event;
u8 type = op->type; u8 type = op->type;
int irq; int irq, ret;
struct irq_desc *desc;
if (type != GB_GPIO_TYPE_IRQ_EVENT) { if (type != GB_GPIO_TYPE_IRQ_EVENT) {
dev_err(dev, "unsupported unsolicited request: %u\n", type); dev_err(dev, "unsupported unsolicited request: %u\n", type);
...@@ -391,17 +390,15 @@ static int gb_gpio_request_handler(struct gb_operation *op) ...@@ -391,17 +390,15 @@ static int gb_gpio_request_handler(struct gb_operation *op)
dev_err(dev, "failed to find IRQ\n"); dev_err(dev, "failed to find IRQ\n");
return -EINVAL; return -EINVAL;
} }
desc = irq_to_desc(irq);
if (!desc) {
dev_err(dev, "failed to look up irq\n");
return -EINVAL;
}
local_irq_disable(); local_irq_disable();
generic_handle_irq_desc(desc); ret = generic_handle_irq(irq);
local_irq_enable(); local_irq_enable();
return 0; if (ret)
dev_err(dev, "failed to invoke irq handler\n");
return ret;
} }
static int gb_gpio_request(struct gpio_chip *chip, unsigned int offset) static int gb_gpio_request(struct gpio_chip *chip, unsigned int offset)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment