Skip to contentSkip to conversation

fbdev: radeon: Avoid 64 bit divide

PATCH In review Guenter Roeck 2 participants 4 messages Jun 5, 2015 – Jun 8, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fbdev: radeon: Avoid 64 bit divide

A 64 bit divide causes build failures with 32 bit builds, such as

ERROR: "__divdi3" [drivers/video/fbdev/aty/radeonfb.ko] undefined!

or

drivers/built-in.o: In function `radeon_probe_pll_params':
radeon_base.c:(.text+0x16608b): undefined reference to `__divdi3'

Fixes ce8f4069dce8 ("fbdev: radeon: Remove 'struct timeval' usage")
Cc Tina Ruchandani <[email protected]>
---
 drivers/video/fbdev/aty/radeon_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/aty/radeon_base.c +1 -1
index b3612e30d74f..374e47532035 100644
@@ -492,7 +492,7 @@ static int radeon_probe_pll_params(struct radeonfb_info *rinfo)
 	/* Return -1 if more than 10 seconds have elapsed */
 	if (delta > (10*1000000))
 		return -1;
-	hz = 1000000/delta;
+	hz = 1000000 / (int)delta;
 
 	hTotal = ((INREG(CRTC_H_TOTAL_DISP) & 0x1ff) + 1) * 8;
 	vTotal = ((INREG(CRTC_V_TOTAL_DISP) & 0x3ff) + 1);
Signature · 1 line
2.1.0
#1 lore raw
Quoted 8 lines · Guenter Roeck

A 64 bit divide causes build failures with 32 bit builds, such as

ERROR: "__divdi3" [drivers/video/fbdev/aty/radeonfb.ko] undefined!

or

drivers/built-in.o: In function `radeon_probe_pll_params':
radeon_base.c:(.text+0x16608b): undefined reference to `__divdi3'

What about using do_div() instead ?

Quoted 20 lines
Fixes ce8f4069dce8 ("fbdev: radeon: Remove 'struct timeval' usage")
Cc Tina Ruchandani <[email protected]>
---
 drivers/video/fbdev/aty/radeon_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/aty/radeon_base.c +1 -1
index b3612e30d74f..374e47532035 100644
@@ -492,7 +492,7 @@ static int radeon_probe_pll_params(struct radeonfb_info *rinfo)
 	/* Return -1 if more than 10 seconds have elapsed */
 	if (delta > (10*1000000))
 		return -1;
-	hz = 1000000/delta;
+	hz = 1000000 / (int)delta;
 
 	hTotal = ((INREG(CRTC_H_TOTAL_DISP) & 0x1ff) + 1) * 8;
 	vTotal = ((INREG(CRTC_V_TOTAL_DISP) & 0x3ff) + 1);
#2 lore raw
Quoted 12 lines · Benjamin Herrenschmidt
Quoted 8 lines · Guenter Roeck

A 64 bit divide causes build failures with 32 bit builds, such as

ERROR: "__divdi3" [drivers/video/fbdev/aty/radeonfb.ko] undefined!

or

drivers/built-in.o: In function `radeon_probe_pll_params':
radeon_base.c:(.text+0x16608b): undefined reference to `__divdi3'

What about using do_div() instead ?

delta is known to be <= 10*1000000, so I figured that would have been overkill. But, sure, at the end it is the same. Want me to resubmit ?

Guenter

Quoted 23 lines
Quoted 20 lines
Fixes ce8f4069dce8 ("fbdev: radeon: Remove 'struct timeval' usage")
Cc Tina Ruchandani <[email protected]>
---
  drivers/video/fbdev/aty/radeon_base.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/aty/radeon_base.c +1 -1
index b3612e30d74f..374e47532035 100644
@@ -492,7 +492,7 @@ static int radeon_probe_pll_params(struct radeonfb_info *rinfo)
  	/* Return -1 if more than 10 seconds have elapsed */
  	if (delta > (10*1000000))
  		return -1;
-	hz = 1000000/delta;
+	hz = 1000000 / (int)delta;
 
  	hTotal = ((INREG(CRTC_H_TOTAL_DISP) & 0x1ff) + 1) * 8;
  	vTotal = ((INREG(CRTC_V_TOTAL_DISP) & 0x3ff) + 1);
#3 lore raw
Quoted 8 lines · Guenter Roeck
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 6 lines · Guenter Roeck

A 64 bit divide causes build failures with 32 bit builds, such as

ERROR: "__divdi3" [drivers/video/fbdev/aty/radeonfb.ko] undefined!

or

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

drivers/built-in.o: In function `radeon_probe_pll_params':
radeon_base.c:(.text+0x16608b): undefined reference to `__divdi3'

What about using do_div() instead ?

delta is known to be <= 10*1000000, so I figured that would have been overkill. But, sure, at the end it is the same. Want me to resubmit ?

Don't bother.

Quoted 25 lines

Guenter

Quoted 23 lines
Quoted 20 lines
Fixes ce8f4069dce8 ("fbdev: radeon: Remove 'struct timeval' usage")
Cc Tina Ruchandani <[email protected]>
---
  drivers/video/fbdev/aty/radeon_base.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/aty/radeon_base.c +1 -1
index b3612e30d74f..374e47532035 100644
@@ -492,7 +492,7 @@ static int radeon_probe_pll_params(struct radeonfb_info *rinfo)
  	/* Return -1 if more than 10 seconds have elapsed */
  	if (delta > (10*1000000))
  		return -1;
-	hz = 1000000/delta;
+	hz = 1000000 / (int)delta;
 
  	hTotal = ((INREG(CRTC_H_TOTAL_DISP) & 0x1ff) + 1) * 8;
  	vTotal = ((INREG(CRTC_V_TOTAL_DISP) & 0x3ff) + 1);