diff mbox

[-next] fbdev: radeon: Avoid 64 bit divide

Message ID 1433527521-5384-1-git-send-email-linux@roeck-us.net (mailing list archive)
State New, archived
Headers show

Commit Message

Guenter Roeck June 5, 2015, 6:05 p.m. UTC
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 <ruchandani.tina@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/video/fbdev/aty/radeon_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Benjamin Herrenschmidt June 5, 2015, 8:08 p.m. UTC | #1
On Fri, 2015-06-05 at 11:05 -0700, Guenter Roeck wrote:
> 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 ?

> Fixes: ce8f4069dce8 ("fbdev: radeon: Remove 'struct timeval' usage")
> Cc: Tina Ruchandani <ruchandani.tina@gmail.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  drivers/video/fbdev/aty/radeon_base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c
> index b3612e30d74f..374e47532035 100644
> --- a/drivers/video/fbdev/aty/radeon_base.c
> +++ b/drivers/video/fbdev/aty/radeon_base.c
> @@ -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);


--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guenter Roeck June 5, 2015, 8:23 p.m. UTC | #2
On 06/05/2015 01:08 PM, Benjamin Herrenschmidt wrote:
> On Fri, 2015-06-05 at 11:05 -0700, Guenter Roeck wrote:
>> 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

>> Fixes: ce8f4069dce8 ("fbdev: radeon: Remove 'struct timeval' usage")
>> Cc: Tina Ruchandani <ruchandani.tina@gmail.com>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>   drivers/video/fbdev/aty/radeon_base.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c
>> index b3612e30d74f..374e47532035 100644
>> --- a/drivers/video/fbdev/aty/radeon_base.c
>> +++ b/drivers/video/fbdev/aty/radeon_base.c
>> @@ -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);
>
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Benjamin Herrenschmidt June 8, 2015, 9:21 p.m. UTC | #3
On Fri, 2015-06-05 at 13:23 -0700, Guenter Roeck wrote:
> On 06/05/2015 01:08 PM, Benjamin Herrenschmidt wrote:
> > On Fri, 2015-06-05 at 11:05 -0700, Guenter Roeck wrote:
> >> 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 ?

Don't bother.

> Guenter
> 
> >> Fixes: ce8f4069dce8 ("fbdev: radeon: Remove 'struct timeval' usage")
> >> Cc: Tina Ruchandani <ruchandani.tina@gmail.com>
> >> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> >> ---
> >>   drivers/video/fbdev/aty/radeon_base.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c
> >> index b3612e30d74f..374e47532035 100644
> >> --- a/drivers/video/fbdev/aty/radeon_base.c
> >> +++ b/drivers/video/fbdev/aty/radeon_base.c
> >> @@ -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);
> >
> >
> >


--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c
index b3612e30d74f..374e47532035 100644
--- a/drivers/video/fbdev/aty/radeon_base.c
+++ b/drivers/video/fbdev/aty/radeon_base.c
@@ -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);