Skip to content

Commit 36bc368

Browse files
committed
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/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 528c7d0 commit 36bc368

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

drivers/input/misc/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,6 @@ config INPUT_RB532_BUTTON
633633
tristate "Mikrotik Routerboard 532 button interface"
634634
depends on MIKROTIK_RB532
635635
depends on GPIOLIB
636-
select INPUT_POLLDEV
637636
help
638637
Say Y here if you want support for the S1 button built into
639638
Mikrotik's Routerboard 532.

drivers/input/misc/rb532_button.c

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright (C) 2009 Phil Sutter <[email protected]>
66
*/
77

8-
#include <linux/input-polldev.h>
8+
#include <linux/input.h>
99
#include <linux/module.h>
1010
#include <linux/platform_device.h>
1111
#include <linux/gpio.h>
@@ -46,32 +46,34 @@ static bool rb532_button_pressed(void)
4646
return !val;
4747
}
4848

49-
static void rb532_button_poll(struct input_polled_dev *poll_dev)
49+
static void rb532_button_poll(struct input_dev *input)
5050
{
51-
input_report_key(poll_dev->input, RB532_BTN_KSYM,
52-
rb532_button_pressed());
53-
input_sync(poll_dev->input);
51+
input_report_key(input, RB532_BTN_KSYM, rb532_button_pressed());
52+
input_sync(input);
5453
}
5554

5655
static int rb532_button_probe(struct platform_device *pdev)
5756
{
58-
struct input_polled_dev *poll_dev;
57+
struct input_dev *input;
5958
int error;
6059

61-
poll_dev = devm_input_allocate_polled_device(&pdev->dev);
62-
if (!poll_dev)
60+
input = devm_input_allocate_device(&pdev->dev);
61+
if (!input)
6362
return -ENOMEM;
6463

65-
poll_dev->poll = rb532_button_poll;
66-
poll_dev->poll_interval = RB532_BTN_RATE;
64+
input->name = "rb532 button";
65+
input->phys = "rb532/button0";
66+
input->id.bustype = BUS_HOST;
6767

68-
poll_dev->input->name = "rb532 button";
69-
poll_dev->input->phys = "rb532/button0";
70-
poll_dev->input->id.bustype = BUS_HOST;
68+
input_set_capability(input, EV_KEY, RB532_BTN_KSYM);
7169

72-
input_set_capability(poll_dev->input, EV_KEY, RB532_BTN_KSYM);
70+
error = input_setup_polling(input, rb532_button_poll);
71+
if (error)
72+
return error;
73+
74+
input_set_poll_interval(input, RB532_BTN_RATE);
7375

74-
error = input_register_polled_device(poll_dev);
76+
error = input_register_device(input);
7577
if (error)
7678
return error;
7779

0 commit comments

Comments
 (0)