]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
video/aty/mach64_ct.c: fix bogus delay loop
authorDavid S. Miller <davem@davemloft.net>
Thu, 8 Mar 2007 07:17:20 +0000 (08:17 +0100)
committerAdrian Bunk <bunk@stusta.de>
Thu, 8 Mar 2007 07:17:20 +0000 (08:17 +0100)
CT based mach64 cards were reported to hang on sparc64 boxes when
compiled with gcc-4.1.x and later.

Looking at this piece of code, it's no surprise.  A critical
delay was implemented as an empty for() loop, and gcc 4.0.x
and previous did not optimize it away, so we did get a delay.

But gcc-4.1.x and later can optimize it away, and we get crashes.

Use a real udelay() to fix this.  Fix verified on SunBlade100.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
drivers/video/aty/mach64_ct.c

index e7056934c6a831c06620fd6ea1a45d1b689c3ead..11c7bbc9e84ab88203d474a897d9223229b06226 100644 (file)
@@ -399,7 +399,7 @@ static int __init aty_init_pll_ct(const struct fb_info *info,
 {
        struct atyfb_par *par = (struct atyfb_par *) info->par;
        u8 mpost_div, xpost_div, sclk_post_div_real, sclk_fb_div, spll_cntl2;
-       u32 q, i, memcntl, trp;
+       u32 q,  memcntl, trp;
        u32 dsp_config, dsp_on_off, vga_dsp_config, vga_dsp_on_off;
 #ifdef DEBUG
        int pllmclk, pllsclk;
@@ -598,7 +598,7 @@ static int __init aty_init_pll_ct(const struct fb_info *info,
                 * helps for Rage Mobilities that sometimes crash when
                 * we switch to sclk. (Daniel Mantione, 13-05-2003)
                 */
-               for (i=0;i<=0x1ffff;i++);
+               udelay(500);
        }
 
        aty_st_pll_ct(PLL_REF_DIV, pll->ct.pll_ref_div, par);