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

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

+13 -13
-1
drivers/input/misc/Kconfig
··· 543 543 config INPUT_SGI_BTNS 544 544 tristate "SGI Indy/O2 volume button interface" 545 545 depends on SGI_IP22 || SGI_IP32 546 - select INPUT_POLLDEV 547 546 help 548 547 Say Y here if you want to support SGI Indy/O2 volume button interface. 549 548
+13 -12
drivers/input/misc/sgi_btns.c
··· 4 4 * 5 5 * Copyright (C) 2008 Thomas Bogendoerfer <tsbogend@alpha.franken.de> 6 6 */ 7 - #include <linux/input-polldev.h> 7 + #include <linux/input.h> 8 8 #include <linux/ioport.h> 9 9 #include <linux/module.h> 10 10 #include <linux/platform_device.h> ··· 49 49 int count[ARRAY_SIZE(sgi_map)]; 50 50 }; 51 51 52 - static void handle_buttons(struct input_polled_dev *dev) 52 + static void handle_buttons(struct input_dev *input) 53 53 { 54 - struct buttons_dev *bdev = dev->private; 55 - struct input_dev *input = dev->input; 54 + struct buttons_dev *bdev = input_get_drvdata(input); 56 55 u8 status; 57 56 int i; 58 57 ··· 78 79 static int sgi_buttons_probe(struct platform_device *pdev) 79 80 { 80 81 struct buttons_dev *bdev; 81 - struct input_polled_dev *poll_dev; 82 82 struct input_dev *input; 83 83 int error, i; 84 84 ··· 85 87 if (!bdev) 86 88 return -ENOMEM; 87 89 88 - poll_dev = devm_input_allocate_polled_device(&pdev->dev); 89 - if (!poll_dev) 90 + input = devm_input_allocate_device(&pdev->dev); 91 + if (!input) 90 92 return -ENOMEM; 91 93 92 94 memcpy(bdev->keymap, sgi_map, sizeof(bdev->keymap)); 93 95 94 - poll_dev->private = bdev; 95 - poll_dev->poll = handle_buttons; 96 - poll_dev->poll_interval = BUTTONS_POLL_INTERVAL; 96 + input_set_drvdata(input, bdev); 97 97 98 - input = poll_dev->input; 99 98 input->name = "SGI buttons"; 100 99 input->phys = "sgi/input0"; 101 100 input->id.bustype = BUS_HOST; ··· 107 112 __set_bit(bdev->keymap[i], input->keybit); 108 113 __clear_bit(KEY_RESERVED, input->keybit); 109 114 110 - error = input_register_polled_device(poll_dev); 115 + error = input_setup_polling(input, handle_buttons); 116 + if (error) 117 + return error; 118 + 119 + input_set_poll_interval(input, BUTTONS_POLL_INTERVAL); 120 + 121 + error = input_register_device(input); 111 122 if (error) 112 123 return error; 113 124