From: "Loïc Grenié" <loic.grenie@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>,
Ralf Baechle <ralf@linux-mips.org>
Subject: Strange arch/mips/delay.c
Date: Sat, 1 Aug 2009 19:37:18 +0200 [thread overview]
Message-ID: <9b06e8d20908011037m6b0f72cch154ed1e15bdc8938@mail.gmail.com> (raw)
I could not compile for mips without something similar to the
following patch. As far as I can say __udelay and __ndelay
are costly nops (with __ndelay not compiling at all) without
the patch.
At that point, it might be interesting to change
the 0x00000005uLL by 0x00000045uLL and the >> 32
by >> 36 (the precision is much better and the cost
should be the same -- obviously there is a slightly higher
risk of overlow).
Thanks,
Loïc Grenié
Signed-off-by: Loic Grenie <loic.grenie@gmail.com>
--- a/arch/mips/lib/delay.c
+++ b/arch/mips/lib/delay.c
@@ -43,7 +43,7 @@ void __udelay(unsigned long us)
{
unsigned int lpj = current_cpu_data.udelay_val;
- __delay((us * 0x000010c7 * HZ * lpj) >> 32);
+ __delay((us * 0x000010c7uLL * HZ * lpj) >> 32);
}
EXPORT_SYMBOL(__udelay);
@@ -51,6 +51,6 @@ void __ndelay(unsigned long ns)
{
unsigned int lpj = current_cpu_data.udelay_val;
- __delay((us * 0x00000005 * HZ * lpj) >> 32);
+ __delay((ns * 0x00000005uLL * HZ * lpj) >> 32);
}
EXPORT_SYMBOL(__ndelay);
next reply other threads:[~2009-08-01 17:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-01 17:37 Loïc Grenié [this message]
2009-08-01 23:33 ` Ralf Baechle
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=9b06e8d20908011037m6b0f72cch154ed1e15bdc8938@mail.gmail.com \
--to=loic.grenie@gmail.com \
--cc=linux-kernel@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 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®