From: Jarek Poplawski <jarkao2@gmail.com>
To: netdev@vger.kernel.org
Cc: Ralf Baechle <ralf@linux-mips.org>,
Jann Traschewski <jann@gmx.de>,
David Miller <davem@davemloft.net>
Subject: [PATCH][AX25] ax25_ds_timer: use mod_timer instead of add_timer
Date: Wed, 6 Feb 2008 09:14:13 +0000 [thread overview]
Message-ID: <20080206091413.GE4496@ff.dom.local> (raw)
In-Reply-To: <20080206081509.GD4496@ff.dom.local>
On Wed, Feb 06, 2008 at 08:15:09AM +0000, Jarek Poplawski wrote:
> On Wed, Feb 06, 2008 at 07:45:29AM +0000, Jarek Poplawski wrote:
> ...
> > From: Jann Traschewski <jann@gmx.de>
> > Subject: SMP with AX.25
...
[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>
---
include/net/ax25.h | 1 +
net/ax25/ax25_dev.c | 2 +-
net/ax25/ax25_ds_timer.c | 12 ++++--------
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 3f0236f..717e219 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -324,6 +324,7 @@ extern void ax25_dama_on(ax25_cb *);
extern void ax25_dama_off(ax25_cb *);
/* ax25_ds_timer.c */
+extern void ax25_ds_setup_timer(ax25_dev *);
extern void ax25_ds_set_timer(ax25_dev *);
extern void ax25_ds_del_timer(ax25_dev *);
extern void ax25_ds_timer(ax25_cb *);
diff --git a/net/ax25/ax25_dev.c b/net/ax25/ax25_dev.c
index 528c874..a7a0e0c 100644
--- a/net/ax25/ax25_dev.c
+++ b/net/ax25/ax25_dev.c
@@ -82,7 +82,7 @@ void ax25_dev_device_up(struct net_device *dev)
ax25_dev->values[AX25_VALUES_DS_TIMEOUT]= AX25_DEF_DS_TIMEOUT;
#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
spin_lock_bh(&ax25_dev_lock);
diff --git a/net/ax25/ax25_ds_timer.c b/net/ax25/ax25_ds_timer.c
index c4e3b02..2ce79df 100644
--- a/net/ax25/ax25_ds_timer.c
+++ b/net/ax25/ax25_ds_timer.c
@@ -40,13 +40,10 @@ static void ax25_ds_timeout(unsigned long);
* 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;
- t->data = (unsigned long) ax25_dev;
- t->function = &ax25_ds_timeout;
- t->expires = jiffies + HZ;
- add_timer(t);
+ setup_timer(&ax25_dev->dama.slave_timer, ax25_ds_timeout,
+ (unsigned long)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 */
return;
- del_timer(&ax25_dev->dama.slave_timer);
ax25_dev->dama.slave_timeout =
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);
}
/*
next prev parent reply other threads:[~2008-02-06 9:07 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <00f201c8694a$2770f630$453c822c@dg8ngn>
[not found] ` <cd9157050802071100m76a742bbyb18f4448d8ec436b@mail.gmail.com>
2008-02-06 7:45 ` [BUG][AX25] Fwd: SMP with AX.25 Jarek Poplawski
2008-02-06 8:15 ` [PATCH][AX25] " Jarek Poplawski
2008-02-06 9:14 ` Jarek Poplawski [this message]
2008-02-10 18:23 ` [PATCH][AX25] ax25_ds_timer: use mod_timer instead of add_timer Jann Traschewski
2008-02-12 5:38 ` David Miller
2008-02-12 5:37 ` [PATCH][AX25] Fwd: SMP with AX.25 David Miller
2008-02-06 9:30 ` [BUG][AX25] " Jarek Poplawski
2008-02-07 12:07 ` Jarek Poplawski
2008-02-07 19:34 ` Jarek Poplawski
2008-02-07 19:35 ` Jarek Poplawski
2008-02-07 20:34 ` Jarek Poplawski
2008-02-13 11:17 ` [PATCH][AX25] mkiss: ax_bump() locking fix Jarek Poplawski
2008-02-15 15:53 ` Jeff Garzik
2008-02-13 11:56 ` [PATCH][AX25] ax25_out: check skb for NULL in ax25_kick() Jarek Poplawski
2008-02-14 0:49 ` Jann Traschewski
2008-03-09 9:02 ` Pidoux
2008-03-09 14:30 ` Jarek Poplawski
2008-03-09 17:34 ` Jann Traschewski
2008-03-09 18:03 ` Jarek Poplawski
2008-03-24 5:03 ` David Miller
2008-02-18 6:31 ` David Miller
2007-12-17 10:06 [ROSE] [AX25] possible circular locking Bernard Pidoux F6BVP
2007-12-18 13:52 ` Jarek Poplawski
2008-02-09 18:44 ` [PATCH][AX25] ax25_ds_timer: use mod_timer instead of add_timer Bernard Pidoux F6BVP
2008-02-09 19:39 ` Jarek Poplawski
2008-02-10 18:07 ` Bernard Pidoux F6BVP
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080206091413.GE4496@ff.dom.local \
--to=jarkao2@gmail.com \
--cc=davem@davemloft.net \
--cc=jann@gmx.de \
--cc=netdev@vger.kernel.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.