Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: ti: davinci-mcasp: Use pcm_for_each_format() macro

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>
Link: https://lore.kernel.org/r/20230519211636.3699-1-minhuadotchen@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Min-Hua Chen and committed by
Mark Brown
c3079282 e89f45ed

+15 -12
+15 -12
sound/soc/ti/davinci-mcasp.c
··· 1328 1328 struct davinci_mcasp_ruledata *rd = rule->private; 1329 1329 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 1330 1330 struct snd_mask nfmt; 1331 - int i, slot_width; 1331 + int slot_width; 1332 + snd_pcm_format_t i; 1332 1333 1333 1334 snd_mask_none(&nfmt); 1334 1335 slot_width = rd->mcasp->slot_width; 1335 1336 1336 - for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) { 1337 - if (snd_mask_test(fmt, i)) { 1337 + pcm_for_each_format(i) { 1338 + if (snd_mask_test_format(fmt, i)) { 1338 1339 if (snd_pcm_format_width(i) <= slot_width) { 1339 - snd_mask_set(&nfmt, i); 1340 + snd_mask_set_format(&nfmt, i); 1340 1341 } 1341 1342 } 1342 1343 } ··· 1351 1350 struct davinci_mcasp_ruledata *rd = rule->private; 1352 1351 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 1353 1352 struct snd_mask nfmt; 1354 - int i, format_width; 1353 + int format_width; 1354 + snd_pcm_format_t i; 1355 1355 1356 1356 snd_mask_none(&nfmt); 1357 1357 format_width = rd->mcasp->max_format_width; 1358 1358 1359 - for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) { 1360 - if (snd_mask_test(fmt, i)) { 1359 + pcm_for_each_format(i) { 1360 + if (snd_mask_test_format(fmt, i)) { 1361 1361 if (snd_pcm_format_width(i) == format_width) { 1362 - snd_mask_set(&nfmt, i); 1362 + snd_mask_set_format(&nfmt, i); 1363 1363 } 1364 1364 } 1365 1365 } ··· 1433 1431 struct snd_mask nfmt; 1434 1432 int rate = params_rate(params); 1435 1433 int slots = rd->mcasp->tdm_slots; 1436 - int i, count = 0; 1434 + int count = 0; 1435 + snd_pcm_format_t i; 1437 1436 1438 1437 snd_mask_none(&nfmt); 1439 1438 1440 - for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) { 1441 - if (snd_mask_test(fmt, i)) { 1439 + pcm_for_each_format(i) { 1440 + if (snd_mask_test_format(fmt, i)) { 1442 1441 uint sbits = snd_pcm_format_width(i); 1443 1442 unsigned int sysclk_freq; 1444 1443 int ppm; ··· 1457 1454 sbits * slots * rate, 1458 1455 false); 1459 1456 if (abs(ppm) < DAVINCI_MAX_RATE_ERROR_PPM) { 1460 - snd_mask_set(&nfmt, i); 1457 + snd_mask_set_format(&nfmt, i); 1461 1458 count++; 1462 1459 } 1463 1460 }