aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc
diff options
context:
space:
mode:
authorSonic Zhang <sonic.zhang@analog.com>2015-02-06 00:23:10 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-02-15 19:06:27 -0500
commit5ea0699a7b452c9e1ecdc81e354fa91dfe8da4f6 (patch)
treef1f43df85175947616147ce0c471629f9c967da8 /drivers/input/misc
parent1ea74014aba7cd3ddcc3cf3eef92270d2e8429e8 (diff)
Input: bfin_rotary - move pin lists into into platform data
Newer Blackfin boards use pinctrl API to manage pins and the legacy peripherial lists are not useful on them. Let's move pin lists into platform data so older boards can still use them and newer boards can use the modern API. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/misc')
-rw-r--r--drivers/input/misc/bfin_rotary.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
index 35ead69521a0..8312b29ab18d 100644
--- a/drivers/input/misc/bfin_rotary.c
+++ b/drivers/input/misc/bfin_rotary.c
@@ -16,13 +16,6 @@
16 16
17#include <asm/portmux.h> 17#include <asm/portmux.h>
18 18
19static const u16 per_cnt[] = {
20 P_CNT_CUD,
21 P_CNT_CDG,
22 P_CNT_CZM,
23 0
24};
25
26struct bfin_rot { 19struct bfin_rot {
27 struct input_dev *input; 20 struct input_dev *input;
28 int irq; 21 int irq;
@@ -90,7 +83,8 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id)
90 83
91static int bfin_rotary_probe(struct platform_device *pdev) 84static int bfin_rotary_probe(struct platform_device *pdev)
92{ 85{
93 struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev); 86 const struct bfin_rotary_platform_data *pdata =
87 dev_get_platdata(&pdev->dev);
94 struct bfin_rot *rotary; 88 struct bfin_rot *rotary;
95 struct input_dev *input; 89 struct input_dev *input;
96 int error; 90 int error;
@@ -101,10 +95,13 @@ static int bfin_rotary_probe(struct platform_device *pdev)
101 return -EINVAL; 95 return -EINVAL;
102 } 96 }
103 97
104 error = peripheral_request_list(per_cnt, dev_name(&pdev->dev)); 98 if (pdata->pin_list) {
105 if (error) { 99 error = peripheral_request_list(pdata->pin_list,
106 dev_err(&pdev->dev, "requesting peripherals failed\n"); 100 dev_name(&pdev->dev));
107 return error; 101 if (error) {
102 dev_err(&pdev->dev, "requesting peripherals failed\n");
103 return error;
104 }
108 } 105 }
109 106
110 rotary = kzalloc(sizeof(struct bfin_rot), GFP_KERNEL); 107 rotary = kzalloc(sizeof(struct bfin_rot), GFP_KERNEL);
@@ -189,13 +186,16 @@ out2:
189out1: 186out1:
190 input_free_device(input); 187 input_free_device(input);
191 kfree(rotary); 188 kfree(rotary);
192 peripheral_free_list(per_cnt); 189 if (pdata->pin_list)
190 peripheral_free_list(pdata->pin_list);
193 191
194 return error; 192 return error;
195} 193}
196 194
197static int bfin_rotary_remove(struct platform_device *pdev) 195static int bfin_rotary_remove(struct platform_device *pdev)
198{ 196{
197 const struct bfin_rotary_platform_data *pdata =
198 dev_get_platdata(&pdev->dev);
199 struct bfin_rot *rotary = platform_get_drvdata(pdev); 199 struct bfin_rot *rotary = platform_get_drvdata(pdev);
200 200
201 bfin_write_CNT_CONFIG(0); 201 bfin_write_CNT_CONFIG(0);
@@ -203,7 +203,9 @@ static int bfin_rotary_remove(struct platform_device *pdev)
203 203
204 free_irq(rotary->irq, rotary); 204 free_irq(rotary->irq, rotary);
205 input_unregister_device(rotary->input); 205 input_unregister_device(rotary->input);
206 peripheral_free_list(per_cnt); 206
207 if (pdata->pin_list)
208 peripheral_free_list(pdata->pin_list);
207 209
208 kfree(rotary); 210 kfree(rotary);
209 211