public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Strange arch/mips/delay.c
@ 2009-08-01 17:37 Loïc Grenié
  2009-08-01 23:33 ` Ralf Baechle
  0 siblings, 1 reply; 2+ messages in thread
From: Loïc Grenié @ 2009-08-01 17:37 UTC (permalink / raw)
  To: linux-kernel, Ralf Baechle

  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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-08-01 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-01 17:37 Strange arch/mips/delay.c Loïc Grenié
2009-08-01 23:33 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox