From: Libin <huawei.libin@huawei.com>
To: <davem@davemloft.net>, <hsweeten@visionengravers.com>,
<gregkh@linuxfoundation.org>, <tedheadster@gmail.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<dingtianhong@huawei.com>
Subject: [PATCH] drivers/net: Fix potential incorrect call for udelay()
Date: Mon, 23 Dec 2013 17:33:44 +0800 [thread overview]
Message-ID: <1387791224-29320-1-git-send-email-huawei.libin@huawei.com> (raw)
From: Li Bin <huawei.libin@huawei.com>
The variable delay_time as a module parameter can be set a value
exceeding the limit of the udelay function. This patch checks the
delay_time value to select mdelay() or udelay().
Signed-off-by: Li Bin <huawei.libin@huawei.com>
---
drivers/net/ethernet/8390/pcnet_cs.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/8390/pcnet_cs.c b/drivers/net/ethernet/8390/pcnet_cs.c
index 46c5aad..29fe157 100644
--- a/drivers/net/ethernet/8390/pcnet_cs.c
+++ b/drivers/net/ethernet/8390/pcnet_cs.c
@@ -1284,8 +1284,12 @@ static void dma_block_output(struct net_device *dev, int count,
}
outb_p(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */
- if (info->flags & DELAY_OUTPUT)
- udelay((long)delay_time);
+ if (info->flags & DELAY_OUTPUT) {
+ if (delay_time >= 1000)
+ mdelay((long)delay_time/1000);
+ else
+ udelay(delay_time);
+ }
ei_status.dmaing &= ~0x01;
}
--
1.8.2.2
next reply other threads:[~2013-12-23 9:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-23 9:33 Libin [this message]
2013-12-23 11:26 ` One Thousand Gnomes
2013-12-24 3:22 ` tingwei liu
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=1387791224-29320-1-git-send-email-huawei.libin@huawei.com \
--to=huawei.libin@huawei.com \
--cc=davem@davemloft.net \
--cc=dingtianhong@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tedheadster@gmail.com \
/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®