summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorFrans Klaver <frans.klaver@xsens.com>2015-01-14 09:15:35 +0100
committerSebastian Reichel <sre@kernel.org>2015-01-20 13:58:28 +0100
commit07d08237d3ff08c6a53c6e8496bd255176e1d68f (patch)
tree4316178a8ee89d9451957f905eb2f4c45b6ed7fe /drivers/power
parent0a5c6a2276fe06a3ebb6a9ed26c0b8007074958e (diff)
downloadlinux-07d08237d3ff08c6a53c6e8496bd255176e1d68f.tar.bz2
power: reset: ltc2952: prefer devm_request_irq over request_irq
Make use of the fact that we allocated resources can be automatically deallocated. This reduces cleanup code and chance of errors. It also removes the need for the virq member of the ltc2952_poweroff_data struct. Signed-off-by: Frans Klaver <frans.klaver@xsens.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/reset/ltc2952-poweroff.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/power/reset/ltc2952-poweroff.c b/drivers/power/reset/ltc2952-poweroff.c
index 6487b991ed45..0b0792a9ad56 100644
--- a/drivers/power/reset/ltc2952-poweroff.c
+++ b/drivers/power/reset/ltc2952-poweroff.c
@@ -72,8 +72,6 @@ struct ltc2952_poweroff_data {
struct device *dev;
- unsigned int virq;
-
/**
* 0: trigger
* 1: watchdog
@@ -260,13 +258,11 @@ static int ltc2952_poweroff_init(struct platform_device *pdev)
goto err_io;
}
- ltc2952_data->virq = virq;
- ret = request_irq(virq,
- ltc2952_poweroff_handler,
- (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING),
- "ltc2952-poweroff",
- ltc2952_data
- );
+ ret = devm_request_irq(&pdev->dev, virq,
+ ltc2952_poweroff_handler,
+ (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING),
+ "ltc2952-poweroff",
+ ltc2952_data);
if (ret) {
dev_err(&pdev->dev, "cannot configure an interrupt handler\n");
@@ -316,12 +312,9 @@ static int ltc2952_poweroff_remove(struct platform_device *pdev)
pm_power_off = NULL;
- if (ltc2952_data) {
- free_irq(ltc2952_data->virq, ltc2952_data);
-
+ if (ltc2952_data)
for (i = 0; i < ARRAY_SIZE(ltc2952_data->gpio); i++)
gpiod_put(ltc2952_data->gpio[i]);
- }
return 0;
}