lkml.org 
[lkml]   [2011]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 09/13] input: get irq from resource in max8925 onkey
Date
Avoid to use hardcoding irq numbers in max8925 onkey driver. Get irq
from resources instead.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/misc/max8925_onkey.c | 36 ++++++++++++++++--------------------
1 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c
index 7de0ded..835cc2a 100644
--- a/drivers/input/misc/max8925_onkey.c
+++ b/drivers/input/misc/max8925_onkey.c
@@ -69,18 +69,7 @@ static int __devinit max8925_onkey_probe(struct platform_device *pdev)
{
struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
struct max8925_onkey_info *info;
- int irq[2], error;
-
- irq[0] = platform_get_irq(pdev, 0);
- if (irq[0] < 0) {
- dev_err(&pdev->dev, "No IRQ resource!\n");
- return -EINVAL;
- }
- irq[1] = platform_get_irq(pdev, 1);
- if (irq[1] < 0) {
- dev_err(&pdev->dev, "No IRQ resource!\n");
- return -EINVAL;
- }
+ int error = -EINVAL;

info = kzalloc(sizeof(struct max8925_onkey_info), GFP_KERNEL);
if (!info)
@@ -88,21 +77,30 @@ static int __devinit max8925_onkey_probe(struct platform_device *pdev)

info->i2c = chip->i2c;
info->dev = &pdev->dev;
- irq[0] += chip->irq_base;
- irq[1] += chip->irq_base;

- error = request_threaded_irq(irq[0], NULL, max8925_onkey_handler,
+ info->irq[0] = platform_get_irq(pdev, 0);
+ if (info->irq[0] < 0) {
+ dev_err(&pdev->dev, "No IRQ resource!\n");
+ goto out;
+ }
+ info->irq[1] = platform_get_irq(pdev, 1);
+ if (info->irq[1] < 0) {
+ dev_err(&pdev->dev, "No IRQ resource!\n");
+ goto out;
+ }
+
+ error = request_threaded_irq(info->irq[0], NULL, max8925_onkey_handler,
IRQF_ONESHOT, "onkey-down", info);
if (error < 0) {
dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n",
- irq[0], error);
+ info->irq[0], error);
goto out;
}
- error = request_threaded_irq(irq[1], NULL, max8925_onkey_handler,
+ error = request_threaded_irq(info->irq[1], NULL, max8925_onkey_handler,
IRQF_ONESHOT, "onkey-up", info);
if (error < 0) {
dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n",
- irq[1], error);
+ info->irq[1], error);
goto out_irq;
}

@@ -117,8 +115,6 @@ static int __devinit max8925_onkey_probe(struct platform_device *pdev)
info->idev->phys = "max8925_on/input0";
info->idev->id.bustype = BUS_I2C;
info->idev->dev.parent = &pdev->dev;
- info->irq[0] = irq[0];
- info->irq[1] = irq[1];
info->idev->evbit[0] = BIT_MASK(EV_KEY);
info->idev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);

--
1.5.6.5


\
 
 \ /
  Last update: 2011-04-13 16:59    [W:0.207 / U:0.460 seconds]
©2003-2014 Jasper Spaans. Advertise on this site