Commit 36bc3684 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: rb532_button - switch to using polled mode of input devices

We have added polled mode to the normal input devices with the intent of
retiring input_polled_dev. This converts rb532_button driver to use
the polling mode of standard input devices and removes dependency on
INPUT_POLLDEV.

Link: https://lore.kernel.org/r/20191017204217.106453-17-dmitry.torokhov@gmail.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 528c7d02
...@@ -633,7 +633,6 @@ config INPUT_RB532_BUTTON ...@@ -633,7 +633,6 @@ config INPUT_RB532_BUTTON
tristate "Mikrotik Routerboard 532 button interface" tristate "Mikrotik Routerboard 532 button interface"
depends on MIKROTIK_RB532 depends on MIKROTIK_RB532
depends on GPIOLIB depends on GPIOLIB
select INPUT_POLLDEV
help help
Say Y here if you want support for the S1 button built into Say Y here if you want support for the S1 button built into
Mikrotik's Routerboard 532. Mikrotik's Routerboard 532.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Copyright (C) 2009 Phil Sutter <n0-1@freewrt.org> * Copyright (C) 2009 Phil Sutter <n0-1@freewrt.org>
*/ */
#include <linux/input-polldev.h> #include <linux/input.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h> #include <linux/gpio.h>
...@@ -46,32 +46,34 @@ static bool rb532_button_pressed(void) ...@@ -46,32 +46,34 @@ static bool rb532_button_pressed(void)
return !val; return !val;
} }
static void rb532_button_poll(struct input_polled_dev *poll_dev) static void rb532_button_poll(struct input_dev *input)
{ {
input_report_key(poll_dev->input, RB532_BTN_KSYM, input_report_key(input, RB532_BTN_KSYM, rb532_button_pressed());
rb532_button_pressed()); input_sync(input);
input_sync(poll_dev->input);
} }
static int rb532_button_probe(struct platform_device *pdev) static int rb532_button_probe(struct platform_device *pdev)
{ {
struct input_polled_dev *poll_dev; struct input_dev *input;
int error; int error;
poll_dev = devm_input_allocate_polled_device(&pdev->dev); input = devm_input_allocate_device(&pdev->dev);
if (!poll_dev) if (!input)
return -ENOMEM; return -ENOMEM;
poll_dev->poll = rb532_button_poll; input->name = "rb532 button";
poll_dev->poll_interval = RB532_BTN_RATE; input->phys = "rb532/button0";
input->id.bustype = BUS_HOST;
poll_dev->input->name = "rb532 button"; input_set_capability(input, EV_KEY, RB532_BTN_KSYM);
poll_dev->input->phys = "rb532/button0";
poll_dev->input->id.bustype = BUS_HOST;
input_set_capability(poll_dev->input, EV_KEY, RB532_BTN_KSYM); error = input_setup_polling(input, rb532_button_poll);
if (error)
return error;
input_set_poll_interval(input, RB532_BTN_RATE);
error = input_register_polled_device(poll_dev); error = input_register_device(input);
if (error) if (error)
return error; return error;
......
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