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

Input: keyboard - 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
4ea40278 a11bc476

+19 -22
+3 -4
drivers/input/keyboard/bf54x-keys.c
··· 127 127 bfin_write_KPAD_ROWCOL(0xFFFF); 128 128 } 129 129 130 - static void bfin_kpad_timer(unsigned long data) 130 + static void bfin_kpad_timer(struct timer_list *t) 131 131 { 132 - struct platform_device *pdev = (struct platform_device *) data; 133 - struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev); 132 + struct bf54x_kpad *bf54x_kpad = from_timer(bf54x_kpad, t, timer); 134 133 135 134 if (bfin_kpad_get_keypressed(bf54x_kpad)) { 136 135 /* Try again later */ ··· 297 298 298 299 /* Init Keypad Key Up/Release test timer */ 299 300 300 - setup_timer(&bf54x_kpad->timer, bfin_kpad_timer, (unsigned long) pdev); 301 + timer_setup(&bf54x_kpad->timer, bfin_kpad_timer, 0); 301 302 302 303 bfin_write_KPAD_PRESCALE(bfin_kpad_get_prescale(TIME_SCALE)); 303 304
+4 -4
drivers/input/keyboard/imx_keypad.c
··· 184 184 /* 185 185 * imx_keypad_check_for_events is the timer handler. 186 186 */ 187 - static void imx_keypad_check_for_events(unsigned long data) 187 + static void imx_keypad_check_for_events(struct timer_list *t) 188 188 { 189 - struct imx_keypad *keypad = (struct imx_keypad *) data; 189 + struct imx_keypad *keypad = from_timer(keypad, t, check_matrix_timer); 190 190 unsigned short matrix_volatile_state[MAX_MATRIX_KEY_COLS]; 191 191 unsigned short reg_val; 192 192 bool state_changed, is_zero_matrix; ··· 456 456 keypad->irq = irq; 457 457 keypad->stable_count = 0; 458 458 459 - setup_timer(&keypad->check_matrix_timer, 460 - imx_keypad_check_for_events, (unsigned long) keypad); 459 + timer_setup(&keypad->check_matrix_timer, 460 + imx_keypad_check_for_events, 0); 461 461 462 462 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 463 463 keypad->mmio_base = devm_ioremap_resource(&pdev->dev, res);
+3 -4
drivers/input/keyboard/locomokbd.c
··· 210 210 /* 211 211 * LoCoMo timer checking for released keys 212 212 */ 213 - static void locomokbd_timer_callback(unsigned long data) 213 + static void locomokbd_timer_callback(struct timer_list *t) 214 214 { 215 - struct locomokbd *locomokbd = (struct locomokbd *) data; 215 + struct locomokbd *locomokbd = from_timer(locomokbd, t, timer); 216 216 217 217 locomokbd_scankeyboard(locomokbd); 218 218 } ··· 264 264 265 265 spin_lock_init(&locomokbd->lock); 266 266 267 - setup_timer(&locomokbd->timer, locomokbd_timer_callback, 268 - (unsigned long)locomokbd); 267 + timer_setup(&locomokbd->timer, locomokbd_timer_callback, 0); 269 268 270 269 locomokbd->suspend_jiffies = jiffies; 271 270
+3 -3
drivers/input/keyboard/omap-keypad.c
··· 41 41 #undef NEW_BOARD_LEARNING_MODE 42 42 43 43 static void omap_kp_tasklet(unsigned long); 44 - static void omap_kp_timer(unsigned long); 44 + static void omap_kp_timer(struct timer_list *); 45 45 46 46 static unsigned char keypad_state[8]; 47 47 static DEFINE_MUTEX(kp_enable_mutex); ··· 74 74 return IRQ_HANDLED; 75 75 } 76 76 77 - static void omap_kp_timer(unsigned long data) 77 + static void omap_kp_timer(struct timer_list *unused) 78 78 { 79 79 tasklet_schedule(&kp_tasklet); 80 80 } ··· 233 233 col_idx = 0; 234 234 row_idx = 0; 235 235 236 - setup_timer(&omap_kp->timer, omap_kp_timer, (unsigned long)omap_kp); 236 + timer_setup(&omap_kp->timer, omap_kp_timer, 0); 237 237 238 238 /* get the irq and init timer*/ 239 239 kp_tasklet.data = (unsigned long) omap_kp;
+3 -4
drivers/input/keyboard/snvs_pwrkey.c
··· 45 45 struct input_dev *input; 46 46 }; 47 47 48 - static void imx_imx_snvs_check_for_events(unsigned long data) 48 + static void imx_imx_snvs_check_for_events(struct timer_list *t) 49 49 { 50 - struct pwrkey_drv_data *pdata = (struct pwrkey_drv_data *) data; 50 + struct pwrkey_drv_data *pdata = from_timer(pdata, t, check_timer); 51 51 struct input_dev *input = pdata->input; 52 52 u32 state; 53 53 ··· 134 134 /* clear the unexpected interrupt before driver ready */ 135 135 regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO); 136 136 137 - setup_timer(&pdata->check_timer, 138 - imx_imx_snvs_check_for_events, (unsigned long) pdata); 137 + timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0); 139 138 140 139 input = devm_input_allocate_device(&pdev->dev); 141 140 if (!input) {
+3 -3
drivers/input/keyboard/tegra-kbc.c
··· 251 251 writel(val, kbc->mmio + KBC_CONTROL_0); 252 252 } 253 253 254 - static void tegra_kbc_keypress_timer(unsigned long data) 254 + static void tegra_kbc_keypress_timer(struct timer_list *t) 255 255 { 256 - struct tegra_kbc *kbc = (struct tegra_kbc *)data; 256 + struct tegra_kbc *kbc = from_timer(kbc, t, timer); 257 257 unsigned long flags; 258 258 u32 val; 259 259 unsigned int i; ··· 655 655 return -ENOMEM; 656 656 } 657 657 658 - setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc); 658 + timer_setup(&kbc->timer, tegra_kbc_keypress_timer, 0); 659 659 660 660 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 661 661 kbc->mmio = devm_ioremap_resource(&pdev->dev, res);