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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1353674512-16119-1-git-send-email-tushar.behera@linaro.org>
Date:	Fri, 23 Nov 2012 18:11:52 +0530
From:	Tushar Behera <tushar.behera@...aro.org>
To:	linux-kernel@...r.kernel.org
Cc:	dwmw2@...radead.org, cbou@...l.ru, patches@...aro.org
Subject: [PATCH] power: 88pm860x_battery: Add a few more devm_* APIs

Add devm_* APIs for threaded IRQ.

Also since devres managed objects are removed when the device gets
detached, remove explicit freeing of them.

Signed-off-by: Tushar Behera <tushar.behera@...aro.org>
---
 drivers/power/88pm860x_battery.c |   25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/power/88pm860x_battery.c b/drivers/power/88pm860x_battery.c
index beed5ecf..a245aa4 100644
--- a/drivers/power/88pm860x_battery.c
+++ b/drivers/power/88pm860x_battery.c
@@ -915,15 +915,13 @@ static __devinit int pm860x_battery_probe(struct platform_device *pdev)
 	info->irq_cc = platform_get_irq(pdev, 0);
 	if (info->irq_cc <= 0) {
 		dev_err(&pdev->dev, "No IRQ resource!\n");
-		ret = -EINVAL;
-		goto out;
+		return -EINVAL;
 	}
 
 	info->irq_batt = platform_get_irq(pdev, 1);
 	if (info->irq_batt <= 0) {
 		dev_err(&pdev->dev, "No IRQ resource!\n");
-		ret = -EINVAL;
-		goto out;
+		return -EINVAL;
 	}
 
 	info->chip = chip;
@@ -957,10 +955,10 @@ static __devinit int pm860x_battery_probe(struct platform_device *pdev)
 
 	ret = power_supply_register(&pdev->dev, &info->battery);
 	if (ret)
-		goto out;
+		return ret;
 	info->battery.dev->parent = &pdev->dev;
 
-	ret = request_threaded_irq(info->irq_cc, NULL,
+	ret = devm_request_threaded_irq(&pdev->dev, info->irq_cc, NULL,
 				pm860x_coulomb_handler, IRQF_ONESHOT,
 				"coulomb", info);
 	if (ret < 0) {
@@ -969,23 +967,19 @@ static __devinit int pm860x_battery_probe(struct platform_device *pdev)
 		goto out_reg;
 	}
 
-	ret = request_threaded_irq(info->irq_batt, NULL, pm860x_batt_handler,
-				IRQF_ONESHOT, "battery", info);
+	ret = devm_request_threaded_irq(&pdev->dev, info->irq_batt, NULL,
+				pm860x_batt_handler, IRQF_ONESHOT,
+				"battery", info);
 	if (ret < 0) {
 		dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n",
 			info->irq_batt, ret);
-		goto out_coulomb;
+		goto out_reg;
 	}
 
-
 	return 0;
 
-out_coulomb:
-	free_irq(info->irq_cc, info);
 out_reg:
 	power_supply_unregister(&info->battery);
-out:
-	kfree(info);
 	return ret;
 }
 
@@ -994,9 +988,6 @@ static int __devexit pm860x_battery_remove(struct platform_device *pdev)
 	struct pm860x_battery_info *info = platform_get_drvdata(pdev);
 
 	power_supply_unregister(&info->battery);
-	free_irq(info->irq_batt, info);
-	free_irq(info->irq_cc, info);
-	kfree(info);
 	platform_set_drvdata(pdev, NULL);
 	return 0;
 }
-- 
1.7.4.1

--
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