All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [media] qm1d1c0042: fix compilation on 32 bits
@ 2014-09-24  1:31 Mauro Carvalho Chehab
  2014-09-24 12:27 ` Akihiro TSUKADA
  0 siblings, 1 reply; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2014-09-24  1:31 UTC (permalink / raw)
  To: Linux Media Mailing List
  Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, Akihiro Tsukada

   drivers/built-in.o: In function `qm1d1c0042_set_params':
>> qm1d1c0042.c:(.text+0x2519730): undefined reference to `__divdi3'

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

diff --git a/drivers/media/tuners/qm1d1c0042.c b/drivers/media/tuners/qm1d1c0042.c
index 585594b9c4f8..2a990f406cf5 100644
--- a/drivers/media/tuners/qm1d1c0042.c
+++ b/drivers/media/tuners/qm1d1c0042.c
@@ -28,6 +28,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/math64.h>
 #include "qm1d1c0042.h"
 
 #define QM1D1C0042_NUM_REGS 0x20
@@ -234,7 +235,9 @@ static int qm1d1c0042_set_params(struct dvb_frontend *fe)
 	 * sd = b          (b >= 0)
 	 *      1<<22 + b  (b < 0)
 	 */
-	b = (((s64) freq) << 20) / state->cfg.xtal_freq - (((s64) a) << 20);
+	b = (s32)div64_s64(((s64) freq) << 20,
+			   state->cfg.xtal_freq - (((s64) a) << 20));
+
 	if (b >= 0)
 		sd = b;
 	else
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] [media] qm1d1c0042: fix compilation on 32 bits
  2014-09-24  1:31 [PATCH] [media] qm1d1c0042: fix compilation on 32 bits Mauro Carvalho Chehab
@ 2014-09-24 12:27 ` Akihiro TSUKADA
  2014-09-24 13:34   ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 5+ messages in thread
From: Akihiro TSUKADA @ 2014-09-24 12:27 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Media Mailing List; +Cc: Mauro Carvalho Chehab

> -	b = (((s64) freq) << 20) / state->cfg.xtal_freq - (((s64) a) << 20);
> +	b = (s32)div64_s64(((s64) freq) << 20,
> +			   state->cfg.xtal_freq - (((s64) a) << 20));
> +

I'm afraid it should be like the following.
> +	b = (s32)(div64_s64(((s64) freq) << 20, state->cfg.xtal_freq)
> +			- (((s64) a) << 20));

regads,
akihiro


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [media] qm1d1c0042: fix compilation on 32 bits
  2014-09-24 12:27 ` Akihiro TSUKADA
@ 2014-09-24 13:34   ` Mauro Carvalho Chehab
  2014-09-24 13:38     ` Antti Palosaari
  0 siblings, 1 reply; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2014-09-24 13:34 UTC (permalink / raw)
  To: Akihiro TSUKADA; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Em Wed, 24 Sep 2014 21:27:57 +0900
Akihiro TSUKADA <tskd08@gmail.com> escreveu:

> > -	b = (((s64) freq) << 20) / state->cfg.xtal_freq - (((s64) a) << 20);
> > +	b = (s32)div64_s64(((s64) freq) << 20,
> > +			   state->cfg.xtal_freq - (((s64) a) << 20));
> > +
> 
> I'm afraid it should be like the following.
> > +	b = (s32)(div64_s64(((s64) freq) << 20, state->cfg.xtal_freq)
> > +			- (((s64) a) << 20));

Are you talking about coding style?

Instead of using something like:

	var = foo_func(a, c 
		- b);

We generally use:
	var = foo_func(a,
		       c - b);

As it is quicker for reviewers to read.

> 
> regads,
> akihiro
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [media] qm1d1c0042: fix compilation on 32 bits
  2014-09-24 13:34   ` Mauro Carvalho Chehab
@ 2014-09-24 13:38     ` Antti Palosaari
  2014-09-24 14:05       ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 5+ messages in thread
From: Antti Palosaari @ 2014-09-24 13:38 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Akihiro TSUKADA
  Cc: Linux Media Mailing List, Mauro Carvalho Chehab



On 09/24/2014 04:34 PM, Mauro Carvalho Chehab wrote:
> Em Wed, 24 Sep 2014 21:27:57 +0900
> Akihiro TSUKADA <tskd08@gmail.com> escreveu:
>
>>> -	b = (((s64) freq) << 20) / state->cfg.xtal_freq - (((s64) a) << 20);
>>> +	b = (s32)div64_s64(((s64) freq) << 20,
>>> +			   state->cfg.xtal_freq - (((s64) a) << 20));
>>> +
>>
>> I'm afraid it should be like the following.
>>> +	b = (s32)(div64_s64(((s64) freq) << 20, state->cfg.xtal_freq)
>>> +			- (((s64) a) << 20));
>
> Are you talking about coding style?

It is calculation order of operators. '/' vs. '-'

>
> Instead of using something like:
>
> 	var = foo_func(a, c
> 		- b);
>
> We generally use:
> 	var = foo_func(a,
> 		       c - b);
>
> As it is quicker for reviewers to read.
>
>>
>> regads,
>> akihiro
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [media] qm1d1c0042: fix compilation on 32 bits
  2014-09-24 13:38     ` Antti Palosaari
@ 2014-09-24 14:05       ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2014-09-24 14:05 UTC (permalink / raw)
  To: Antti Palosaari, Akihiro TSUKADA
  Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Em Wed, 24 Sep 2014 16:38:02 +0300
Antti Palosaari <crope@iki.fi> escreveu:

> 
> 
> On 09/24/2014 04:34 PM, Mauro Carvalho Chehab wrote:
> > Em Wed, 24 Sep 2014 21:27:57 +0900
> > Akihiro TSUKADA <tskd08@gmail.com> escreveu:
> >
> >>> -	b = (((s64) freq) << 20) / state->cfg.xtal_freq - (((s64) a) << 20);
> >>> +	b = (s32)div64_s64(((s64) freq) << 20,
> >>> +			   state->cfg.xtal_freq - (((s64) a) << 20));
> >>> +
> >>
> >> I'm afraid it should be like the following.
> >>> +	b = (s32)(div64_s64(((s64) freq) << 20, state->cfg.xtal_freq)
> >>> +			- (((s64) a) << 20));
> >
> > Are you talking about coding style?
> 
> It is calculation order of operators. '/' vs. '-'

Dah...

-ETOOMUCHPARENTHESIS :)

Fix sent. I'll likely merge it with the original patch when submitting
upstream.

Thanks,
Mauro

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-24 14:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-24  1:31 [PATCH] [media] qm1d1c0042: fix compilation on 32 bits Mauro Carvalho Chehab
2014-09-24 12:27 ` Akihiro TSUKADA
2014-09-24 13:34   ` Mauro Carvalho Chehab
2014-09-24 13:38     ` Antti Palosaari
2014-09-24 14:05       ` Mauro Carvalho Chehab

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.