From: Nicholas Mc Guire <hofrat@osadl.org>
To: Jan Yenya Kasprzak <kas@fi.muni.cz>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Nicholas Mc Guire <hofrat@osadl.org>
Subject: [PATCH] cosa: use msecs_to_jiffies for conversions
Date: Sat, 6 Jun 2015 09:51:51 +0200 [thread overview]
Message-ID: <1433577111-7404-1-git-send-email-hofrat@osadl.org> (raw)
API compliance scanning with coccinelle flagged:
./drivers/net/wan/cosa.c:520:2-18: WARNING:
timeout (30) seems HZ dependent
Numeric constants passed to schedule_timeout() make the effective
timeout HZ dependent which makes little sense in a device probe.
Fixed up by converting the constant to jiffies with msecs_to_jiffies()
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
As the actually intended timeout is not documented and msecs_to_jiffies
timeouts can be a factor 10 different from the current effective timeout
As the original driver predates variable HZ (2.2.26 drivers/net/cosa.c
also is using schedule_timeout(30)) this is probably assuming HZ=100
and thus the timeout would need to be 300, this needs to be checked by
someone who knows the details of this driver.
In any case it should be passed in a HZ independent manner.
Patch was compile tested with i386_defconfig + CONFIG_WAN=y
CONFIG_ISA=y, CONFIG_HDLC=m, CONFIG_COSA=m
Patch is against 4.1-rc6 (localversion-next is -next-20150605)
drivers/net/wan/cosa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index bcfa01a..4cce63c 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -517,7 +517,7 @@ static int cosa_probe(int base, int irq, int dma)
*/
set_current_state(TASK_INTERRUPTIBLE);
cosa_putstatus(cosa, SR_TX_INT_ENA);
- schedule_timeout(30);
+ schedule_timeout(msecs_to_jiffies(300));
irq = probe_irq_off(irqs);
/* Disable all IRQs from the card */
cosa_putstatus(cosa, 0);
--
1.7.10.4
next reply other threads:[~2015-06-06 8:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-06 7:51 Nicholas Mc Guire [this message]
2015-06-07 7:18 ` David Miller
2015-06-07 8:25 ` Nicholas Mc Guire
2015-06-08 6:46 ` 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=1433577111-7404-1-git-send-email-hofrat@osadl.org \
--to=hofrat@osadl.org \
--cc=kas@fi.muni.cz \
--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®