From patchwork Sun Jan 25 14:51:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger-Novakovic X-Patchwork-Id: 5701771 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C8532C058E for ; Sun, 25 Jan 2015 14:52:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 20E5D201E4 for ; Sun, 25 Jan 2015 14:52:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 514C4201F5 for ; Sun, 25 Jan 2015 14:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753720AbbAYOv4 (ORCPT ); Sun, 25 Jan 2015 09:51:56 -0500 Received: from mx02.posteo.de ([89.146.194.165]:52437 "EHLO mx02.posteo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751953AbbAYOvz (ORCPT ); Sun, 25 Jan 2015 09:51:55 -0500 Received: from dovecot03.posteo.de (unknown [185.67.36.28]) by mx02.posteo.de (Postfix) with ESMTPS id E54991F5E883; Sun, 25 Jan 2015 15:51:53 +0100 (CET) Received: from mail.posteo.de (localhost [127.0.0.1]) by dovecot03.posteo.de (Postfix) with ESMTPSA id 3kVcc927XLz5vN0; Sun, 25 Jan 2015 15:51:52 +0100 (CET) From: Martin Kepplinger To: mchehab@osg.samsung.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Kepplinger Subject: [PATCH v2] media: (stb0899) use sign_extend32() for sign extension Date: Sun, 25 Jan 2015 15:51:35 +0100 Message-Id: <1422197495-24903-1-git-send-email-martink@posteo.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1422195725-23577-1-git-send-email-martink@posteo.de> References: <1422195725-23577-1-git-send-email-martink@posteo.de> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Signed-off-by: Martin Kepplinger --- Sorry. I should have at least built my change. This is the correct version. drivers/media/dvb-frontends/stb0899_algo.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-frontends/stb0899_algo.c b/drivers/media/dvb-frontends/stb0899_algo.c index 93596e0..3012f19 100644 --- a/drivers/media/dvb-frontends/stb0899_algo.c +++ b/drivers/media/dvb-frontends/stb0899_algo.c @@ -19,6 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include "stb0899_drv.h" #include "stb0899_priv.h" #include "stb0899_reg.h" @@ -1490,9 +1491,7 @@ enum stb0899_status stb0899_dvbs2_algo(struct stb0899_state *state) /* Store signal parameters */ offsetfreq = STB0899_READ_S2REG(STB0899_S2DEMOD, CRL_FREQ); - /* sign extend 30 bit value before using it in calculations */ - if (offsetfreq & (1 << 29)) - offsetfreq |= -1 << 30; + offsetfreq = sign_extend32(offsetfreq, 29); offsetfreq = offsetfreq / ((1 << 30) / 1000); offsetfreq *= (internal->master_clk / 1000000);