aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2017-10-19 19:19:41 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-10-19 20:08:44 -0400
commit34cf5a1cad90a0ba31629260fdc127453a2b28e6 (patch)
tree38ea49672a9b95d1803908289689abf649eb346d
parentc5053e695d621f8a8a3992c5e93dd3be088fa267 (diff)
Input: gpio_mouse - rename platform data variables
Use more appropriate names for the "platform data" which is now just a simple state container for the GPIO mouse. Acked-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/mouse/gpio_mouse.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c
index dcaba1e4fffb..d1914bb3531f 100644
--- a/drivers/input/mouse/gpio_mouse.c
+++ b/drivers/input/mouse/gpio_mouse.c
@@ -26,7 +26,7 @@
26#define GPIO_MOUSE_PIN_MAX 7 26#define GPIO_MOUSE_PIN_MAX 7
27 27
28/** 28/**
29 * struct gpio_mouse_platform_data 29 * struct gpio_mouse
30 * @scan_ms: integer in ms specifying the scan periode. 30 * @scan_ms: integer in ms specifying the scan periode.
31 * @polarity: Pin polarity, active high or low. 31 * @polarity: Pin polarity, active high or low.
32 * @up: GPIO line for up value. 32 * @up: GPIO line for up value.
@@ -42,7 +42,7 @@
42 * It is used by the gpio_mouse driver to setup GPIO lines and to 42 * It is used by the gpio_mouse driver to setup GPIO lines and to
43 * calculate mouse movement. 43 * calculate mouse movement.
44 */ 44 */
45struct gpio_mouse_platform_data { 45struct gpio_mouse {
46 int scan_ms; 46 int scan_ms;
47 int polarity; 47 int polarity;
48 48
@@ -67,7 +67,7 @@ struct gpio_mouse_platform_data {
67 */ 67 */
68static void gpio_mouse_scan(struct input_polled_dev *dev) 68static void gpio_mouse_scan(struct input_polled_dev *dev)
69{ 69{
70 struct gpio_mouse_platform_data *gpio = dev->private; 70 struct gpio_mouse *gpio = dev->private;
71 struct input_dev *input = dev->input; 71 struct input_dev *input = dev->input;
72 int x, y; 72 int x, y;
73 73
@@ -94,24 +94,24 @@ static void gpio_mouse_scan(struct input_polled_dev *dev)
94static int gpio_mouse_probe(struct platform_device *pdev) 94static int gpio_mouse_probe(struct platform_device *pdev)
95{ 95{
96 struct device *dev = &pdev->dev; 96 struct device *dev = &pdev->dev;
97 struct gpio_mouse_platform_data *pdata; 97 struct gpio_mouse *gmouse;
98 struct input_polled_dev *input_poll; 98 struct input_polled_dev *input_poll;
99 struct input_dev *input; 99 struct input_dev *input;
100 int pin, i; 100 int pin, i;
101 int error; 101 int error;
102 102
103 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); 103 gmouse = devm_kzalloc(dev, sizeof(*gmouse), GFP_KERNEL);
104 if (!pdata) 104 if (!gmouse)
105 return -ENOMEM; 105 return -ENOMEM;
106 106
107 if (pdata->scan_ms < 0) { 107 if (gmouse->scan_ms < 0) {
108 dev_err(&pdev->dev, "invalid scan time\n"); 108 dev_err(&pdev->dev, "invalid scan time\n");
109 error = -EINVAL; 109 error = -EINVAL;
110 goto out; 110 goto out;
111 } 111 }
112 112
113 for (i = 0; i < GPIO_MOUSE_PIN_MAX; i++) { 113 for (i = 0; i < GPIO_MOUSE_PIN_MAX; i++) {
114 pin = pdata->pins[i]; 114 pin = gmouse->pins[i];
115 115
116 if (pin < 0) { 116 if (pin < 0) {
117 117
@@ -148,9 +148,9 @@ static int gpio_mouse_probe(struct platform_device *pdev)
148 platform_set_drvdata(pdev, input_poll); 148 platform_set_drvdata(pdev, input_poll);
149 149
150 /* set input-polldev handlers */ 150 /* set input-polldev handlers */
151 input_poll->private = pdata; 151 input_poll->private = gmouse;
152 input_poll->poll = gpio_mouse_scan; 152 input_poll->poll = gpio_mouse_scan;
153 input_poll->poll_interval = pdata->scan_ms; 153 input_poll->poll_interval = gmouse->scan_ms;
154 154
155 input = input_poll->input; 155 input = input_poll->input;
156 input->name = pdev->name; 156 input->name = pdev->name;
@@ -159,11 +159,11 @@ static int gpio_mouse_probe(struct platform_device *pdev)
159 159
160 input_set_capability(input, EV_REL, REL_X); 160 input_set_capability(input, EV_REL, REL_X);
161 input_set_capability(input, EV_REL, REL_Y); 161 input_set_capability(input, EV_REL, REL_Y);
162 if (pdata->bleft >= 0) 162 if (gmouse->bleft >= 0)
163 input_set_capability(input, EV_KEY, BTN_LEFT); 163 input_set_capability(input, EV_KEY, BTN_LEFT);
164 if (pdata->bmiddle >= 0) 164 if (gmouse->bmiddle >= 0)
165 input_set_capability(input, EV_KEY, BTN_MIDDLE); 165 input_set_capability(input, EV_KEY, BTN_MIDDLE);
166 if (pdata->bright >= 0) 166 if (gmouse->bright >= 0)
167 input_set_capability(input, EV_KEY, BTN_RIGHT); 167 input_set_capability(input, EV_KEY, BTN_RIGHT);
168 168
169 error = input_register_polled_device(input_poll); 169 error = input_register_polled_device(input_poll);
@@ -173,10 +173,10 @@ static int gpio_mouse_probe(struct platform_device *pdev)
173 } 173 }
174 174
175 dev_dbg(&pdev->dev, "%d ms scan time, buttons: %s%s%s\n", 175 dev_dbg(&pdev->dev, "%d ms scan time, buttons: %s%s%s\n",
176 pdata->scan_ms, 176 gmouse->scan_ms,
177 pdata->bleft < 0 ? "" : "left ", 177 gmouse->bleft < 0 ? "" : "left ",
178 pdata->bmiddle < 0 ? "" : "middle ", 178 gmouse->bmiddle < 0 ? "" : "middle ",
179 pdata->bright < 0 ? "" : "right"); 179 gmouse->bright < 0 ? "" : "right");
180 180
181 return 0; 181 return 0;
182 182
@@ -185,7 +185,7 @@ static int gpio_mouse_probe(struct platform_device *pdev)
185 185
186 out_free_gpios: 186 out_free_gpios:
187 while (--i >= 0) { 187 while (--i >= 0) {
188 pin = pdata->pins[i]; 188 pin = gmouse->pins[i];
189 if (pin) 189 if (pin)
190 gpio_free(pin); 190 gpio_free(pin);
191 } 191 }
@@ -196,14 +196,14 @@ static int gpio_mouse_probe(struct platform_device *pdev)
196static int gpio_mouse_remove(struct platform_device *pdev) 196static int gpio_mouse_remove(struct platform_device *pdev)
197{ 197{
198 struct input_polled_dev *input = platform_get_drvdata(pdev); 198 struct input_polled_dev *input = platform_get_drvdata(pdev);
199 struct gpio_mouse_platform_data *pdata = input->private; 199 struct gpio_mouse *gmouse = input->private;
200 int pin, i; 200 int pin, i;
201 201
202 input_unregister_polled_device(input); 202 input_unregister_polled_device(input);
203 input_free_polled_device(input); 203 input_free_polled_device(input);
204 204
205 for (i = 0; i < GPIO_MOUSE_PIN_MAX; i++) { 205 for (i = 0; i < GPIO_MOUSE_PIN_MAX; i++) {
206 pin = pdata->pins[i]; 206 pin = gmouse->pins[i];
207 if (pin >= 0) 207 if (pin >= 0)
208 gpio_free(pin); 208 gpio_free(pin);
209 } 209 }