* [PATCH] ALSA: ti: Use pcm_for_each_format() macro for PCM format iteration
@ 2023-05-17 13:01 Min-Hua Chen
2023-05-17 14:33 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Min-Hua Chen @ 2023-05-17 13:01 UTC (permalink / raw)
To: Peter Ujfalusi, Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
Cc: Min-Hua Chen, alsa-devel, linux-kernel
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 <minhuadotchen@gmail.com>
---
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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] ALSA: ti: Use pcm_for_each_format() macro for PCM format iteration
2023-05-17 13:01 [PATCH] ALSA: ti: Use pcm_for_each_format() macro for PCM format iteration Min-Hua Chen
@ 2023-05-17 14:33 ` Mark Brown
2023-05-17 23:42 ` Min-Hua Chen
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2023-05-17 14:33 UTC (permalink / raw)
To: Min-Hua Chen
Cc: Peter Ujfalusi, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 489 bytes --]
On Wed, May 17, 2023 at 09:01:22PM +0800, Min-Hua Chen wrote:
> Use pcm_for_each_format for the PCM format iteration and fix the
> following sparse warnings.
Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA: ti: Use pcm_for_each_format() macro for PCM format iteration
2023-05-17 14:33 ` Mark Brown
@ 2023-05-17 23:42 ` Min-Hua Chen
2023-05-18 1:21 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Min-Hua Chen @ 2023-05-17 23:42 UTC (permalink / raw)
To: broonie
Cc: alsa-devel, lgirdwood, linux-kernel, minhuadotchen, perex,
peter.ujfalusi, tiwai
Hi Mark,
>On Wed, May 17, 2023 at 09:01:22PM +0800, Min-Hua Chen wrote:
>> Use pcm_for_each_format for the PCM format iteration and fix the
>> following sparse warnings.
>
>Please submit patches using subject lines reflecting the style for the
>subsystem, this makes it easier for people to identify relevant patches.
>Look at what existing commits in the area you're changing are doing and
>make sure your subject lines visually resemble what they're doing.
Thanks for your comment. I think the subject should be changed to:
"ASoC: ti: davinci-mcasp: Use pcm_for_each_format() macro".
>There's no need to resubmit to fix this alone.
thanks
cheers,
Min-Hua
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA: ti: Use pcm_for_each_format() macro for PCM format iteration
2023-05-17 23:42 ` Min-Hua Chen
@ 2023-05-18 1:21 ` Mark Brown
2023-05-19 21:14 ` Min-Hua Chen
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2023-05-18 1:21 UTC (permalink / raw)
To: Min-Hua Chen
Cc: alsa-devel, lgirdwood, linux-kernel, perex, peter.ujfalusi, tiwai
[-- Attachment #1: Type: text/plain, Size: 207 bytes --]
On Thu, May 18, 2023 at 07:42:15AM +0800, Min-Hua Chen wrote:
> Thanks for your comment. I think the subject should be changed to:
> "ASoC: ti: davinci-mcasp: Use pcm_for_each_format() macro".
Yes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 484 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA: ti: Use pcm_for_each_format() macro for PCM format iteration
2023-05-18 1:21 ` Mark Brown
@ 2023-05-19 21:14 ` Min-Hua Chen
0 siblings, 0 replies; 5+ messages in thread
From: Min-Hua Chen @ 2023-05-19 21:14 UTC (permalink / raw)
To: broonie
Cc: alsa-devel, lgirdwood, linux-kernel, minhuadotchen, perex,
peter.ujfalusi, tiwai
Hi Mark,
>On Thu, May 18, 2023 at 07:42:15AM +0800, Min-Hua Chen wrote:
>
>> Thanks for your comment. I think the subject should be changed to:=20
>> "ASoC: ti: davinci-mcasp: Use pcm_for_each_format() macro".
>
>Yes.
ok, I will submit v2 for this.
cheers,
Min-Hua
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-19 21:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-17 13:01 [PATCH] ALSA: ti: Use pcm_for_each_format() macro for PCM format iteration Min-Hua Chen
2023-05-17 14:33 ` Mark Brown
2023-05-17 23:42 ` Min-Hua Chen
2023-05-18 1:21 ` Mark Brown
2023-05-19 21:14 ` Min-Hua Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®