From patchwork Sat Aug 16 06:26:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "nibble.max" X-Patchwork-Id: 4729631 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6C7E0C0338 for ; Sat, 16 Aug 2014 06:26:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE43C20158 for ; Sat, 16 Aug 2014 06:26:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E144C2011B for ; Sat, 16 Aug 2014 06:26:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751156AbaHPG0o (ORCPT ); Sat, 16 Aug 2014 02:26:44 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:51410 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750998AbaHPG0o (ORCPT ); Sat, 16 Aug 2014 02:26:44 -0400 Received: by mail-pa0-f41.google.com with SMTP id rd3so4594554pab.0 for ; Fri, 15 Aug 2014 23:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-transfer-encoding; bh=36zF2lXyx1btY6Qa7OLrV1tuOKRQ2g1LPFHVZkWuaOQ=; b=WPJFFxE3dLh/7CTcOKqgZgN9xK/Let9P3xqCXpbHHk/BRDYY7XAn7/ufEYPZAD44Va 8M1iD/fOmR346GDla7i/MTG5sd+mk2JKGGlTnTBnLtyVLtszGEj2wCMnAkZtXnOhQXq/ Uiz+m0i1RRWS7/KM/jDSlhKN+VBTC6B7ztSHFF3SkB9ZtlYUizzYBxWOz0E9ftazYqMW acnFREzVgegSlfzgdab12zOBjy9ygg7CNNWlpsSEUWM+TFNc1upvBuGFWTMZ0ZTR7xfs PyDU/3Hy8RMHS7ClwU+lL6Id2pUuoiCUNTU3Ma8MCQJw1OQXf+idNpBw8C4G68YFuviJ GAqw== X-Received: by 10.68.190.229 with SMTP id gt5mr18038585pbc.15.1408170395442; Fri, 15 Aug 2014 23:26:35 -0700 (PDT) Received: from bestunar-max ([163.125.81.9]) by mx.google.com with ESMTPSA id ob5sm9766560pbb.70.2014.08.15.23.26.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 15 Aug 2014 23:26:34 -0700 (PDT) Date: Sat, 16 Aug 2014 14:26:35 +0800 From: "nibble.max" To: "Antti Palosaari" Cc: "linux-media" , "olli.salonen" Subject: [PATCH] m88ts2022: fix high symbol rate transponders missing on 32bit platform. Message-ID: <201408161426307340191@gmail.com> X-mailer: Foxmail 6, 15, 201, 23 [cn] Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current m88ts2022 driver will miss the following high symbol rate transponders on Telstar 18 138.0. 12385 H 43200, 12690 H 43200, 12538 V 41250... the code for f_3db_hz will overflow for the high symbol rate. for example, symbol rate=41250 KS/s symbol_rate * 135UL = 5568750000(1 4BEC 61B0), the value is larger than unsigned int on 32bit platform. that makes the wrong result. Exchanging the div and mul position fixs it. Signed-off-by: Nibble Max --- drivers/media/tuners/m88ts2022.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/tuners/m88ts2022.c b/drivers/media/tuners/m88ts2022.c index 40c42de..65c8acc 100644 --- a/drivers/media/tuners/m88ts2022.c +++ b/drivers/media/tuners/m88ts2022.c @@ -314,7 +314,7 @@ static int m88ts2022_set_params(struct dvb_frontend *fe) div_min = gdiv28 * 78 / 100; div_max = clamp_val(div_max, 0U, 63U); - f_3db_hz = c->symbol_rate * 135UL / 200UL; + f_3db_hz = (c->symbol_rate / 200UL) * 135UL; f_3db_hz += 2000000U + (frequency_offset_khz * 1000U); f_3db_hz = clamp(f_3db_hz, 7000000U, 40000000U);