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

Input: touchsceen - convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Kees Cook and committed by
Dmitry Torokhov
ee03e3f0 4ea40278

+18 -18
+3 -3
drivers/input/touchscreen/ad7879.c
··· 237 237 input_sync(input_dev); 238 238 } 239 239 240 - static void ad7879_timer(unsigned long handle) 240 + static void ad7879_timer(struct timer_list *t) 241 241 { 242 - struct ad7879 *ts = (void *)handle; 242 + struct ad7879 *ts = from_timer(ts, t, timer); 243 243 244 244 ad7879_ts_event_release(ts); 245 245 } ··· 570 570 ts->irq = irq; 571 571 ts->regmap = regmap; 572 572 573 - setup_timer(&ts->timer, ad7879_timer, (unsigned long) ts); 573 + timer_setup(&ts->timer, ad7879_timer, 0); 574 574 snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(dev)); 575 575 576 576 input_dev->name = "AD7879 Touchscreen";
+6 -4
drivers/input/touchscreen/atmel-wm97xx.c
··· 208 208 } 209 209 } 210 210 211 - static void atmel_wm97xx_pen_timer(unsigned long data) 211 + static void atmel_wm97xx_pen_timer(struct timer_list *t) 212 212 { 213 - atmel_wm97xx_acc_pen_up((struct wm97xx *)data); 213 + struct atmel_wm97xx *atmel_wm97xx = from_timer(atmel_wm97xx, t, 214 + pen_timer); 215 + 216 + atmel_wm97xx_acc_pen_up(atmel_wm97xx->wm); 214 217 } 215 218 216 219 static int atmel_wm97xx_acc_startup(struct wm97xx *wm) ··· 351 348 atmel_wm97xx->gpio_pen = atmel_gpio_line; 352 349 atmel_wm97xx->gpio_irq = gpio_to_irq(atmel_wm97xx->gpio_pen); 353 350 354 - setup_timer(&atmel_wm97xx->pen_timer, atmel_wm97xx_pen_timer, 355 - (unsigned long)wm); 351 + timer_setup(&atmel_wm97xx->pen_timer, atmel_wm97xx_pen_timer, 0); 356 352 357 353 ret = request_irq(atmel_wm97xx->ac97c_irq, 358 354 atmel_wm97xx_channel_b_interrupt,
+3 -4
drivers/input/touchscreen/cyttsp4_core.c
··· 1237 1237 del_timer_sync(&cd->watchdog_timer); 1238 1238 } 1239 1239 1240 - static void cyttsp4_watchdog_timer(unsigned long handle) 1240 + static void cyttsp4_watchdog_timer(struct timer_list *t) 1241 1241 { 1242 - struct cyttsp4 *cd = (struct cyttsp4 *)handle; 1242 + struct cyttsp4 *cd = from_timer(cd, t, watchdog_timer); 1243 1243 1244 1244 dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__); 1245 1245 ··· 2074 2074 } 2075 2075 2076 2076 /* Setup watchdog timer */ 2077 - setup_timer(&cd->watchdog_timer, cyttsp4_watchdog_timer, 2078 - (unsigned long)cd); 2077 + timer_setup(&cd->watchdog_timer, cyttsp4_watchdog_timer, 0); 2079 2078 2080 2079 /* 2081 2080 * call startup directly to ensure that the device
+3 -3
drivers/input/touchscreen/tsc200x-core.c
··· 202 202 return IRQ_HANDLED; 203 203 } 204 204 205 - static void tsc200x_penup_timer(unsigned long data) 205 + static void tsc200x_penup_timer(struct timer_list *t) 206 206 { 207 - struct tsc200x *ts = (struct tsc200x *)data; 207 + struct tsc200x *ts = from_timer(ts, t, penup_timer); 208 208 unsigned long flags; 209 209 210 210 spin_lock_irqsave(&ts->lock, flags); ··· 506 506 mutex_init(&ts->mutex); 507 507 508 508 spin_lock_init(&ts->lock); 509 - setup_timer(&ts->penup_timer, tsc200x_penup_timer, (unsigned long)ts); 509 + timer_setup(&ts->penup_timer, tsc200x_penup_timer, 0); 510 510 511 511 INIT_DELAYED_WORK(&ts->esd_work, tsc200x_esd_work); 512 512
+3 -4
drivers/input/touchscreen/w90p910_ts.c
··· 146 146 return IRQ_HANDLED; 147 147 } 148 148 149 - static void w90p910_check_pen_up(unsigned long data) 149 + static void w90p910_check_pen_up(struct timer_list *t) 150 150 { 151 - struct w90p910_ts *w90p910_ts = (struct w90p910_ts *) data; 151 + struct w90p910_ts *w90p910_ts = from_timer(w90p910_ts, t, timer); 152 152 unsigned long flags; 153 153 154 154 spin_lock_irqsave(&w90p910_ts->lock, flags); ··· 232 232 w90p910_ts->input = input_dev; 233 233 w90p910_ts->state = TS_IDLE; 234 234 spin_lock_init(&w90p910_ts->lock); 235 - setup_timer(&w90p910_ts->timer, w90p910_check_pen_up, 236 - (unsigned long)w90p910_ts); 235 + timer_setup(&w90p910_ts->timer, w90p910_check_pen_up, 0); 237 236 238 237 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 239 238 if (!res) {