Skip to content

Commit aede7a1

Browse files
committed
Input: sgi_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 sgi_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 9e085dd commit aede7a1

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

drivers/input/misc/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,6 @@ config INPUT_UINPUT
543543
config INPUT_SGI_BTNS
544544
tristate "SGI Indy/O2 volume button interface"
545545
depends on SGI_IP22 || SGI_IP32
546-
select INPUT_POLLDEV
547546
help
548547
Say Y here if you want to support SGI Indy/O2 volume button interface.
549548

drivers/input/misc/sgi_btns.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright (C) 2008 Thomas Bogendoerfer <[email protected]>
66
*/
7-
#include <linux/input-polldev.h>
7+
#include <linux/input.h>
88
#include <linux/ioport.h>
99
#include <linux/module.h>
1010
#include <linux/platform_device.h>
@@ -49,10 +49,9 @@ struct buttons_dev {
4949
int count[ARRAY_SIZE(sgi_map)];
5050
};
5151

52-
static void handle_buttons(struct input_polled_dev *dev)
52+
static void handle_buttons(struct input_dev *input)
5353
{
54-
struct buttons_dev *bdev = dev->private;
55-
struct input_dev *input = dev->input;
54+
struct buttons_dev *bdev = input_get_drvdata(input);
5655
u8 status;
5756
int i;
5857

@@ -79,25 +78,21 @@ static void handle_buttons(struct input_polled_dev *dev)
7978
static int sgi_buttons_probe(struct platform_device *pdev)
8079
{
8180
struct buttons_dev *bdev;
82-
struct input_polled_dev *poll_dev;
8381
struct input_dev *input;
8482
int error, i;
8583

8684
bdev = devm_kzalloc(&pdev->dev, sizeof(*bdev), GFP_KERNEL);
8785
if (!bdev)
8886
return -ENOMEM;
8987

90-
poll_dev = devm_input_allocate_polled_device(&pdev->dev);
91-
if (!poll_dev)
88+
input = devm_input_allocate_device(&pdev->dev);
89+
if (!input)
9290
return -ENOMEM;
9391

9492
memcpy(bdev->keymap, sgi_map, sizeof(bdev->keymap));
9593

96-
poll_dev->private = bdev;
97-
poll_dev->poll = handle_buttons;
98-
poll_dev->poll_interval = BUTTONS_POLL_INTERVAL;
94+
input_set_drvdata(input, bdev);
9995

100-
input = poll_dev->input;
10196
input->name = "SGI buttons";
10297
input->phys = "sgi/input0";
10398
input->id.bustype = BUS_HOST;
@@ -112,7 +107,13 @@ static int sgi_buttons_probe(struct platform_device *pdev)
112107
__set_bit(bdev->keymap[i], input->keybit);
113108
__clear_bit(KEY_RESERVED, input->keybit);
114109

115-
error = input_register_polled_device(poll_dev);
110+
error = input_setup_polling(input, handle_buttons);
111+
if (error)
112+
return error;
113+
114+
input_set_poll_interval(input, BUTTONS_POLL_INTERVAL);
115+
116+
error = input_register_device(input);
116117
if (error)
117118
return error;
118119

0 commit comments

Comments
 (0)