xtensa: Convert timers to use timer_setup()
PATCH 1/1 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 <[email protected]>
Cc Max Filippov <[email protected]>
Signed-off-by Kees Cook <[email protected]>
--- arch/xtensa/platforms/iss/console.c | 9 ++++----- arch/xtensa/platforms/iss/network.c | 13 +++++-------- 2 files changed, 9 insertions(+), 13 deletions(-)
arch/xtensa/platforms/iss/console.c +4 -5
@@ -47,15 +47,14 @@ static char *serial_name = "ISS serial driver";* initialization for the tty structure. */ -static void rs_poll (unsigned long ); +static void rs_poll (struct timer_list *);static int rs_open (struct tty_struct *tty,struct file * filp) { tty->port = &serial_port;spin_lock_bh (&timer_lock);if (tty->count ==1 ) { -setup_timer (&serial_timer, rs_poll, - (unsigned long )&serial_port); +timer_setup (&serial_timer, rs_poll,0 );mod_timer (&serial_timer, jiffies +SERIAL_TIMER_VALUE ); }spin_unlock_bh (&timer_lock);
@@ -92,9 +91,9 @@ static int rs_write(struct tty_struct * tty,return count; } -static void rs_poll (unsigned long priv) +static void rs_poll (struct timer_list *unused) { -struct tty_port *port = (struct tty_port *)priv; +struct tty_port *port = &serial_port;int i =0 ;int rd =1 ;unsigned char c;
arch/xtensa/platforms/iss/network.c +5 -8
@@ -349,9 +349,9 @@ static int iss_net_poll(void) } -static void iss_net_timer (unsigned long priv) +static void iss_net_timer (struct timer_list *t) { -struct iss_net_private *lp = (struct iss_net_private *)priv; +struct iss_net_private *lp =from_timer (lp, t, timer);iss_net_poll ();spin_lock (&lp->lock);
@@ -386,10 +386,8 @@ static int iss_net_open(struct net_device *dev)spin_unlock_bh (&opened_lock);spin_lock_bh (&lp->lock); -init_timer (&lp->timer); +timer_setup (&lp->timer, iss_net_timer,0 ); lp->timer_val =ISS_NET_TIMER_VALUE ; - lp->timer.data = (unsigned long ) lp; - lp->timer.function = iss_net_timer;mod_timer (&lp->timer, jiffies + lp->timer_val); out:
@@ -482,7 +480,7 @@ static int iss_net_change_mtu(struct net_device *dev, int new_mtu)return -EINVAL ; } -void iss_net_user_timer_expire (unsigned long _conn) +void iss_net_user_timer_expire (struct timer_list *unused) { }
@@ -582,8 +580,7 @@ static int iss_net_configure(int index, char *init)return 1 ; } -init_timer (&lp->tl); - lp->tl.function = iss_net_user_timer_expire; +timer_setup (&lp->tl, iss_net_user_timer_expire,0 );return 0 ;
Signature · 6 lines
2.7.4 -- Kees Cook Pixel Security