aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-10-24 12:40:57 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-10-24 13:04:44 -0400
commit4ea40278eb463aaa95889b00be78f8a56bb61131 (patch)
tree974f097739023f20473f495db31b6ffae20df826
parenta11bc476b987925654369411dd8281a60cb5a175 (diff)
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>
-rw-r--r--drivers/input/keyboard/bf54x-keys.c7
-rw-r--r--drivers/input/keyboard/imx_keypad.c8
-rw-r--r--drivers/input/keyboard/locomokbd.c7
-rw-r--r--drivers/input/keyboard/omap-keypad.c6
-rw-r--r--drivers/input/keyboard/snvs_pwrkey.c7
-rw-r--r--drivers/input/keyboard/tegra-kbc.c6
6 files changed, 19 insertions, 22 deletions
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c
index 39bcbc38997f..8a07a426f88e 100644
--- a/drivers/input/keyboard/bf54x-keys.c
+++ b/drivers/input/keyboard/bf54x-keys.c
@@ -127,10 +127,9 @@ static inline void bfin_kpad_clear_irq(void)
127 bfin_write_KPAD_ROWCOL(0xFFFF); 127 bfin_write_KPAD_ROWCOL(0xFFFF);
128} 128}
129 129
130static void bfin_kpad_timer(unsigned long data) 130static void bfin_kpad_timer(struct timer_list *t)
131{ 131{
132 struct platform_device *pdev = (struct platform_device *) data; 132 struct bf54x_kpad *bf54x_kpad = from_timer(bf54x_kpad, t, timer);
133 struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
134 133
135 if (bfin_kpad_get_keypressed(bf54x_kpad)) { 134 if (bfin_kpad_get_keypressed(bf54x_kpad)) {
136 /* Try again later */ 135 /* Try again later */
@@ -298,7 +297,7 @@ static int bfin_kpad_probe(struct platform_device *pdev)
298 297
299 /* Init Keypad Key Up/Release test timer */ 298 /* Init Keypad Key Up/Release test timer */
300 299
301 setup_timer(&bf54x_kpad->timer, bfin_kpad_timer, (unsigned long) pdev); 300 timer_setup(&bf54x_kpad->timer, bfin_kpad_timer, 0);
302 301
303 bfin_write_KPAD_PRESCALE(bfin_kpad_get_prescale(TIME_SCALE)); 302 bfin_write_KPAD_PRESCALE(bfin_kpad_get_prescale(TIME_SCALE));
304 303
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c
index 2165f3dd328b..25d61d8d4fc4 100644
--- a/drivers/input/keyboard/imx_keypad.c
+++ b/drivers/input/keyboard/imx_keypad.c
@@ -184,9 +184,9 @@ static void imx_keypad_fire_events(struct imx_keypad *keypad,
184/* 184/*
185 * imx_keypad_check_for_events is the timer handler. 185 * imx_keypad_check_for_events is the timer handler.
186 */ 186 */
187static void imx_keypad_check_for_events(unsigned long data) 187static 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 unsigned short matrix_volatile_state[MAX_MATRIX_KEY_COLS]; 190 unsigned short matrix_volatile_state[MAX_MATRIX_KEY_COLS];
191 unsigned short reg_val; 191 unsigned short reg_val;
192 bool state_changed, is_zero_matrix; 192 bool state_changed, is_zero_matrix;
@@ -456,8 +456,8 @@ static int imx_keypad_probe(struct platform_device *pdev)
456 keypad->irq = irq; 456 keypad->irq = irq;
457 keypad->stable_count = 0; 457 keypad->stable_count = 0;
458 458
459 setup_timer(&keypad->check_matrix_timer, 459 timer_setup(&keypad->check_matrix_timer,
460 imx_keypad_check_for_events, (unsigned long) keypad); 460 imx_keypad_check_for_events, 0);
461 461
462 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 462 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
463 keypad->mmio_base = devm_ioremap_resource(&pdev->dev, res); 463 keypad->mmio_base = devm_ioremap_resource(&pdev->dev, res);
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
index 0d74312d5b02..30d610758595 100644
--- a/drivers/input/keyboard/locomokbd.c
+++ b/drivers/input/keyboard/locomokbd.c
@@ -210,9 +210,9 @@ static irqreturn_t locomokbd_interrupt(int irq, void *dev_id)
210/* 210/*
211 * LoCoMo timer checking for released keys 211 * LoCoMo timer checking for released keys
212 */ 212 */
213static void locomokbd_timer_callback(unsigned long data) 213static 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 locomokbd_scankeyboard(locomokbd); 217 locomokbd_scankeyboard(locomokbd);
218} 218}
@@ -264,8 +264,7 @@ static int locomokbd_probe(struct locomo_dev *dev)
264 264
265 spin_lock_init(&locomokbd->lock); 265 spin_lock_init(&locomokbd->lock);
266 266
267 setup_timer(&locomokbd->timer, locomokbd_timer_callback, 267 timer_setup(&locomokbd->timer, locomokbd_timer_callback, 0);
268 (unsigned long)locomokbd);
269 268
270 locomokbd->suspend_jiffies = jiffies; 269 locomokbd->suspend_jiffies = jiffies;
271 270
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index 146b26f665f6..7bd107910a6e 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -41,7 +41,7 @@
41#undef NEW_BOARD_LEARNING_MODE 41#undef NEW_BOARD_LEARNING_MODE
42 42
43static void omap_kp_tasklet(unsigned long); 43static void omap_kp_tasklet(unsigned long);
44static void omap_kp_timer(unsigned long); 44static void omap_kp_timer(struct timer_list *);
45 45
46static unsigned char keypad_state[8]; 46static unsigned char keypad_state[8];
47static DEFINE_MUTEX(kp_enable_mutex); 47static DEFINE_MUTEX(kp_enable_mutex);
@@ -74,7 +74,7 @@ static irqreturn_t omap_kp_interrupt(int irq, void *dev_id)
74 return IRQ_HANDLED; 74 return IRQ_HANDLED;
75} 75}
76 76
77static void omap_kp_timer(unsigned long data) 77static void omap_kp_timer(struct timer_list *unused)
78{ 78{
79 tasklet_schedule(&kp_tasklet); 79 tasklet_schedule(&kp_tasklet);
80} 80}
@@ -233,7 +233,7 @@ static int omap_kp_probe(struct platform_device *pdev)
233 col_idx = 0; 233 col_idx = 0;
234 row_idx = 0; 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 /* get the irq and init timer*/ 238 /* get the irq and init timer*/
239 kp_tasklet.data = (unsigned long) omap_kp; 239 kp_tasklet.data = (unsigned long) omap_kp;
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index 7544888c4749..53c768b95939 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -45,9 +45,9 @@ struct pwrkey_drv_data {
45 struct input_dev *input; 45 struct input_dev *input;
46}; 46};
47 47
48static void imx_imx_snvs_check_for_events(unsigned long data) 48static 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 struct input_dev *input = pdata->input; 51 struct input_dev *input = pdata->input;
52 u32 state; 52 u32 state;
53 53
@@ -134,8 +134,7 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
134 /* clear the unexpected interrupt before driver ready */ 134 /* clear the unexpected interrupt before driver ready */
135 regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO); 135 regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
136 136
137 setup_timer(&pdata->check_timer, 137 timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0);
138 imx_imx_snvs_check_for_events, (unsigned long) pdata);
139 138
140 input = devm_input_allocate_device(&pdev->dev); 139 input = devm_input_allocate_device(&pdev->dev);
141 if (!input) { 140 if (!input) {
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
index edc1385ca00b..875205f445b5 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -251,9 +251,9 @@ static void tegra_kbc_set_fifo_interrupt(struct tegra_kbc *kbc, bool enable)
251 writel(val, kbc->mmio + KBC_CONTROL_0); 251 writel(val, kbc->mmio + KBC_CONTROL_0);
252} 252}
253 253
254static void tegra_kbc_keypress_timer(unsigned long data) 254static 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 unsigned long flags; 257 unsigned long flags;
258 u32 val; 258 u32 val;
259 unsigned int i; 259 unsigned int i;
@@ -655,7 +655,7 @@ static int tegra_kbc_probe(struct platform_device *pdev)
655 return -ENOMEM; 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 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 660 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
661 kbc->mmio = devm_ioremap_resource(&pdev->dev, res); 661 kbc->mmio = devm_ioremap_resource(&pdev->dev, res);