input: move gpio mouse to managed api
Subsystems (2)
PATCH 1/1 input: move gpio mouse to managed api
Signed-off-by Bram Vlerick <[email protected]>
--- drivers/input/mouse/gpio_mouse.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/input/mouse/gpio_mouse.c +2 -8
@@ -93,7 +93,7 @@ static int gpio_mouse_probe(struct platform_device *pdev) } } - input_poll =input_allocate_polled_device (); + input_poll =devm_input_allocate_polled_device (&pdev->dev);if (!input_poll) {dev_err (&pdev->dev,"not enough memory for input device\n" ); error = -ENOMEM ;
@@ -124,7 +124,7 @@ static int gpio_mouse_probe(struct platform_device *pdev) error =input_register_polled_device (input_poll);if (error) {dev_err (&pdev->dev,"could not register input device\n" ); - goto out_free_polldev; + goto out_free_gpios; } dev_dbg(&pdev->dev, "%d ms scan time, buttons: %s%s%s\n",
@@ -135,9 +135,6 @@ static int gpio_mouse_probe(struct platform_device *pdev)return 0 ; - out_free_polldev: -input_free_polled_device (input_poll); - out_free_gpios:while (--i >=0 ) { pin = pdata->pins[i];
@@ -154,9 +151,6 @@ static int gpio_mouse_remove(struct platform_device *pdev)struct gpio_mouse_platform_data *pdata = input->private;int pin, i; -input_unregister_polled_device (input); -input_free_polled_device (input); -for (i =0 ; i <GPIO_MOUSE_PIN_MAX ; i++) { pin = pdata->pins[i];if (pin >=0 )
Signature · 1 line
2.12.2
Quoted 38 lines · Bram Vlerick
Signed-off-by Bram Vlerick <[email protected]>--- drivers/input/mouse/gpio_mouse.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/input/mouse/gpio_mouse.c +2
-5@@ -93,7 +93,7 @@ static int gpio_mouse_probe(struct platform_device *pdev) } } - input_poll =input_allocate_polled_device (); + input_poll =devm_input_allocate_polled_device (&pdev->dev);if (!input_poll) {dev_err (&pdev->dev,"not enough memory for input device\n" ); error = -ENOMEM ;@@ -124,7 +124,7 @@ static int gpio_mouse_probe(struct platform_device *pdev) error =input_register_polled_device (input_poll);if (error) {dev_err (&pdev->dev,"could not register input device\n" ); - goto out_free_polldev; + goto out_free_gpios; } dev_dbg(&pdev->dev, "%d ms scan time, buttons: %s%s%s\n",@@ -135,9 +135,6 @@ static int gpio_mouse_probe(struct platform_device *pdev)return 0 ; - out_free_polldev: -input_free_polled_device (input_poll); - out_free_gpios:while (--i >=0 ) { pin = pdata->pins[i];
drivers/input/mouse/gpio_mouse.c static int gpio_mouse_remove(struct platform_device *pdev) · line 156
Quoted 9 lines
drivers/input/mouse/gpio_mouse.c +0
-3@@ -154,9 +151,6 @@ static int gpio_mouse_remove(struct platform_device *pdev)struct gpio_mouse_platform_data *pdata = input->private;int pin, i; -input_unregister_polled_device (input); -input_free_polled_device (input); -for (i =0 ; i <GPIO_MOUSE_PIN_MAX ; i++) { pin = pdata->pins[i];if (pin >=0 )
Reviewed-by Michael Opdenacker <[email protected]>
Signature · 3 lines
Michael Opdenacker, CEO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Dmitry Torokhov
maintainerHi Bram,
Quoted 38 lines · Bram Vlerick
Signed-off-by Bram Vlerick <[email protected]>--- drivers/input/mouse/gpio_mouse.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/input/mouse/gpio_mouse.c +2
-5@@ -93,7 +93,7 @@ static int gpio_mouse_probe(struct platform_device *pdev) } } - input_poll =input_allocate_polled_device (); + input_poll =devm_input_allocate_polled_device (&pdev->dev);if (!input_poll) {dev_err (&pdev->dev,"not enough memory for input device\n" ); error = -ENOMEM ;@@ -124,7 +124,7 @@ static int gpio_mouse_probe(struct platform_device *pdev) error =input_register_polled_device (input_poll);if (error) {dev_err (&pdev->dev,"could not register input device\n" ); - goto out_free_polldev; + goto out_free_gpios; } dev_dbg(&pdev->dev, "%d ms scan time, buttons: %s%s%s\n",@@ -135,9 +135,6 @@ static int gpio_mouse_probe(struct platform_device *pdev)return 0 ; - out_free_polldev: -input_free_polled_device (input_poll); - out_free_gpios:while (--i >=0 ) { pin = pdata->pins[i];
drivers/input/mouse/gpio_mouse.c static int gpio_mouse_remove(struct platform_device *pdev) · line 159
Quoted 6 lines
drivers/input/mouse/gpio_mouse.c +0
-3@@ -154,9 +151,6 @@ static int gpio_mouse_remove(struct platform_device *pdev)struct gpio_mouse_platform_data *pdata = input->private;int pin, i; -input_unregister_polled_device (input); -input_free_polled_device (input); -
This is wrong, as you now letting input device be active while gpios are free.
Frankly, I wonder if we could not retire this driver by making gpio-keys be more flexible... I think we discussed options to allow mode where gpio-keys-polled "sums" the gpios for the same axis and report the value.
Quoted 6 lines
drivers/input/mouse/gpio_mouse.c +0
-0for (i =0 ; i <GPIO_MOUSE_PIN_MAX ; i++) { pin = pdata->pins[i];if (pin >=0 )Signature · 1 line
2.12.2
Thanks.
Signature · 1 line
Dmitry