Skip to content

Commit

Permalink
[PATCH] video/aty/mach64_ct.c: fix bogus delay loop
Browse files Browse the repository at this point in the history
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: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Miller authored and Linus Torvalds committed Mar 5, 2007
1 parent 8f48561 commit 8690ba4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/video/aty/mach64_ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,6 @@ static void aty_resume_pll_ct(const struct fb_info *info,
struct atyfb_par *par = info->par;

if (par->mclk_per != par->xclk_per) {
int i;
/*
* This disables the sclk, crashes the computer as reported:
* aty_st_pll_ct(SPLL_CNTL2, 3, info);
Expand All @@ -614,7 +613,7 @@ static void aty_resume_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);
Expand Down

0 comments on commit 8690ba4

Please sign in to comment.