|
5 | 5 | * Copyright (C) 2009 Phil Sutter <[email protected]>
|
6 | 6 | */
|
7 | 7 |
|
8 |
| -#include <linux/input-polldev.h> |
| 8 | +#include <linux/input.h> |
9 | 9 | #include <linux/module.h>
|
10 | 10 | #include <linux/platform_device.h>
|
11 | 11 | #include <linux/gpio.h>
|
@@ -46,32 +46,34 @@ static bool rb532_button_pressed(void)
|
46 | 46 | return !val;
|
47 | 47 | }
|
48 | 48 |
|
49 |
| -static void rb532_button_poll(struct input_polled_dev *poll_dev) |
| 49 | +static void rb532_button_poll(struct input_dev *input) |
50 | 50 | {
|
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); |
54 | 53 | }
|
55 | 54 |
|
56 | 55 | static int rb532_button_probe(struct platform_device *pdev)
|
57 | 56 | {
|
58 |
| - struct input_polled_dev *poll_dev; |
| 57 | + struct input_dev *input; |
59 | 58 | int error;
|
60 | 59 |
|
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) |
63 | 62 | return -ENOMEM;
|
64 | 63 |
|
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; |
67 | 67 |
|
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); |
71 | 69 |
|
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); |
73 | 75 |
|
74 |
| - error = input_register_polled_device(poll_dev); |
| 76 | + error = input_register_device(input); |
75 | 77 | if (error)
|
76 | 78 | return error;
|
77 | 79 |
|
|
0 commit comments