Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+17 -16
-1
drivers/input/misc/Kconfig
··· 633 633 tristate "Mikrotik Routerboard 532 button interface" 634 634 depends on MIKROTIK_RB532 635 635 depends on GPIOLIB 636 - select INPUT_POLLDEV 637 636 help 638 637 Say Y here if you want support for the S1 button built into 639 638 Mikrotik's Routerboard 532.
+17 -15
drivers/input/misc/rb532_button.c
··· 5 5 * Copyright (C) 2009 Phil Sutter <n0-1@freewrt.org> 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 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 73 74 - error = input_register_polled_device(poll_dev); 74 + input_set_poll_interval(input, RB532_BTN_RATE); 75 + 76 + error = input_register_device(input); 75 77 if (error) 76 78 return error; 77 79