Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2145159rwd; Wed, 17 May 2023 06:26:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Fokw7/auykFK5PMB5CUk4CsGA6kqngiTrCgUk5l23Bg+O6nGkO3g93SPkZUCeC+Tm+Rea X-Received: by 2002:a05:6a21:7899:b0:101:2dde:37b7 with SMTP id bf25-20020a056a21789900b001012dde37b7mr41007897pzc.11.1684329961450; Wed, 17 May 2023 06:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684329961; cv=none; d=google.com; s=arc-20160816; b=g/k1PzSuzwwKFyx8k14oX+uBW09tDnLEyeSmwor78CMXrnlTuVd4IQ/G/RkjIiotwB GU8Q9Gvbhk560pOMdlgeEUBf4tpFp+uA60jL3dTLk0ep7EIHxPo+0ODhKwhRvy1H1k/H CyQ7yw/tyu0T7bCygZ6ogHhkeyZzltDPivspqsKL+h6hPT0Z6YyCvYPPF1jSmRRrZWm/ nqCc/AGMhn6wh/VNLMr8zTGMTg6VjpCbqLDTYHVrk0ITuxpBvR0ZJlIy02BOWQSyFUHq VbmVMoULb60nd6q+H4PSd+OVPLZF2MJqkUTgcdQUUvQErXO4bNy1thtpJcNPkOQEWtRW zXnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8eTr+kmtQOMistU8xT35doPKpqXFH7Y2/6qZfkliXQY=; b=cJpcH3r5VMqr6oMokyhFth1JPArZLgIfR0BzHlN3nTkolry0UlhAhV5ddYKxlJaKEv XJDOMAhnXtWD4lRccUNW23md/xr4rllse4phitqoNNEAEsz0bF+gL9Cygh0G1hHfzF1i +mUxCAUVDFv26ent7W0NOMpy/O2u6nRl7hdskK+HVSaMLlIfMEU4+5C+5AGDsLrPZcdX uBjdAFu0N/ZM10T4LAvtocY/tK/uMHff6M4BdX7aSAmRtGrmwOor04gBcpTHwofEaM3y OsIizdQaR31V7DzReQf6p0/Y7VBSZOWpijz+vzPT75PG2FF2yh61HixW0DdJmbGCu1q3 LleA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=seZjxxtm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a71-20020a63904a000000b005303db0ebebsi21154576pge.313.2023.05.17.06.25.47; Wed, 17 May 2023 06:26:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=seZjxxtm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231307AbjEQNBd (ORCPT + 99 others); Wed, 17 May 2023 09:01:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbjEQNBc (ORCPT ); Wed, 17 May 2023 09:01:32 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9DE130C1 for ; Wed, 17 May 2023 06:01:31 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-52cb78647ecso474775a12.1 for ; Wed, 17 May 2023 06:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684328491; x=1686920491; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=8eTr+kmtQOMistU8xT35doPKpqXFH7Y2/6qZfkliXQY=; b=seZjxxtmfTvReRahRdu8pf3VrMApAAYx3KRJlLrsfNCfVrBh3Ch/ftGO+CE6/3KLJp Bo+LVzN0mozW5ReZfrmPbMVxhZnaZCHKVoKA5wbnhZ5xxWJKLD4flaFyL7f6gIQaPi8o um5/OP1FIsg1tDn755f1ssscGWmiz9rkBrmNJ4B02SClqX+Bf9ASCj/BC4xLVFkdET61 68STZpPXYoP4BLEfp9buTukZCcc++pU+vUPAviVNc7nteXmVSBKhfIgAficiCBRq0B3d gCjKU+8ZtpTD3vmREkn1iMaJed3iVbNRonpxLitDZ8Pfsw2XTNySnhlgsrpZOQYmJVt7 mH9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684328491; x=1686920491; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8eTr+kmtQOMistU8xT35doPKpqXFH7Y2/6qZfkliXQY=; b=dt3owqVnSywzeK2QihkqvcRqhmRdzC70HZZgyNvv9I/GCjQ81mUXWJblpY9Z5/gvUM AoRG+BaqxkGYNGBD9I0OMLXKuuF85bW6XBvIda4/VJGHuY3k9bgKUaE5r6R3h4CqO5B5 3AnsktFG4RVdPsNC8c8ZfnS1Tv6WjmXP7vW8WOmntXeJ7afuALYr1K1o9FoYz9CyghgA +Ac2qRwysntmCuj9JPs548g1ID4hJA/XSFjbXtddDkw7ww6q1wQKeueCFsBgKbrE4euL jPo12k5a8G7oJYdUM8AqyfFRq/YcCytCoC7Btww2Gynw2MRH0DPsJfUjXZCGC0pPHJl/ 2N1w== X-Gm-Message-State: AC+VfDyFAzvYGEbIWkQ18aDTI/8df5EQHopCcY3b0PCGkKHNN6Yo4lSZ myKBG6UItQDyy/GKYVrJYzg30dwRto4= X-Received: by 2002:a17:902:b7cc:b0:1ac:3ddf:2299 with SMTP id v12-20020a170902b7cc00b001ac3ddf2299mr41063963plz.44.1684328489446; Wed, 17 May 2023 06:01:29 -0700 (PDT) Received: from ubuntu777.domain.name (36-228-97-28.dynamic-ip.hinet.net. [36.228.97.28]) by smtp.gmail.com with ESMTPSA id h7-20020a170902f7c700b001a1d41d1b8asm1725178plw.194.2023.05.17.06.01.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 06:01:29 -0700 (PDT) From: Min-Hua Chen To: Peter Ujfalusi , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: Min-Hua Chen , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] ALSA: ti: Use pcm_for_each_format() macro for PCM format iteration Date: Wed, 17 May 2023 21:01:22 +0800 Message-Id: <20230517130124.26033-1-minhuadotchen@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use pcm_for_each_format for the PCM format iteration and fix the following sparse warnings. sound/soc/ti/davinci-mcasp.c:1336:26: sparse: warning: restricted snd_pcm_format_t degrades to integer sound/soc/ti/davinci-mcasp.c:1358:26: sparse: warning: restricted snd_pcm_format_t degrades to integer sound/soc/ti/davinci-mcasp.c:1438:26: sparse: warning: restricted snd_pcm_format_t degrades to integer No functional changes. Signed-off-by: Min-Hua Chen --- sound/soc/ti/davinci-mcasp.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c index c0892be2992b..172fea764a31 100644 --- a/sound/soc/ti/davinci-mcasp.c +++ b/sound/soc/ti/davinci-mcasp.c @@ -1328,15 +1328,16 @@ static int davinci_mcasp_hw_rule_slot_width(struct snd_pcm_hw_params *params, struct davinci_mcasp_ruledata *rd = rule->private; struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); struct snd_mask nfmt; - int i, slot_width; + int slot_width; + snd_pcm_format_t i; snd_mask_none(&nfmt); slot_width = rd->mcasp->slot_width; - for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) { - if (snd_mask_test(fmt, i)) { + pcm_for_each_format(i) { + if (snd_mask_test_format(fmt, i)) { if (snd_pcm_format_width(i) <= slot_width) { - snd_mask_set(&nfmt, i); + snd_mask_set_format(&nfmt, i); } } } @@ -1350,15 +1351,16 @@ static int davinci_mcasp_hw_rule_format_width(struct snd_pcm_hw_params *params, struct davinci_mcasp_ruledata *rd = rule->private; struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); struct snd_mask nfmt; - int i, format_width; + int format_width; + snd_pcm_format_t i; snd_mask_none(&nfmt); format_width = rd->mcasp->max_format_width; - for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) { - if (snd_mask_test(fmt, i)) { + pcm_for_each_format(i) { + if (snd_mask_test_format(fmt, i)) { if (snd_pcm_format_width(i) == format_width) { - snd_mask_set(&nfmt, i); + snd_mask_set_format(&nfmt, i); } } } @@ -1431,12 +1433,13 @@ static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params, struct snd_mask nfmt; int rate = params_rate(params); int slots = rd->mcasp->tdm_slots; - int i, count = 0; + int count = 0; + snd_pcm_format_t i; snd_mask_none(&nfmt); - for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) { - if (snd_mask_test(fmt, i)) { + pcm_for_each_format(i) { + if (snd_mask_test_format(fmt, i)) { uint sbits = snd_pcm_format_width(i); unsigned int sysclk_freq; int ppm; @@ -1454,7 +1457,7 @@ static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params, sbits * slots * rate, false); if (abs(ppm) < DAVINCI_MAX_RATE_ERROR_PPM) { - snd_mask_set(&nfmt, i); + snd_mask_set_format(&nfmt, i); count++; } } -- 2.34.1