aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-10-19 19:40:49 -0400
committerKees Cook <keescook@chromium.org>2017-11-02 18:50:33 -0400
commitd8479a21a98baf1bb50426986d15605cee96ec36 (patch)
tree63415254d6cbd1b4065a01772702d23aceea75c8
parent3142692a5e94a45a50abd78b4ae1c52f75eae41e (diff)
xtensa: 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. Cc: Chris Zankel <chris@zankel.net> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: linux-xtensa@linux-xtensa.org Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r--arch/xtensa/platforms/iss/console.c9
-rw-r--r--arch/xtensa/platforms/iss/network.c13
2 files changed, 9 insertions, 13 deletions
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 0140a22551c8..464c2684c4f1 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -47,15 +47,14 @@ static char *serial_name = "ISS serial driver";
47 * initialization for the tty structure. 47 * initialization for the tty structure.
48 */ 48 */
49 49
50static void rs_poll(unsigned long); 50static void rs_poll(struct timer_list *);
51 51
52static int rs_open(struct tty_struct *tty, struct file * filp) 52static int rs_open(struct tty_struct *tty, struct file * filp)
53{ 53{
54 tty->port = &serial_port; 54 tty->port = &serial_port;
55 spin_lock_bh(&timer_lock); 55 spin_lock_bh(&timer_lock);
56 if (tty->count == 1) { 56 if (tty->count == 1) {
57 setup_timer(&serial_timer, rs_poll, 57 timer_setup(&serial_timer, rs_poll, 0);
58 (unsigned long)&serial_port);
59 mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE); 58 mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
60 } 59 }
61 spin_unlock_bh(&timer_lock); 60 spin_unlock_bh(&timer_lock);
@@ -92,9 +91,9 @@ static int rs_write(struct tty_struct * tty,
92 return count; 91 return count;
93} 92}
94 93
95static void rs_poll(unsigned long priv) 94static void rs_poll(struct timer_list *unused)
96{ 95{
97 struct tty_port *port = (struct tty_port *)priv; 96 struct tty_port *port = &serial_port;
98 int i = 0; 97 int i = 0;
99 int rd = 1; 98 int rd = 1;
100 unsigned char c; 99 unsigned char c;
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index 66a5d15a9e0e..6363b18e5b8c 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -349,9 +349,9 @@ static int iss_net_poll(void)
349} 349}
350 350
351 351
352static void iss_net_timer(unsigned long priv) 352static void iss_net_timer(struct timer_list *t)
353{ 353{
354 struct iss_net_private *lp = (struct iss_net_private *)priv; 354 struct iss_net_private *lp = from_timer(lp, t, timer);
355 355
356 iss_net_poll(); 356 iss_net_poll();
357 spin_lock(&lp->lock); 357 spin_lock(&lp->lock);
@@ -386,10 +386,8 @@ static int iss_net_open(struct net_device *dev)
386 spin_unlock_bh(&opened_lock); 386 spin_unlock_bh(&opened_lock);
387 spin_lock_bh(&lp->lock); 387 spin_lock_bh(&lp->lock);
388 388
389 init_timer(&lp->timer); 389 timer_setup(&lp->timer, iss_net_timer, 0);
390 lp->timer_val = ISS_NET_TIMER_VALUE; 390 lp->timer_val = ISS_NET_TIMER_VALUE;
391 lp->timer.data = (unsigned long) lp;
392 lp->timer.function = iss_net_timer;
393 mod_timer(&lp->timer, jiffies + lp->timer_val); 391 mod_timer(&lp->timer, jiffies + lp->timer_val);
394 392
395out: 393out:
@@ -482,7 +480,7 @@ static int iss_net_change_mtu(struct net_device *dev, int new_mtu)
482 return -EINVAL; 480 return -EINVAL;
483} 481}
484 482
485void iss_net_user_timer_expire(unsigned long _conn) 483void iss_net_user_timer_expire(struct timer_list *unused)
486{ 484{
487} 485}
488 486
@@ -582,8 +580,7 @@ static int iss_net_configure(int index, char *init)
582 return 1; 580 return 1;
583 } 581 }
584 582
585 init_timer(&lp->tl); 583 timer_setup(&lp->tl, iss_net_user_timer_expire, 0);
586 lp->tl.function = iss_net_user_timer_expire;
587 584
588 return 0; 585 return 0;
589 586