From patchwork Wed Mar 30 10:25:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 8695271 Return-Path: X-Original-To: patchwork-alsa-devel@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 5DA6D9F44D for ; Wed, 30 Mar 2016 10:30:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 848CB20379 for ; Wed, 30 Mar 2016 10:30:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 590B420374 for ; Wed, 30 Mar 2016 10:30:34 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 69F8B265CC7; Wed, 30 Mar 2016 12:30:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B7C8F261ADB; Wed, 30 Mar 2016 12:29:42 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3AE6F261ADB; Wed, 30 Mar 2016 12:29:41 +0200 (CEST) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by alsa0.perex.cz (Postfix) with ESMTP id D3F96265DB1 for ; Wed, 30 Mar 2016 12:25:11 +0200 (CEST) Received: by mail-pa0-f52.google.com with SMTP id fe3so37292904pab.1 for ; Wed, 30 Mar 2016 03:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ingics-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:mime-version :content-transfer-encoding; bh=rVg+2q1LysC4jsTqD/flOu9ZF6StB6WyXTOMkh+cPgE=; b=e/0VBbaT1JW1DZ2UyPk87kZ8e6skiigOLDJqyU9sw2RCsceCWj6HGd8IqipUg9I8EO RQ0hBKueQUclTGyGNxZ5swBmvbpOrmT36cCDEkqLm6q9XlbY6Gm4gXCSCyPBYJgaF4ox 6ob3W6/Af15XY3zbROTZ+Jp8B3MKDDLFHnAbuO9SRoTd0zAtrid8chEvN2cN3kPt4X5h 5glZY5HpNi+/BUqB8XVvWD6Zxdtf8XRt9UpLvGAksHLN7Qc25uLoEWOpwfAQSh7HdNYu V5be2JDFaavv2/nuq1NgzZK7swHzuQlBuFCcZhn4QAiKQk7rf0iD4BO3HFWavurfOrzT hx9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:mime-version :content-transfer-encoding; bh=rVg+2q1LysC4jsTqD/flOu9ZF6StB6WyXTOMkh+cPgE=; b=D/aW+LXIWDk4qeIxY5YiwWvRGtBdUfxmc1D7LwGGfJLdsEUF7Y50U9puqHLSOHau/b CqIKjvklMDKl1zGFyghxww0GnUOD9HH47BgYtpCPKdag7EDuy2+nsNM6thhe32KqOIyj N5Rtm3pizifFo0aor6X91QtYH2oaDq1UXorxCUPTGe2UsaanB45V1kKNSavgg8wRRSfY S7ACfiekT5k3yMrhGuO09+ofMg6qzFsNlF4MUy9SpL2cTgdbsG10M//dmQ7Esw5AqOOK RFYasIkeG95uB+ZGxbiVlODytWxQJ7d/fnWRQOwIpw2IpEnZXelbUDUrtTo0VaND7Izi bTJQ== X-Gm-Message-State: AD7BkJIRot0YYGtfLmgzQBdBaapm595oBiWvqYv++h5ofOhtoML0qakG9Z1YE7uxdoT1WA== X-Received: by 10.67.30.163 with SMTP id kf3mr11740376pad.45.1459333510856; Wed, 30 Mar 2016 03:25:10 -0700 (PDT) Received: from phoenix (1-169-146-62.dynamic.hinet.net. [1.169.146.62]) by smtp.gmail.com with ESMTPSA id zp5sm4804351pac.9.2016.03.30.03.25.08 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Mar 2016 03:25:09 -0700 (PDT) Message-ID: <1459333507.6111.0.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Wed, 30 Mar 2016 18:25:07 +0800 X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Cc: Oder Chiou , Bard Liao , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH] ASoC: rt5677: Avoid duplicate the same test in each switch case X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Axel Lin --- sound/soc/codecs/rt5677.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 33e290b..b3f1db5 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -1241,60 +1241,46 @@ static int rt5677_dmic_use_asrc(struct snd_soc_dapm_widget *source, regmap_read(rt5677->regmap, RT5677_ASRC_5, &asrc_setting); asrc_setting = (asrc_setting & RT5677_AD_STO1_CLK_SEL_MASK) >> RT5677_AD_STO1_CLK_SEL_SFT; - if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && - asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) - return 1; break; case 10: regmap_read(rt5677->regmap, RT5677_ASRC_5, &asrc_setting); asrc_setting = (asrc_setting & RT5677_AD_STO2_CLK_SEL_MASK) >> RT5677_AD_STO2_CLK_SEL_SFT; - if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && - asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) - return 1; break; case 9: regmap_read(rt5677->regmap, RT5677_ASRC_5, &asrc_setting); asrc_setting = (asrc_setting & RT5677_AD_STO3_CLK_SEL_MASK) >> RT5677_AD_STO3_CLK_SEL_SFT; - if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && - asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) - return 1; break; case 8: regmap_read(rt5677->regmap, RT5677_ASRC_5, &asrc_setting); asrc_setting = (asrc_setting & RT5677_AD_STO4_CLK_SEL_MASK) >> RT5677_AD_STO4_CLK_SEL_SFT; - if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && - asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) - return 1; break; case 7: regmap_read(rt5677->regmap, RT5677_ASRC_6, &asrc_setting); asrc_setting = (asrc_setting & RT5677_AD_MONOL_CLK_SEL_MASK) >> RT5677_AD_MONOL_CLK_SEL_SFT; - if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && - asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) - return 1; break; case 6: regmap_read(rt5677->regmap, RT5677_ASRC_6, &asrc_setting); asrc_setting = (asrc_setting & RT5677_AD_MONOR_CLK_SEL_MASK) >> RT5677_AD_MONOR_CLK_SEL_SFT; - if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && - asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) - return 1; break; default: - break; + return 0; } + if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && + asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) + return 1; + return 0; }