Commit d8479a21 authored by Kees Cook's avatar Kees Cook

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: default avatarKees Cook <keescook@chromium.org>
parent 3142692a
...@@ -47,15 +47,14 @@ static char *serial_name = "ISS serial driver"; ...@@ -47,15 +47,14 @@ static char *serial_name = "ISS serial driver";
* initialization for the tty structure. * 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) static int rs_open(struct tty_struct *tty, struct file * filp)
{ {
tty->port = &serial_port; tty->port = &serial_port;
spin_lock_bh(&timer_lock); spin_lock_bh(&timer_lock);
if (tty->count == 1) { if (tty->count == 1) {
setup_timer(&serial_timer, rs_poll, timer_setup(&serial_timer, rs_poll, 0);
(unsigned long)&serial_port);
mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE); mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
} }
spin_unlock_bh(&timer_lock); spin_unlock_bh(&timer_lock);
...@@ -92,9 +91,9 @@ static int rs_write(struct tty_struct * tty, ...@@ -92,9 +91,9 @@ static int rs_write(struct tty_struct * tty,
return count; 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 i = 0;
int rd = 1; int rd = 1;
unsigned char c; unsigned char c;
......
...@@ -349,9 +349,9 @@ static int iss_net_poll(void) ...@@ -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(); iss_net_poll();
spin_lock(&lp->lock); spin_lock(&lp->lock);
...@@ -386,10 +386,8 @@ static int iss_net_open(struct net_device *dev) ...@@ -386,10 +386,8 @@ static int iss_net_open(struct net_device *dev)
spin_unlock_bh(&opened_lock); spin_unlock_bh(&opened_lock);
spin_lock_bh(&lp->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_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); mod_timer(&lp->timer, jiffies + lp->timer_val);
out: out:
...@@ -482,7 +480,7 @@ static int iss_net_change_mtu(struct net_device *dev, int new_mtu) ...@@ -482,7 +480,7 @@ static int iss_net_change_mtu(struct net_device *dev, int new_mtu)
return -EINVAL; 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) ...@@ -582,8 +580,7 @@ static int iss_net_configure(int index, char *init)
return 1; return 1;
} }
init_timer(&lp->tl); timer_setup(&lp->tl, iss_net_user_timer_expire, 0);
lp->tl.function = iss_net_user_timer_expire;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment