Commit 34cf5a1c authored by Linus Walleij's avatar Linus Walleij Committed by Dmitry Torokhov

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: default avatarHans-Christian Noren Egtvedt <egtvedt@samfundet.no>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent c5053e69
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#define GPIO_MOUSE_PIN_MAX 7 #define GPIO_MOUSE_PIN_MAX 7
/** /**
* struct gpio_mouse_platform_data * struct gpio_mouse
* @scan_ms: integer in ms specifying the scan periode. * @scan_ms: integer in ms specifying the scan periode.
* @polarity: Pin polarity, active high or low. * @polarity: Pin polarity, active high or low.
* @up: GPIO line for up value. * @up: GPIO line for up value.
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
* It is used by the gpio_mouse driver to setup GPIO lines and to * It is used by the gpio_mouse driver to setup GPIO lines and to
* calculate mouse movement. * calculate mouse movement.
*/ */
struct gpio_mouse_platform_data { struct gpio_mouse {
int scan_ms; int scan_ms;
int polarity; int polarity;
...@@ -67,7 +67,7 @@ struct gpio_mouse_platform_data { ...@@ -67,7 +67,7 @@ struct gpio_mouse_platform_data {
*/ */
static void gpio_mouse_scan(struct input_polled_dev *dev) static void gpio_mouse_scan(struct input_polled_dev *dev)
{ {
struct gpio_mouse_platform_data *gpio = dev->private; struct gpio_mouse *gpio = dev->private;
struct input_dev *input = dev->input; struct input_dev *input = dev->input;
int x, y; int x, y;
...@@ -94,24 +94,24 @@ static void gpio_mouse_scan(struct input_polled_dev *dev) ...@@ -94,24 +94,24 @@ static void gpio_mouse_scan(struct input_polled_dev *dev)
static int gpio_mouse_probe(struct platform_device *pdev) static int gpio_mouse_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct gpio_mouse_platform_data *pdata; struct gpio_mouse *gmouse;
struct input_polled_dev *input_poll; struct input_polled_dev *input_poll;
struct input_dev *input; struct input_dev *input;
int pin, i; int pin, i;
int error; int error;
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); gmouse = devm_kzalloc(dev, sizeof(*gmouse), GFP_KERNEL);
if (!pdata) if (!gmouse)
return -ENOMEM; return -ENOMEM;
if (pdata->scan_ms < 0) { if (gmouse->scan_ms < 0) {
dev_err(&pdev->dev, "invalid scan time\n"); dev_err(&pdev->dev, "invalid scan time\n");
error = -EINVAL; error = -EINVAL;
goto out; goto out;
} }
for (i = 0; i < GPIO_MOUSE_PIN_MAX; i++) { for (i = 0; i < GPIO_MOUSE_PIN_MAX; i++) {
pin = pdata->pins[i]; pin = gmouse->pins[i];
if (pin < 0) { if (pin < 0) {
...@@ -148,9 +148,9 @@ static int gpio_mouse_probe(struct platform_device *pdev) ...@@ -148,9 +148,9 @@ static int gpio_mouse_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, input_poll); platform_set_drvdata(pdev, input_poll);
/* set input-polldev handlers */ /* set input-polldev handlers */
input_poll->private = pdata; input_poll->private = gmouse;
input_poll->poll = gpio_mouse_scan; input_poll->poll = gpio_mouse_scan;
input_poll->poll_interval = pdata->scan_ms; input_poll->poll_interval = gmouse->scan_ms;
input = input_poll->input; input = input_poll->input;
input->name = pdev->name; input->name = pdev->name;
...@@ -159,11 +159,11 @@ static int gpio_mouse_probe(struct platform_device *pdev) ...@@ -159,11 +159,11 @@ static int gpio_mouse_probe(struct platform_device *pdev)
input_set_capability(input, EV_REL, REL_X); input_set_capability(input, EV_REL, REL_X);
input_set_capability(input, EV_REL, REL_Y); input_set_capability(input, EV_REL, REL_Y);
if (pdata->bleft >= 0) if (gmouse->bleft >= 0)
input_set_capability(input, EV_KEY, BTN_LEFT); input_set_capability(input, EV_KEY, BTN_LEFT);
if (pdata->bmiddle >= 0) if (gmouse->bmiddle >= 0)
input_set_capability(input, EV_KEY, BTN_MIDDLE); input_set_capability(input, EV_KEY, BTN_MIDDLE);
if (pdata->bright >= 0) if (gmouse->bright >= 0)
input_set_capability(input, EV_KEY, BTN_RIGHT); input_set_capability(input, EV_KEY, BTN_RIGHT);
error = input_register_polled_device(input_poll); error = input_register_polled_device(input_poll);
...@@ -173,10 +173,10 @@ static int gpio_mouse_probe(struct platform_device *pdev) ...@@ -173,10 +173,10 @@ static int gpio_mouse_probe(struct platform_device *pdev)
} }
dev_dbg(&pdev->dev, "%d ms scan time, buttons: %s%s%s\n", dev_dbg(&pdev->dev, "%d ms scan time, buttons: %s%s%s\n",
pdata->scan_ms, gmouse->scan_ms,
pdata->bleft < 0 ? "" : "left ", gmouse->bleft < 0 ? "" : "left ",
pdata->bmiddle < 0 ? "" : "middle ", gmouse->bmiddle < 0 ? "" : "middle ",
pdata->bright < 0 ? "" : "right"); gmouse->bright < 0 ? "" : "right");
return 0; return 0;
...@@ -185,7 +185,7 @@ static int gpio_mouse_probe(struct platform_device *pdev) ...@@ -185,7 +185,7 @@ static int gpio_mouse_probe(struct platform_device *pdev)
out_free_gpios: out_free_gpios:
while (--i >= 0) { while (--i >= 0) {
pin = pdata->pins[i]; pin = gmouse->pins[i];
if (pin) if (pin)
gpio_free(pin); gpio_free(pin);
} }
...@@ -196,14 +196,14 @@ static int gpio_mouse_probe(struct platform_device *pdev) ...@@ -196,14 +196,14 @@ static int gpio_mouse_probe(struct platform_device *pdev)
static int gpio_mouse_remove(struct platform_device *pdev) static int gpio_mouse_remove(struct platform_device *pdev)
{ {
struct input_polled_dev *input = platform_get_drvdata(pdev); struct input_polled_dev *input = platform_get_drvdata(pdev);
struct gpio_mouse_platform_data *pdata = input->private; struct gpio_mouse *gmouse = input->private;
int pin, i; int pin, i;
input_unregister_polled_device(input); input_unregister_polled_device(input);
input_free_polled_device(input); input_free_polled_device(input);
for (i = 0; i < GPIO_MOUSE_PIN_MAX; i++) { for (i = 0; i < GPIO_MOUSE_PIN_MAX; i++) {
pin = pdata->pins[i]; pin = gmouse->pins[i];
if (pin >= 0) if (pin >= 0)
gpio_free(pin); gpio_free(pin);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment