Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp18174rwd; Fri, 19 May 2023 14:38:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7iyiixDLwLwv1CDUbTFu08G3JVd2UbKwIq7LXON48dRa6imypStmHYQqcqGsajC1G1FCei X-Received: by 2002:a05:6a00:23d5:b0:641:39cb:1716 with SMTP id g21-20020a056a0023d500b0064139cb1716mr4637123pfc.20.1684532281156; Fri, 19 May 2023 14:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684532281; cv=none; d=google.com; s=arc-20160816; b=HhYVG01OjJRLKH0EE4G/RHufOoULLTwiNyL08U8Qkg/MDw4pjvL+mxsoeUt9XNTiNf MwxKPcsJcrKgRlrAPOOeKA1kS2Fd3NlF0jWngjuYKV61DnrUxc5qOShcTiijhVpyPu1y 2VdjvX0D/qJp35HRbGlUiueUXPdNg2hGJ7o2JlEci1zaghZW0lQ8UFQyWolw7Nhe3cXD zh1Nvi9WMMWjuVJdOHKihlM9iHthafJ8fm3h21ur4fsfRD+oYHi+OEFq26CRQ+6H8kwd Wv6XDDQZ1XUwLcSklE5DTdbQnJCOQdd9BgSgw3Vm4MlQK3Kdc0nYb9u2y7UOPL2bmcQY WKhw== 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=Z5hMrPsXETXdUYGIPUMht35rFX/2A/wIEa9AD1NCqZE=; b=T7DBCaTpWpSQSRYUNXi4Oyc5P5nuShCcQkPlMwROqFtw6PFdr8WQP/bt6zfDcnivV1 9xiQUrZicWzH43QY7FGff01xnsXYynrefp0Svsv9DJa1mV65xd3yskiR2E37gKYqa0DI xRmUcFQUi6SeTsuzCncMBpaiWaGJBY1EpPRPvV87PPvrqXAIOSkOFQj6vdNFYQbZBo8D dbnerm6M9MZUdgo1I9kgaIINtxqeQsTBtOQHBIUIuYm/2+K9dmRG3xgxYQoP0jsr9ZDk Zw8VSs0t7/D7RQDcTv6IKxGlUOp3POqG6h1JScgdtyH8iaRSPgVcqB+mzRTx2GMJEb9P dRdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=feoHRJaj; 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 j76-20020a636e4f000000b0052cc0c1c39csi227364pgc.815.2023.05.19.14.37.48; Fri, 19 May 2023 14:38: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=feoHRJaj; 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 S229923AbjESVQn (ORCPT + 99 others); Fri, 19 May 2023 17:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229579AbjESVQm (ORCPT ); Fri, 19 May 2023 17:16:42 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 689C690 for ; Fri, 19 May 2023 14:16:41 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-64d293746e0so2208619b3a.2 for ; Fri, 19 May 2023 14:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684531001; x=1687123001; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Z5hMrPsXETXdUYGIPUMht35rFX/2A/wIEa9AD1NCqZE=; b=feoHRJajVXoGRyT1DlpVtAHKgDO2bRAUJNWq8xCnz05QMOevmCFEB9bWXjmtLfLX1G bwCv06j9XAzYtKywaraY1du3bcg/CNfYPPc5D0mqAxbnIpYnSK9mFmxuujnz1gh7pmbh GSpHd+P/cz4Vu0UY9cul2DtSIK8hFE3zevLiyHmi/e8dA01R2hgRM8+nS7xMoxTSRQca Ce3JnNyIapbbI1AKu7USnqJervS79llMPA3QenKCZVdfKCGv7prVeilEVZaFBTAKY1Ur TtA4A2Vjxb3cbMdjoZye7UGL0+5yuBxmqZOXAmrU3VMJdMdOFy94Ce1Y9/ZUjnxmXdWs 19sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684531001; x=1687123001; 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=Z5hMrPsXETXdUYGIPUMht35rFX/2A/wIEa9AD1NCqZE=; b=bLhTrEUuLrXFuaY3M1VNuIL1hkXnQG0uXdqtbPBmfoeR362YbApc4Vyh61dc5PrTNZ o2RPdjgr2ZOnCja4MZ4k92mN6APf+XgElIJOCxveV/B0445Lpdh/sPZohFmaGY2RWww3 mEH/bwOAkyOoET8YP41EuyaTywQYH+3N/eMuQjIpVD7ZZDqGziE8C+cT+SPkmhvoppso kkAtE92ZY7k8oSDyvzqVpgGzqutIgSaKMDaW4jTWHdtsJSYUJxmS+4rZnnHct4QLLwBN r3Q07JAXuoef/YiPy5+XBqiqYNz2ymj66sW41Oy7VBJBr5t6O5TIe8jEmZtHJ9XJCxi0 n84Q== X-Gm-Message-State: AC+VfDyyCZK095vnHmICmbLHluW4JQr7twdhPOFOEk1gb52miefbcFVC FqXc00T1zaRBtp2LcCSGyFwk/upukebQIw== X-Received: by 2002:a05:6a21:100a:b0:100:a636:6f22 with SMTP id nk10-20020a056a21100a00b00100a6366f22mr2546019pzb.19.1684531000853; Fri, 19 May 2023 14:16:40 -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 z6-20020aa785c6000000b00643aa9436c9sm110457pfn.172.2023.05.19.14.16.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 14:16:40 -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 v2] SoC: ti: davinci-mcasp: Use pcm_for_each_format() macro Date: Sat, 20 May 2023 05:16:36 +0800 Message-Id: <20230519211636.3699-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 --- Change since v1: use clear subject format --- 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