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>
This commit is contained in:
Kees Cook 2017-10-19 16:40:49 -07:00
parent 3142692a5e
commit d8479a21a9
2 changed files with 9 additions and 13 deletions

View File

@ -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;

View File

@ -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;