/
0002-drivers-pps-clients-pps-gpio.c-convert-to-devm_-help.patch
92 lines (80 loc) · 2.7 KB
/
0002-drivers-pps-clients-pps-gpio.c-convert-to-devm_-help.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
From 8a52342a9a3b22cbdee9501ed09e37ead3b111ca Mon Sep 17 00:00:00 2001
From: Matt Ranostay <mranostay@gmail.com>
Date: Mon, 17 Jun 2013 20:30:29 +0000
Subject: [PATCH 2/3] drivers/pps/clients/pps-gpio.c: convert to devm_* helpers
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
---
drivers/pps/clients/pps-gpio.c | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index 4c53c6d..7e0e93b 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -109,7 +109,6 @@ static int pps_gpio_probe(struct platform_device *pdev)
struct pps_gpio_device_data *data;
int irq;
int ret;
- int err;
int pps_default_params;
const struct pps_gpio_platform_data *pdata = pdev->dev.platform_data;
@@ -123,15 +122,13 @@ static int pps_gpio_probe(struct platform_device *pdev)
irq = gpio_to_irq(pdata->gpio_pin);
if (irq < 0) {
pr_err("failed to map GPIO to IRQ: %d\n", irq);
- err = -EINVAL;
- goto return_error;
+ return -EINVAL;
}
/* allocate space for device info */
data = kzalloc(sizeof(struct pps_gpio_device_data), GFP_KERNEL);
if (data == NULL) {
- err = -ENOMEM;
- goto return_error;
+ return -ENOMEM;
}
/* initialize PPS specific parts of the bookkeeping data structure. */
@@ -152,42 +149,33 @@ static int pps_gpio_probe(struct platform_device *pdev)
if (data->pps == NULL) {
kfree(data);
pr_err("failed to register IRQ %d as PPS source\n", irq);
- err = -EINVAL;
- goto return_error;
+ return -EINVAL;
}
data->irq = irq;
data->pdata = pdata;
/* register IRQ interrupt handler */
- ret = request_irq(irq, pps_gpio_irq_handler,
+ ret = devm_request_irq(&pdev->dev, irq, pps_gpio_irq_handler,
get_irqf_trigger_flags(pdata), data->info.name, data);
if (ret) {
pps_unregister_source(data->pps);
kfree(data);
pr_err("failed to acquire IRQ %d\n", irq);
- err = -EINVAL;
- goto return_error;
+ return -EINVAL;
}
platform_set_drvdata(pdev, data);
dev_info(data->pps->dev, "Registered IRQ %d as PPS source\n", irq);
return 0;
-
-return_error:
- gpio_free(pdata->gpio_pin);
- return err;
}
static int pps_gpio_remove(struct platform_device *pdev)
{
struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
- const struct pps_gpio_platform_data *pdata = data->pdata;
platform_set_drvdata(pdev, NULL);
- free_irq(data->irq, data);
- gpio_free(pdata->gpio_pin);
pps_unregister_source(data->pps);
pr_info("removed IRQ %d as PPS source\n", data->irq);
kfree(data);
--
1.8.2.1