mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 19:56:18 +00:00
[AX25] ax25_ds_timer: use mod_timer instead of add_timer
This patch changes current use of: init_timer(), add_timer() and del_timer() to setup_timer() with mod_timer(), which should be safer anyway. Reported-by: Jann Traschewski <jann@gmx.de> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
21fab4a86a
commit
e848b583e0
3 changed files with 6 additions and 9 deletions
|
@ -324,6 +324,7 @@ extern void ax25_dama_on(ax25_cb *);
|
||||||
extern void ax25_dama_off(ax25_cb *);
|
extern void ax25_dama_off(ax25_cb *);
|
||||||
|
|
||||||
/* ax25_ds_timer.c */
|
/* ax25_ds_timer.c */
|
||||||
|
extern void ax25_ds_setup_timer(ax25_dev *);
|
||||||
extern void ax25_ds_set_timer(ax25_dev *);
|
extern void ax25_ds_set_timer(ax25_dev *);
|
||||||
extern void ax25_ds_del_timer(ax25_dev *);
|
extern void ax25_ds_del_timer(ax25_dev *);
|
||||||
extern void ax25_ds_timer(ax25_cb *);
|
extern void ax25_ds_timer(ax25_cb *);
|
||||||
|
|
|
@ -82,7 +82,7 @@ void ax25_dev_device_up(struct net_device *dev)
|
||||||
ax25_dev->values[AX25_VALUES_DS_TIMEOUT]= AX25_DEF_DS_TIMEOUT;
|
ax25_dev->values[AX25_VALUES_DS_TIMEOUT]= AX25_DEF_DS_TIMEOUT;
|
||||||
|
|
||||||
#if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER)
|
#if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER)
|
||||||
init_timer(&ax25_dev->dama.slave_timer);
|
ax25_ds_setup_timer(ax25_dev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spin_lock_bh(&ax25_dev_lock);
|
spin_lock_bh(&ax25_dev_lock);
|
||||||
|
|
|
@ -40,13 +40,10 @@ static void ax25_ds_timeout(unsigned long);
|
||||||
* 1/10th of a second.
|
* 1/10th of a second.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void ax25_ds_add_timer(ax25_dev *ax25_dev)
|
void ax25_ds_setup_timer(ax25_dev *ax25_dev)
|
||||||
{
|
{
|
||||||
struct timer_list *t = &ax25_dev->dama.slave_timer;
|
setup_timer(&ax25_dev->dama.slave_timer, ax25_ds_timeout,
|
||||||
t->data = (unsigned long) ax25_dev;
|
(unsigned long)ax25_dev);
|
||||||
t->function = &ax25_ds_timeout;
|
|
||||||
t->expires = jiffies + HZ;
|
|
||||||
add_timer(t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ax25_ds_del_timer(ax25_dev *ax25_dev)
|
void ax25_ds_del_timer(ax25_dev *ax25_dev)
|
||||||
|
@ -60,10 +57,9 @@ void ax25_ds_set_timer(ax25_dev *ax25_dev)
|
||||||
if (ax25_dev == NULL) /* paranoia */
|
if (ax25_dev == NULL) /* paranoia */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
del_timer(&ax25_dev->dama.slave_timer);
|
|
||||||
ax25_dev->dama.slave_timeout =
|
ax25_dev->dama.slave_timeout =
|
||||||
msecs_to_jiffies(ax25_dev->values[AX25_VALUES_DS_TIMEOUT]) / 10;
|
msecs_to_jiffies(ax25_dev->values[AX25_VALUES_DS_TIMEOUT]) / 10;
|
||||||
ax25_ds_add_timer(ax25_dev);
|
mod_timer(&ax25_dev->dama.slave_timer, jiffies + HZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue