diff options
Diffstat (limited to 'drivers/input/misc')
-rw-r--r-- | drivers/input/misc/bfin_rotary.c | 30 |
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 | ||
19 | static const u16 per_cnt[] = { | ||
20 | P_CNT_CUD, | ||
21 | P_CNT_CDG, | ||
22 | P_CNT_CZM, | ||
23 | 0 | ||
24 | }; | ||
25 | |||
26 | struct bfin_rot { | 19 | struct 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 | ||
91 | static int bfin_rotary_probe(struct platform_device *pdev) | 84 | static 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: | |||
189 | out1: | 186 | out1: |
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 | ||
197 | static int bfin_rotary_remove(struct platform_device *pdev) | 195 | static 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 | ||