From patchwork Thu Nov 19 20:03:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schwarzott X-Patchwork-Id: 7661121 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5834F9F2EC for ; Thu, 19 Nov 2015 20:05:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9203720465 for ; Thu, 19 Nov 2015 20:05:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4E5C20459 for ; Thu, 19 Nov 2015 20:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161145AbbKSUFB (ORCPT ); Thu, 19 Nov 2015 15:05:01 -0500 Received: from smtp.gentoo.org ([140.211.166.183]:54372 "EHLO smtp.gentoo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161082AbbKSUFB (ORCPT ); Thu, 19 Nov 2015 15:05:01 -0500 Received: from gauss.fritz.box (unknown [IPv6:2001:a62:10b0:8401:eeec:a250:c9d5:8d1e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zzam) by smtp.gentoo.org (Postfix) with ESMTPSA id 70C1E3409A4; Thu, 19 Nov 2015 20:04:59 +0000 (UTC) From: Matthias Schwarzott To: linux-media@vger.kernel.org Cc: mchehab@osg.samsung.com, crope@iki.fi, xpert-reactos@gmx.de, Matthias Schwarzott Subject: [PATCH 06/10] si2165: Simplify si2165_set_if_freq_shift usage Date: Thu, 19 Nov 2015 21:03:58 +0100 Message-Id: <1447963442-9764-7-git-send-email-zzam@gentoo.org> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1447963442-9764-1-git-send-email-zzam@gentoo.org> References: <1447963442-9764-1-git-send-email-zzam@gentoo.org> 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, RCVD_IN_DNSWL_HI, 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: Matthias Schwarzott --- drivers/media/dvb-frontends/si2165.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 0c1f4c4..807a3c9 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -764,12 +764,22 @@ static int si2165_set_oversamp(struct si2165_state *state, u32 dvb_rate) return si2165_writereg32(state, 0x00e4, reg_value); } -static int si2165_set_if_freq_shift(struct si2165_state *state, u32 IF) +static int si2165_set_if_freq_shift(struct si2165_state *state) { + struct dvb_frontend *fe = &state->fe; u64 if_freq_shift; s32 reg_value = 0; u32 fe_clk = si2165_get_fe_clk(state); + u32 IF = 0; + if (!fe->ops.tuner_ops.get_if_frequency) { + dev_err(&state->i2c->dev, + "%s: Error: get_if_frequency() not defined at tuner. Can't work without it!\n", + KBUILD_MODNAME); + return -EINVAL; + } + + fe->ops.tuner_ops.get_if_frequency(fe, &IF); if_freq_shift = IF; if_freq_shift <<= 29; @@ -799,19 +809,11 @@ static int si2165_set_frontend(struct dvb_frontend *fe) struct dtv_frontend_properties *p = &fe->dtv_property_cache; struct si2165_state *state = fe->demodulator_priv; u8 val[3]; - u32 IF; u32 dvb_rate = 0; u16 bw10k; dprintk("%s: called\n", __func__); - if (!fe->ops.tuner_ops.get_if_frequency) { - dev_err(&state->i2c->dev, - "%s: Error: get_if_frequency() not defined at tuner. Can't work without it!\n", - KBUILD_MODNAME); - return -EINVAL; - } - if (!state->has_dvbt) return -EINVAL; @@ -831,8 +833,7 @@ static int si2165_set_frontend(struct dvb_frontend *fe) if (ret < 0) return ret; - fe->ops.tuner_ops.get_if_frequency(fe, &IF); - ret = si2165_set_if_freq_shift(state, IF); + ret = si2165_set_if_freq_shift(state); if (ret < 0) return ret; ret = si2165_writereg8(state, 0x08f8, 0x00); @@ -896,8 +897,7 @@ static int si2165_set_frontend(struct dvb_frontend *fe) fe->ops.tuner_ops.set_params(fe); /* recalc if_freq_shift if IF might has changed */ - fe->ops.tuner_ops.get_if_frequency(fe, &IF); - ret = si2165_set_if_freq_shift(state, IF); + ret = si2165_set_if_freq_shift(state); if (ret < 0) return ret;