All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tina Ruchandani <ruchandani.tina@gmail.com>
Subject: Re: [PATCH -next] fbdev: radeon: Avoid 64 bit divide
Date: Fri, 05 Jun 2015 20:08:37 +0000	[thread overview]
Message-ID: <1433534917.4526.105.camel@kernel.crashing.org> (raw)
In-Reply-To: <1433527521-5384-1-git-send-email-linux@roeck-us.net>

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



WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tina Ruchandani <ruchandani.tina@gmail.com>
Subject: Re: [PATCH -next] fbdev: radeon: Avoid 64 bit divide
Date: Sat, 06 Jun 2015 06:08:37 +1000	[thread overview]
Message-ID: <1433534917.4526.105.camel@kernel.crashing.org> (raw)
In-Reply-To: <1433527521-5384-1-git-send-email-linux@roeck-us.net>

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



  reply	other threads:[~2015-06-05 20:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05 18:05 [PATCH -next] fbdev: radeon: Avoid 64 bit divide Guenter Roeck
2015-06-05 18:05 ` Guenter Roeck
2015-06-05 20:08 ` Benjamin Herrenschmidt [this message]
2015-06-05 20:08   ` Benjamin Herrenschmidt
2015-06-05 20:23   ` Guenter Roeck
2015-06-05 20:23     ` Guenter Roeck
2015-06-08 21:21     ` Benjamin Herrenschmidt
2015-06-08 21:21       ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433534917.4526.105.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=plagnioj@jcrosoft.com \
    --cc=ruchandani.tina@gmail.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.