From patchwork Sun Aug 2 15:19:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 6925131 Return-Path: X-Original-To: patchwork-alsa-devel@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 B5AFFC05AC for ; Sun, 2 Aug 2015 15:36:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E50A4205C1 for ; Sun, 2 Aug 2015 15:36:18 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id B707B20459 for ; Sun, 2 Aug 2015 15:36:17 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C932A2665B2; Sun, 2 Aug 2015 17:36:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 5D5B0264F19; Sun, 2 Aug 2015 17:25:02 +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 0178F26546D; Sun, 2 Aug 2015 17:24:59 +0200 (CEST) Received: from smtp-out-138.synserver.de (smtp-out-138.synserver.de [212.40.185.138]) by alsa0.perex.cz (Postfix) with ESMTP id B8235264F1D for ; Sun, 2 Aug 2015 17:20:43 +0200 (CEST) Received: (qmail 308 invoked by uid 0); 2 Aug 2015 15:20:43 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 31181 Received: from ppp-188-174-94-41.dynamic.mnet-online.de (HELO lars-laptop.fritz.box) [188.174.94.41] by 217.119.54.81 with SMTP; 2 Aug 2015 15:20:43 -0000 From: Lars-Peter Clausen To: Mark Brown , Liam Girdwood Date: Sun, 2 Aug 2015 17:19:52 +0200 Message-Id: <1438528810-23498-25-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1438528810-23498-1-git-send-email-lars@metafoo.de> References: <1438528810-23498-1-git-send-email-lars@metafoo.de> Cc: Oder Chiou , Brian Austin , Lars-Peter Clausen , Support Opensource , Anish Kumar , patches@opensource.wolfsonmicro.com, alsa-devel@alsa-project.org, Paul Handrigan , Peter Ujfalusi , Bard Liao , Charles Keepax Subject: [alsa-devel] [PATCH 24/42] ASoC: rt5677: Replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGE 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP DECLARE_TLV_DB_RANGE() has the advantage over using TLV_DB_RANGE_HEAD() that it automatically calculates the number of items in the TLV and is hence less prone to manual error. Generate using the following coccinelle script // @@ declarer name DECLARE_TLV_DB_RANGE; identifier tlv; constant x; @@ -unsigned int tlv[] = { - TLV_DB_RANGE_HEAD(x), +DECLARE_TLV_DB_RANGE(tlv, ... -}; +); // Signed-off-by: Lars-Peter Clausen --- sound/soc/codecs/rt5677.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 8d70911..3062acd 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -788,16 +788,15 @@ static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); static const DECLARE_TLV_DB_SCALE(st_vol_tlv, -4650, 150, 0); /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ -static unsigned int bst_tlv[] = { - TLV_DB_RANGE_HEAD(7), +static const DECLARE_TLV_DB_RANGE(bst_tlv, 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0), 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0), 3, 5, TLV_DB_SCALE_ITEM(3000, 500, 0), 6, 6, TLV_DB_SCALE_ITEM(4400, 0, 0), 7, 7, TLV_DB_SCALE_ITEM(5000, 0, 0), - 8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0), -}; + 8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0) +); static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)