summaryrefslogtreecommitdiffstats
path: root/drivers/input/serio/ams_delta_serio.c
diff options
context:
space:
mode:
authorJanusz Krzysztofik <jmkrzyszt@gmail.com>2018-06-22 00:41:27 +0200
committerTony Lindgren <tony@atomide.com>2018-07-02 23:05:14 -0700
commita617b36bbc0a1d175bbe98e009e903c1ea0e2be5 (patch)
treea3867b0bdecdc28de0c9971ec35ea4a6d95733b5 /drivers/input/serio/ams_delta_serio.c
parentdc8fbeb0ffde1f2395449006019e2c89c177df50 (diff)
downloadlinux-a617b36bbc0a1d175bbe98e009e903c1ea0e2be5.tar.gz
linux-a617b36bbc0a1d175bbe98e009e903c1ea0e2be5.tar.bz2
linux-a617b36bbc0a1d175bbe98e009e903c1ea0e2be5.zip
Input: ams_delta_serio: use IRQ resource
The driver still obtains IRQ number from a hardcoded GPIO. Use IRQ resource instead. For this to work on Amstrad Delta, add the IRQ resource to ams-delta-serio platform device structure. Obtain the IRQ number assigned to "keybrd_clk" GPIO pin from FIQ initialization routine. As a benefit, the driver no longer needs to include <mach/board-ams-delta.h>. Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/input/serio/ams_delta_serio.c')
-rw-r--r--drivers/input/serio/ams_delta_serio.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index 2602f7cff5ae..c1f8226f172e 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -20,7 +20,6 @@
* However, when used with the E3 mailboard that producecs non-standard
* scancodes, a custom key table must be prepared and loaded from userspace.
*/
-#include <linux/gpio.h>
#include <linux/irq.h>
#include <linux/platform_data/ams-delta-fiq.h>
#include <linux/platform_device.h>
@@ -29,8 +28,6 @@
#include <linux/slab.h>
#include <linux/module.h>
-#include <mach/board-ams-delta.h>
-
#define DRIVER_NAME "ams-delta-serio"
MODULE_AUTHOR("Matt Callow");
@@ -113,7 +110,7 @@ static int ams_delta_serio_init(struct platform_device *pdev)
{
struct ams_delta_serio *priv;
struct serio *serio;
- int err;
+ int irq, err;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -139,26 +136,20 @@ static int ams_delta_serio_init(struct platform_device *pdev)
return err;
}
- err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
- ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
- DRIVER_NAME, priv);
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0)
+ return -ENXIO;
+
+ err = devm_request_irq(&pdev->dev, irq, ams_delta_serio_interrupt,
+ IRQ_TYPE_EDGE_RISING, DRIVER_NAME, priv);
if (err < 0) {
dev_err(&pdev->dev, "IRQ request failed (%d)\n", err);
return err;
}
- /*
- * Since GPIO register handling for keyboard clock pin is performed
- * at FIQ level, switch back from edge to simple interrupt handler
- * to avoid bad interaction.
- */
- irq_set_handler(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
- handle_simple_irq);
serio = kzalloc(sizeof(*serio), GFP_KERNEL);
- if (!serio) {
- err = -ENOMEM;
- goto irq;
- }
+ if (!serio)
+ return -ENOMEM;
priv->serio = serio;
@@ -177,10 +168,6 @@ static int ams_delta_serio_init(struct platform_device *pdev)
dev_info(&serio->dev, "%s\n", serio->name);
return 0;
-
-irq:
- free_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), priv);
- return err;
}
static int ams_delta_serio_exit(struct platform_device *pdev)
@@ -188,7 +175,6 @@ static int ams_delta_serio_exit(struct platform_device *pdev)
struct ams_delta_serio *priv = platform_get_drvdata(pdev);
serio_unregister_port(priv->serio);
- free_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
return 0;
}