From patchwork Tue Dec 26 23:37:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10133283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3A5FD6023A for ; Tue, 26 Dec 2017 23:38:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C63C2DA7F for ; Tue, 26 Dec 2017 23:38:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20E422DA82; Tue, 26 Dec 2017 23:38:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F0772DA7F for ; Tue, 26 Dec 2017 23:38:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751376AbdLZXiG (ORCPT ); Tue, 26 Dec 2017 18:38:06 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33787 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbdLZXiE (ORCPT ); Tue, 26 Dec 2017 18:38:04 -0500 Received: by mail-wm0-f65.google.com with SMTP id g130so37554717wme.0 for ; Tue, 26 Dec 2017 15:38:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ntbGdk/ZvO2HQS0Fv/He7GijZg7ihWBGbxbzv8WUcus=; b=o/zTrVJkV6PUT/oUVhhv6YiW9Yzx7AhlX+wC4gmGriQ80LOORT18FznA2wYPvf23K+ RBfHSlAeKA993gU4WcVe/cDM/rLTiCoxKGG3Eui1sON1xZ8a7/5C/UN91hz0Y8CJ4Hgf WkJX1sSU+AGDb3JyBu8/bYANUt6e1HVt9B3rcZ2DJlcGrQWXw/5XjEhXGzD3lHFugW6T zEjoHbLdOH9/QGd6PGX8PRA5bSYtJnpQvbHZqCksnBuVLcn/0mzJocjtky7ISoUMcTz4 021HWdgxVdpMrl6zBb2rTbpTQzahjCdAyfkAH6xq4Uz0iR/SzjVG0prL60fg98sNSIlK giJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ntbGdk/ZvO2HQS0Fv/He7GijZg7ihWBGbxbzv8WUcus=; b=Rl+QACKXZ9rRZKUFvrzVgfbOhp1XLcV/E1ZgXWFu7vxcMcM1ucpg2o/0MQ4fk4XkS7 TmbudD9vrgTheJpVfscawjVTntAFC96YENu1fu1irVHPUTzc0QMgU67Vsmi/tjUUH/pW FBRicUvLradL+YCYnkV5cWMYMTePtEHt8BkDtCi3I8UxLR/m4GrerYq0v/DsRWKvDLE1 +ALRk60n9QUS5QNItxJpMP73VOQtL26vCrj1SzVaEwzptRIQWU3hlndVHRvRufVqLKSK N8qqVV5meOIy4OQbIpgEprNyf7I/Dr+G3Vuygc3tV5TcMmD0nto0hpDWMEIYEuX0+D/S PhbQ== X-Gm-Message-State: AKGB3mKDCyZ8xRZQ/7jceMxrAhHNicUfU1Iqmzw/i/CqEifH2Lvg3p4m kA7Slo2zizOIWlSOl4cyvY6hKw== X-Google-Smtp-Source: ACJfBotOR0WPl/oCMOCVyAL9ccM0t74YJnIWGGiYo0XX35NcgzFlSAX//DOGrCO/Ya/7gIXLoe27jg== X-Received: by 10.28.192.24 with SMTP id q24mr21389984wmf.98.1514331483032; Tue, 26 Dec 2017 15:38:03 -0800 (PST) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id o16sm21514092wmi.29.2017.12.26.15.38.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Dec 2017 15:38:02 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Cc: Ralph Metzler Subject: [PATCH 1/4] [media] dvb-frontends/stv0910: deduplicate writes in enable_puncture_rate() Date: Wed, 27 Dec 2017 00:37:56 +0100 Message-Id: <20171226233759.16116-2-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171226233759.16116-1-d.scheller.oss@gmail.com> References: <20171226233759.16116-1-d.scheller.oss@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Scheller For all code rates, the same write is performed, only with a differing value. Clean this up by putting that value into a variable instead and perform the write at the end with that value. Picked up from the dddvb upstream. Cc: Ralph Metzler Signed-off-by: Daniel Scheller --- drivers/media/dvb-frontends/stv0910.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index a8c99f41478b..a6c473f3647f 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -908,27 +908,31 @@ static int init_search_param(struct stv *state) static int enable_puncture_rate(struct stv *state, enum fe_code_rate rate) { + u8 val; + switch (rate) { case FEC_1_2: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x01); + val = 0x01; + break; case FEC_2_3: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x02); + val = 0x02; + break; case FEC_3_4: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x04); + val = 0x04; + break; case FEC_5_6: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x08); + val = 0x08; + break; case FEC_7_8: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x20); + val = 0x20; + break; case FEC_NONE: default: - return write_reg(state, - RSTV0910_P2_PRVIT + state->regoff, 0x2f); + val = 0x2f; + break; } + + return write_reg(state, RSTV0910_P2_PRVIT + state->regoff, val); } static int set_vth_default(struct stv *state)