From patchwork Fri Dec 11 16:11:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 2289 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Fri, 11 Dec 2009 16:11:18 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Fri, 11 Dec 2009 14:16:00 -0200 (BRST) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NJ85O-0007wK-D2; Fri, 11 Dec 2009 16:11:18 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933481AbZLKQLJ (ORCPT + 1 other); Fri, 11 Dec 2009 11:11:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933182AbZLKQLI (ORCPT ); Fri, 11 Dec 2009 11:11:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:25695 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933120AbZLKQLH (ORCPT ); Fri, 11 Dec 2009 11:11:07 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBBGB9nf013359 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 11 Dec 2009 11:11:09 -0500 Received: from warthog.cambridge.redhat.com (kibblesnbits.boston.devel.redhat.com [10.16.60.12]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBBGB6Ts030090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 11 Dec 2009 11:11:08 -0500 Received: from [127.0.0.1] (helo=warthog.procyon.org.uk) by warthog.cambridge.redhat.com with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NJ85B-0004D8-LS; Fri, 11 Dec 2009 16:11:05 +0000 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells Subject: [PATCH] V4L/DVB: lgs8gxx: Use shifts rather than multiply/divide when possible To: davidtlwong@gmail.com, mchehab@redhat.com Cc: dhowells@redhat.com, linux-media@vger.kernel.org Date: Fri, 11 Dec 2009 16:11:05 +0000 Message-ID: <20091211161105.16160.26479.stgit@warthog.procyon.org.uk> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/dvb/frontends/lgs8gxx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) -- 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 diff --git a/drivers/media/dvb/frontends/lgs8gxx.c b/drivers/media/dvb/frontends/lgs8gxx.c index eabcadc..dee5396 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*/) val = freq; if (freq != 0) { - val *= (u64)1 << 32; + val <<= 32; if (if_clk != 0) do_div(val, if_clk); v32 = val & 0xFFFFFFFF; @@ -246,7 +246,7 @@ static int lgs8gxx_get_afc_phase(struct lgs8gxx_state *priv) val = v32; val *= priv->config->if_clk_freq; - val /= (u64)1 << 32; + val >>= 32; dprintk("AFC = %u kHz\n", (u32)val); return 0; }