diff mbox series

[09/34] ASoC: Intel: sof_sdw: Use for_each_set_bit

Message ID 20240326160429.13560-10-pierre-louis.bossart@linux.intel.com (mailing list archive)
State Accepted
Commit 2132dbc1a99480bddb995170abaa3c3e1cf8681d
Headers show
Series ASoC: Intel: boards: updates for 6.10 - part2 | expand

Commit Message

Pierre-Louis Bossart March 26, 2024, 4:04 p.m. UTC
From: Charles Keepax <ckeepax@opensource.cirrus.com>

Rather than open coding a loop to process each bit use for_each_set_bit.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/sof_sdw.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index 0ffa6e36dbed..a12283d3e1cc 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -5,6 +5,7 @@ 
  *  sof_sdw - ASOC Machine driver for Intel SoundWire platforms
  */
 
+#include <linux/bitmap.h>
 #include <linux/device.h>
 #include <linux/dmi.h>
 #include <linux/module.h>
@@ -1644,7 +1645,7 @@  static int sof_card_dai_links_create(struct snd_soc_card *card)
 	char *codec_name, *codec_dai_name;
 	int i, j, be_id = 0;
 	int hdmi_num;
-	int ssp_mask;
+	unsigned long ssp_mask;
 	int ret;
 
 	ret = get_dailink_info(dev, adr_link, &sdw_be_num, &codec_conf_num);
@@ -1782,12 +1783,10 @@  static int sof_card_dai_links_create(struct snd_soc_card *card)
 	if (!ssp_num)
 		goto DMIC;
 
-	for (i = 0, j = 0; ssp_mask; i++, ssp_mask >>= 1) {
+	j = 0;
+	for_each_set_bit(i, &ssp_mask, BITS_PER_TYPE(ssp_mask)) {
 		int playback, capture;
 
-		if (!(ssp_mask & 0x1))
-			continue;
-
 		name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", i);
 		cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", i);
 		codec_name = devm_kasprintf(dev, GFP_KERNEL, "i2c-%s:0%d",