Skip to content

Commit 5d96738

Browse files
committed
Input: cobalt_btns - 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 cobalt_btns 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 4d69ca9 commit 5d96738

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

drivers/input/misc/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ config INPUT_IXP4XX_BEEPER
326326
config INPUT_COBALT_BTNS
327327
tristate "Cobalt button interface"
328328
depends on MIPS_COBALT
329-
select INPUT_POLLDEV
330329
help
331330
Say Y here if you want to support MIPS Cobalt button interface.
332331

drivers/input/misc/cobalt_btns.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright (C) 2007-2008 Yoichi Yuasa <[email protected]>
66
*/
7-
#include <linux/input-polldev.h>
7+
#include <linux/input.h>
88
#include <linux/io.h>
99
#include <linux/ioport.h>
1010
#include <linux/module.h>
@@ -32,10 +32,9 @@ struct buttons_dev {
3232
void __iomem *reg;
3333
};
3434

35-
static void handle_buttons(struct input_polled_dev *dev)
35+
static void handle_buttons(struct input_dev *input)
3636
{
37-
struct buttons_dev *bdev = dev->private;
38-
struct input_dev *input = dev->input;
37+
struct buttons_dev *bdev = input_get_drvdata(input);
3938
uint32_t status;
4039
int i;
4140

@@ -62,7 +61,6 @@ static void handle_buttons(struct input_polled_dev *dev)
6261
static int cobalt_buttons_probe(struct platform_device *pdev)
6362
{
6463
struct buttons_dev *bdev;
65-
struct input_polled_dev *poll_dev;
6664
struct input_dev *input;
6765
struct resource *res;
6866
int error, i;
@@ -81,15 +79,12 @@ static int cobalt_buttons_probe(struct platform_device *pdev)
8179

8280
memcpy(bdev->keymap, cobalt_map, sizeof(bdev->keymap));
8381

84-
poll_dev = devm_input_allocate_polled_device(&pdev->dev);
85-
if (!poll_dev)
82+
input = devm_input_allocate_device(&pdev->dev);
83+
if (!input)
8684
return -ENOMEM;
8785

88-
poll_dev->private = bdev;
89-
poll_dev->poll = handle_buttons;
90-
poll_dev->poll_interval = BUTTONS_POLL_INTERVAL;
86+
input_set_drvdata(input, bdev);
9187

92-
input = poll_dev->input;
9388
input->name = "Cobalt buttons";
9489
input->phys = "cobalt/input0";
9590
input->id.bustype = BUS_HOST;
@@ -104,7 +99,14 @@ static int cobalt_buttons_probe(struct platform_device *pdev)
10499
__set_bit(bdev->keymap[i], input->keybit);
105100
__clear_bit(KEY_RESERVED, input->keybit);
106101

107-
error = input_register_polled_device(poll_dev);
102+
103+
error = input_setup_polling(input, handle_buttons);
104+
if (error)
105+
return error;
106+
107+
input_set_poll_interval(input, BUTTONS_POLL_INTERVAL);
108+
109+
error = input_register_device(input);
108110
if (error)
109111
return error;
110112

0 commit comments

Comments
 (0)