netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <florian.fainelli@telecomint.eu>
To: Martin Michlmayr <tbm@cyrius.com>
Cc: Sten Wang <sten.wang@rdc.com.tw>,
	netdev@vger.kernel.org, Martin Michlmayr <tbm@cyrius.com>
Subject: Re: r6040: bad udelay call, build failure on ARM with R6040=m
Date: Mon, 25 Aug 2008 23:05:09 +0200	[thread overview]
Message-ID: <200808252305.10448.florian.fainelli@telecomint.eu> (raw)
In-Reply-To: <20080825120502.GA13700@deprecation.cyrius.com>

Hey Martin,

Le Monday 25 August 2008 14:05:02 Martin Michlmayr, vous avez écrit :
> r6040 fails to build on ARM with:
>
> ERROR: "__bad_udelay" [drivers/net/r6040.ko] undefined!
> make[1]: *** [__modpost] Error 1
>
> __bad_udelay is specifically designed on ARM to fail when udelay is
> called in a bad way.  arch/arm/include/asm/delay.h has this to say
> about __bad_udelay:

Please find/test the patch below :
--
From: Florian Fainelli <florian.fainelli@telecomint.eu>
Subject: [PATCH] r6040: fix bad usage of udelay

This patch fixes the bad usage of udelay(5000), which in turns is a
mdelay(5). It causes compilation for ARM where udelay maximum value
is checked.

Reported-by: Martin Michlmayr <tbm@cyrius.com>
Signed-off-by: Florian Fainelli <florian.fainelli@telecomint.eu>
---
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index d453987..d837bef 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -364,7 +364,7 @@ static void r6040_init_mac_regs(struct net_device *dev)
 	/* Reset internal state machine */
 	iowrite16(2, ioaddr + MAC_SM);
 	iowrite16(0, ioaddr + MAC_SM);
-	udelay(5000);
+	mdelay(5);
 
 	/* MAC Bus Control Register */
 	iowrite16(MBCR_DEFAULT, ioaddr + MBCR);
@@ -800,7 +800,7 @@ static void r6040_mac_address(struct net_device *dev)
 	iowrite16(0x01, ioaddr + MCR1); /* Reset MAC */
 	iowrite16(2, ioaddr + MAC_SM); /* Reset internal state machine */
 	iowrite16(0, ioaddr + MAC_SM);
-	udelay(5000);
+	mdelay(5);
 
 	/* Restore MAC Address */
 	adrp = (u16 *) dev->dev_addr;

  reply	other threads:[~2008-08-25 21:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-25 12:05 r6040: bad udelay call, build failure on ARM with R6040=m Martin Michlmayr
2008-08-25 21:05 ` Florian Fainelli [this message]
2008-08-26  5:04   ` Martin Michlmayr

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=200808252305.10448.florian.fainelli@telecomint.eu \
    --to=florian.fainelli@telecomint.eu \
    --cc=netdev@vger.kernel.org \
    --cc=sten.wang@rdc.com.tw \
    --cc=tbm@cyrius.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;
as well as URLs for NNTP newsgroup(s).