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

Input: tsc6507x-ts - 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 tsc6507x-ts driver to use the
polling mode of standard input devices and removes dependency on
INPUT_POLLDEV.

Link: https://lore.kernel.org/r/20191017204217.106453-5-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+17 -20
-1
drivers/input/touchscreen/Kconfig
··· 1243 1243 config TOUCHSCREEN_TPS6507X 1244 1244 tristate "TPS6507x based touchscreens" 1245 1245 depends on I2C 1246 - select INPUT_POLLDEV 1247 1246 help 1248 1247 Say Y here if you have a TPS6507x based touchscreen 1249 1248 controller.
+17 -19
drivers/input/touchscreen/tps6507x-ts.c
··· 17 17 #include <linux/workqueue.h> 18 18 #include <linux/slab.h> 19 19 #include <linux/input.h> 20 - #include <linux/input-polldev.h> 21 20 #include <linux/platform_device.h> 22 21 #include <linux/mfd/tps6507x.h> 23 22 #include <linux/input/tps6507x-ts.h> ··· 39 40 40 41 struct tps6507x_ts { 41 42 struct device *dev; 42 - struct input_polled_dev *poll_dev; 43 + struct input_dev *input; 43 44 struct tps6507x_dev *mfd; 44 45 char phys[32]; 45 46 struct ts_event tc; ··· 147 148 return ret; 148 149 } 149 150 150 - static void tps6507x_ts_poll(struct input_polled_dev *poll_dev) 151 + static void tps6507x_ts_poll(struct input_dev *input_dev) 151 152 { 152 - struct tps6507x_ts *tsc = poll_dev->private; 153 - struct input_dev *input_dev = poll_dev->input; 153 + struct tps6507x_ts *tsc = input_get_drvdata(input_dev); 154 154 bool pendown; 155 155 s32 ret; 156 156 ··· 203 205 const struct tps6507x_board *tps_board; 204 206 const struct touchscreen_init_data *init_data; 205 207 struct tps6507x_ts *tsc; 206 - struct input_polled_dev *poll_dev; 207 208 struct input_dev *input_dev; 208 209 int error; 209 210 ··· 237 240 snprintf(tsc->phys, sizeof(tsc->phys), 238 241 "%s/input0", dev_name(tsc->dev)); 239 242 240 - poll_dev = devm_input_allocate_polled_device(&pdev->dev); 241 - if (!poll_dev) { 243 + input_dev = devm_input_allocate_device(&pdev->dev); 244 + if (!input_dev) { 242 245 dev_err(tsc->dev, "Failed to allocate polled input device.\n"); 243 246 return -ENOMEM; 244 247 } 245 248 246 - tsc->poll_dev = poll_dev; 249 + tsc->input = input_dev; 250 + input_set_drvdata(input_dev, tsc); 247 251 248 - poll_dev->private = tsc; 249 - poll_dev->poll = tps6507x_ts_poll; 250 - poll_dev->poll_interval = init_data ? 251 - init_data->poll_period : TSC_DEFAULT_POLL_PERIOD; 252 - 253 - input_dev = poll_dev->input; 254 - input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); 255 - input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); 256 - 252 + input_set_capability(input_dev, EV_KEY, BTN_TOUCH); 257 253 input_set_abs_params(input_dev, ABS_X, 0, MAX_10BIT, 0, 0); 258 254 input_set_abs_params(input_dev, ABS_Y, 0, MAX_10BIT, 0, 0); 259 255 input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_10BIT, 0, 0); ··· 265 275 if (error) 266 276 return error; 267 277 268 - error = input_register_polled_device(poll_dev); 278 + error = input_setup_polling(input_dev, tps6507x_ts_poll); 279 + if (error) 280 + return error; 281 + 282 + input_set_poll_interval(input_dev, 283 + init_data ? init_data->poll_period : 284 + TSC_DEFAULT_POLL_PERIOD); 285 + 286 + error = input_register_device(input_dev); 269 287 if (error) 270 288 return error; 271 289