From patchwork Sun Aug 2 15:19:41 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: 6925031 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 39D579F373 for ; Sun, 2 Aug 2015 15:28:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6B7762050E for ; Sun, 2 Aug 2015 15:28:47 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 452672040F for ; Sun, 2 Aug 2015 15:28:46 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 67163266488; Sun, 2 Aug 2015 17:28:45 +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 1FA8426150C; Sun, 2 Aug 2015 17:21:38 +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 92898265176; Sun, 2 Aug 2015 17:21:36 +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 01C1D26150C for ; Sun, 2 Aug 2015 17:20:29 +0200 (CEST) Received: (qmail 32010 invoked by uid 0); 2 Aug 2015 15:20:29 -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:29 -0000 From: Lars-Peter Clausen To: Mark Brown , Liam Girdwood Date: Sun, 2 Aug 2015 17:19:41 +0200 Message-Id: <1438528810-23498-14-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 13/42] ASoC: max9768: 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/max9768.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/max9768.c b/sound/soc/codecs/max9768.c index bd41128..5b82e26 100644 --- a/sound/soc/codecs/max9768.c +++ b/sound/soc/codecs/max9768.c @@ -63,8 +63,7 @@ static int max9768_set_gpio(struct snd_kcontrol *kcontrol, return 0; } -static const unsigned int volume_tlv[] = { - TLV_DB_RANGE_HEAD(43), +static const DECLARE_TLV_DB_RANGE(volume_tlv, 0, 0, TLV_DB_SCALE_ITEM(-16150, 0, 0), 1, 1, TLV_DB_SCALE_ITEM(-9280, 0, 0), 2, 2, TLV_DB_SCALE_ITEM(-9030, 0, 0), @@ -107,8 +106,8 @@ static const unsigned int volume_tlv[] = { 51, 57, TLV_DB_SCALE_ITEM(290, 50, 0), 58, 58, TLV_DB_SCALE_ITEM(650, 0, 0), 59, 62, TLV_DB_SCALE_ITEM(700, 60, 0), - 63, 63, TLV_DB_SCALE_ITEM(950, 0, 0), -}; + 63, 63, TLV_DB_SCALE_ITEM(950, 0, 0) +); static const struct snd_kcontrol_new max9768_volume[] = { SOC_SINGLE_TLV("Playback Volume", MAX9768_VOL, 0, 63, 0, volume_tlv),