From: "Manuel Schölling" <manuel.schoelling@gmx.de>
To: isdn@linux-pingi.de
Cc: manuel.schoelling@gmx.de, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] mISDN: use mod_timer()
Date: Wed, 21 May 2014 21:10:06 +0200 [thread overview]
Message-ID: <1400699406-31294-2-git-send-email-manuel.schoelling@gmx.de> (raw)
In-Reply-To: <1400699406-31294-1-git-send-email-manuel.schoelling@gmx.de>
The code for resetting the timer can be simplified if mod_timer() is used
instead of del_timer() followed by add_timer().
Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
---
drivers/isdn/mISDN/l1oip_core.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c
index 1c2bc36..a4c6cc0 100644
--- a/drivers/isdn/mISDN/l1oip_core.c
+++ b/drivers/isdn/mISDN/l1oip_core.c
@@ -288,9 +288,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask,
/* restart timer */
if (time_before(hc->keep_tl.expires - 5 * HZ, jiffies)) {
- del_timer(&hc->keep_tl);
- hc->keep_tl.expires = jiffies + L1OIP_KEEPALIVE * HZ;
- add_timer(&hc->keep_tl);
+ mod_timer(&hc->keep_tl, jiffies + L1OIP_KEEPALIVE * HZ);
} else
hc->keep_tl.expires = jiffies + L1OIP_KEEPALIVE * HZ;
@@ -624,9 +622,7 @@ multiframe:
if (time_before(hc->timeout_tl.expires - 5 * HZ, jiffies)
|| !hc->timeout_on) {
hc->timeout_on = 1;
- del_timer(&hc->timeout_tl);
- hc->timeout_tl.expires = jiffies + L1OIP_TIMEOUT * HZ;
- add_timer(&hc->timeout_tl);
+ mod_timer(&hc->timeout_tl, jiffies + L1OIP_TIMEOUT * HZ);
} else /* only adjust timer */
hc->timeout_tl.expires = jiffies + L1OIP_TIMEOUT * HZ;
--
1.7.10.4
next prev parent reply other threads:[~2014-05-21 19:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-21 19:10 [PATCH 1/2] mISDN: Use time_before() Manuel Schölling
2014-05-21 19:10 ` Manuel Schölling [this message]
2014-05-21 19:27 ` Sergei Shtylyov
2014-05-21 20:07 ` Joe Perches
2014-05-21 20:43 ` Sergei Shtylyov
2014-05-21 20:08 ` [PATCH v2 " Manuel Schölling
2014-05-21 20:08 ` [PATCH v2 2/2] mISDN: Use mod_timer() Manuel Schölling
2014-05-22 19:50 ` David Miller
2014-05-22 19:50 ` [PATCH v2 1/2] mISDN: Use time_before() David Miller
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=1400699406-31294-2-git-send-email-manuel.schoelling@gmx.de \
--to=manuel.schoelling@gmx.de \
--cc=isdn@linux-pingi.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®