From patchwork Fri May 19 21:16:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Min-Hua Chen X-Patchwork-Id: 13249135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 781D2C77B7D for ; Sat, 20 May 2023 08:22:33 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6A2E4827; Sat, 20 May 2023 10:21:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6A2E4827 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1684570951; bh=Gw9Nk8PkDIR6PLpCsbcwUBf7wrsSxj5ZWCKQZCGzVW0=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=sBfuIuFo1UNehNw5RdAz9CvZRyRXfkDC8r4o9lRRSOqZITBp/nmF5hJsmotTNRw+/ Q1cJGkXY6DIORJDtQd3mFHoDd6zfpmUJ5Gbl+uQSOIvq8p0wlSYOiKgmZg0NzIC69p 1glCtHj+Rksce4kpOMkGWRqaSs2JIGBW2KKP8/hg= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 98B07F80567; Sat, 20 May 2023 10:20:47 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 1B983F80571; Sat, 20 May 2023 10:20:47 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0C64AF80272; Fri, 19 May 2023 23:16:48 +0200 (CEST) Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3CD31F8024E for ; Fri, 19 May 2023 23:16:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3CD31F8024E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=feoHRJaj Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-64d2467d640so2466266b3a.1 for ; Fri, 19 May 2023 14:16:42 -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=GGh3m1QgKEMoqlRIywWf55tLHCmWXgDVZ9oY4cge5c/BDChCX6wTRI6phxp2mlkUPn 4xGH3FbKIbdNY6K/9Z4LdF/2SOJLh6919STTePppO7do6r1umFkEdFDLu2WilZ0J9nsZ W9h27jf0ZTc1YaV42HfJ0GETGJLdciGN5Gb6bpWTo+C64+ZrdnDDgGUAkASIHfyH0H7+ XFyEkFVDlL2s0Pypw5EeqEuczXFg9WM9DuYBbIwUyel48tYnV0irGjszjdkyLkEb+ZR4 V6GVeztP6nCGBf9mEMDRJJNSovdLSGO77hspK1KMI37fXH+SXHGSEIhq2EfMOdSQtwIL b3aw== X-Gm-Message-State: AC+VfDw37Nm4PdPY6Nnn6MXh6WS+oePhFLmh5jgApPB+tfbfJfyAWkbj 7coNztrXKVs3G3GsS0NMpO4= X-Google-Smtp-Source: ACHHUZ445VWHeMjyyHhoM02szw1B7s5OGkgW9z17+MhAY5V98leMuZwdsDxZF09fT2aYyVu6pehJ4A== 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 X-MailFrom: minhuadotchen@gmail.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: 6WNGKPNR3HNTE4IRIISHKJQ53SA5YXEH X-Message-ID-Hash: 6WNGKPNR3HNTE4IRIISHKJQ53SA5YXEH X-Mailman-Approved-At: Sat, 20 May 2023 08:20:42 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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++; } }