aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2009-12-11 11:11:05 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-16 06:27:50 -0500
commit3ab1b9cecdc6540a5b79500b1c10c4362a9cc5f1 (patch)
treea9234df481a15630ab50f734a8a55db3310633ec /drivers
parent5bf583473813530c1bf82051a35fac8d5045f4f7 (diff)
V4L/DVB: lgs8gxx: Use shifts rather than multiply/divide when possible
If val is a u64, then following: val *= (u64)1 << 32; val /= (u64)1 << 32; should surely be better represented as: val <<= 32; val >>= 32; Especially as, for the division, the compiler might want to actually do a division: drivers/built-in.o: In function `lgs8gxx_get_afc_phase': drivers/media/dvb/frontends/lgs8gxx.c:250: undefined reference to `__udivdi3' Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/frontends/lgs8gxx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/dvb/frontends/lgs8gxx.c b/drivers/media/dvb/frontends/lgs8gxx.c
index eabcadc425d5..dee53960e7e8 100644
--- a/drivers/media/dvb/frontends/lgs8gxx.c
+++ b/drivers/media/dvb/frontends/lgs8gxx.c
@@ -199,7 +199,7 @@ static int lgs8gxx_set_if_freq(struct lgs8gxx_state *priv, u32 freq /*in kHz*/)
199 199
200 val = freq; 200 val = freq;
201 if (freq != 0) { 201 if (freq != 0) {
202 val *= (u64)1 << 32; 202 val <<= 32;
203 if (if_clk != 0) 203 if (if_clk != 0)
204 do_div(val, if_clk); 204 do_div(val, if_clk);
205 v32 = val & 0xFFFFFFFF; 205 v32 = val & 0xFFFFFFFF;
@@ -246,7 +246,7 @@ static int lgs8gxx_get_afc_phase(struct lgs8gxx_state *priv)
246 246
247 val = v32; 247 val = v32;
248 val *= priv->config->if_clk_freq; 248 val *= priv->config->if_clk_freq;
249 val /= (u64)1 << 32; 249 val >>= 32;
250 dprintk("AFC = %u kHz\n", (u32)val); 250 dprintk("AFC = %u kHz\n", (u32)val);
251 return 0; 251 return 0;
252} 252}