* [PATCH] Input: matrix_keypad - make driver useable with GPIO drivers requiring threaded irqs
@ 2014-09-09 8:33 Lothar Waßmann
2014-09-09 21:42 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Lothar Waßmann @ 2014-09-09 8:33 UTC (permalink / raw)
To: linux-input
Cc: linux-kernel, Dmitry Torokhov, Paul Gortmaker,
Lothar Waßmann
When trying to use the matrix-keypad driver with GPIO drivers that
require nested irq handlers (e.g. I2C GPIO adapters like PCA9554),
request_irq() fails because the GPIO driver requires a threaded
interrupt handler.
Use request_any_context_irq() to be able to use any GPIO driver as
keypad driver.
Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
drivers/input/keyboard/matrix_keypad.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 8d2e19e..e651fa6 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -332,23 +332,24 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev,
}
if (pdata->clustered_irq > 0) {
- err = request_irq(pdata->clustered_irq,
+ err = request_any_context_irq(pdata->clustered_irq,
matrix_keypad_interrupt,
pdata->clustered_irq_flags,
"matrix-keypad", keypad);
- if (err) {
+ if (err < 0) {
dev_err(&pdev->dev,
"Unable to acquire clustered interrupt\n");
goto err_free_rows;
}
} else {
for (i = 0; i < pdata->num_row_gpios; i++) {
- err = request_irq(gpio_to_irq(pdata->row_gpios[i]),
+ err = request_any_context_irq(
+ gpio_to_irq(pdata->row_gpios[i]),
matrix_keypad_interrupt,
IRQF_TRIGGER_RISING |
IRQF_TRIGGER_FALLING,
"matrix-keypad", keypad);
- if (err) {
+ if (err < 0) {
dev_err(&pdev->dev,
"Unable to acquire interrupt for GPIO line %i\n",
pdata->row_gpios[i]);
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: matrix_keypad - make driver useable with GPIO drivers requiring threaded irqs
2014-09-09 8:33 [PATCH] Input: matrix_keypad - make driver useable with GPIO drivers requiring threaded irqs Lothar Waßmann
@ 2014-09-09 21:42 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2014-09-09 21:42 UTC (permalink / raw)
To: Lothar Waßmann; +Cc: linux-input, linux-kernel, Paul Gortmaker
On Tue, Sep 09, 2014 at 10:33:04AM +0200, Lothar Waßmann wrote:
> When trying to use the matrix-keypad driver with GPIO drivers that
> require nested irq handlers (e.g. I2C GPIO adapters like PCA9554),
> request_irq() fails because the GPIO driver requires a threaded
> interrupt handler.
>
> Use request_any_context_irq() to be able to use any GPIO driver as
> keypad driver.
>
> Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Applied, thank you.
> ---
> drivers/input/keyboard/matrix_keypad.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
> index 8d2e19e..e651fa6 100644
> --- a/drivers/input/keyboard/matrix_keypad.c
> +++ b/drivers/input/keyboard/matrix_keypad.c
> @@ -332,23 +332,24 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev,
> }
>
> if (pdata->clustered_irq > 0) {
> - err = request_irq(pdata->clustered_irq,
> + err = request_any_context_irq(pdata->clustered_irq,
> matrix_keypad_interrupt,
> pdata->clustered_irq_flags,
> "matrix-keypad", keypad);
> - if (err) {
> + if (err < 0) {
> dev_err(&pdev->dev,
> "Unable to acquire clustered interrupt\n");
> goto err_free_rows;
> }
> } else {
> for (i = 0; i < pdata->num_row_gpios; i++) {
> - err = request_irq(gpio_to_irq(pdata->row_gpios[i]),
> + err = request_any_context_irq(
> + gpio_to_irq(pdata->row_gpios[i]),
> matrix_keypad_interrupt,
> IRQF_TRIGGER_RISING |
> IRQF_TRIGGER_FALLING,
> "matrix-keypad", keypad);
> - if (err) {
> + if (err < 0) {
> dev_err(&pdev->dev,
> "Unable to acquire interrupt for GPIO line %i\n",
> pdata->row_gpios[i]);
> --
> 1.7.10.4
>
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-09 21:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-09 8:33 [PATCH] Input: matrix_keypad - make driver useable with GPIO drivers requiring threaded irqs Lothar Waßmann
2014-09-09 21:42 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).