lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1303135451-26362-10-git-send-email-haojian.zhuang@marvell.com>
Date:	Mon, 18 Apr 2011 22:04:06 +0800
From:	Haojian Zhuang <haojian.zhuang@...vell.com>
To:	sameo@...ux.intel.com, haojian.zhuang@...il.com,
	linux-kernel@...r.kernel.org, dmitry.torokhov@...il.com,
	a.zummo@...ertech.it, johnpol@....mipt.ru, cbou@...l.ru,
	dwmw2@...radead.org, lrg@...mlogic.co.uk,
	broonie@...nsource.wolfsonmicro.com
Cc:	Haojian Zhuang <haojian.zhuang@...vell.com>
Subject: [PATCH 09/14] input: get irq from resource in max8925 onkey

Avoid to use hardcoding irq numbers in max8925 onkey driver. Get irq
from resources instead.

Signed-off-by: Haojian Zhuang <haojian.zhuang@...vell.com>
Cc: Dmitry Torokhov <dmitry.torokhov@...il.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ