[3/3] fc2580: use macro for 64 bit division and reminder

Message ID 1348486638-31169-4-git-send-email-gennarone@gmail.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Gianluca Gennari Sept. 24, 2012, 11:37 a.m. UTC
  Fixes the following warnings on a 32 bit system with GCC 4.4.3 and kernel Ubuntu 2.6.32-43 32 bit:

WARNING: "__udivdi3" [fc2580.ko] undefined!
WARNING: "__umoddi3" [fc2580.ko] undefined!

Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
---
 drivers/media/tuners/fc2580.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
  

Comments

Antti Palosaari Sept. 24, 2012, 11:55 a.m. UTC | #1
On 09/24/2012 02:37 PM, Gianluca Gennari wrote:
> Fixes the following warnings on a 32 bit system with GCC 4.4.3 and kernel Ubuntu 2.6.32-43 32 bit:
>
> WARNING: "__udivdi3" [fc2580.ko] undefined!
> WARNING: "__umoddi3" [fc2580.ko] undefined!
>
> Signed-off-by: Gianluca Gennari <gennarone@gmail.com>

Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>


> ---
>   drivers/media/tuners/fc2580.c |    3 +--
>   1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/tuners/fc2580.c b/drivers/media/tuners/fc2580.c
> index 3ad68e9..2e8ebac 100644
> --- a/drivers/media/tuners/fc2580.c
> +++ b/drivers/media/tuners/fc2580.c
> @@ -168,8 +168,7 @@ static int fc2580_set_params(struct dvb_frontend *fe)
>   	}
>
>   	f_ref = 2UL * priv->cfg->clock / r_val;
> -	n_val = f_vco / f_ref;
> -	k_val = f_vco % f_ref;
> +	n_val = div_u64_rem(f_vco, f_ref, &k_val);
>   	k_val_reg = 1UL * k_val * (1 << 20) / f_ref;
>
>   	ret = fc2580_wr_reg(priv, 0x18, r18_val | ((k_val_reg >> 16) & 0xff));
>
  

Patch

diff --git a/drivers/media/tuners/fc2580.c b/drivers/media/tuners/fc2580.c
index 3ad68e9..2e8ebac 100644
--- a/drivers/media/tuners/fc2580.c
+++ b/drivers/media/tuners/fc2580.c
@@ -168,8 +168,7 @@  static int fc2580_set_params(struct dvb_frontend *fe)
 	}
 
 	f_ref = 2UL * priv->cfg->clock / r_val;
-	n_val = f_vco / f_ref;
-	k_val = f_vco % f_ref;
+	n_val = div_u64_rem(f_vco, f_ref, &k_val);
 	k_val_reg = 1UL * k_val * (1 << 20) / f_ref;
 
 	ret = fc2580_wr_reg(priv, 0x18, r18_val | ((k_val_reg >> 16) & 0xff));