Skip to content

Commit 233a95f

Browse files
krzkvinodkoul
authored andcommitted
soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
This reverts commit ab8d66d because it breaks codecs using non-continuous masks in source and sink ports. The commit missed the point that port numbers are not used as indices for iterating over prop.sink_ports or prop.source_ports. Soundwire core and existing codecs expect that the array passed as prop.sink_ports and prop.source_ports is continuous. The port mask still might be non-continuous, but that's unrelated. Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com> Closes: https://lore.kernel.org/all/b6c75eee-761d-44c8-8413-2a5b34ee2f98@linux.intel.com/ Fixes: ab8d66d ("soundwire: stream: fix programming slave ports for non-continous port maps") Acked-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Cc: stable@vger.kernel.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Tested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20240909164746.136629-1-krzysztof.kozlowski@linaro.org Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 431c164 commit 233a95f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/soundwire/stream.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,18 +1291,18 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_prop(struct sdw_slave *slave,
12911291
unsigned int port_num)
12921292
{
12931293
struct sdw_dpn_prop *dpn_prop;
1294-
unsigned long mask;
1294+
u8 num_ports;
12951295
int i;
12961296

12971297
if (direction == SDW_DATA_DIR_TX) {
1298-
mask = slave->prop.source_ports;
1298+
num_ports = hweight32(slave->prop.source_ports);
12991299
dpn_prop = slave->prop.src_dpn_prop;
13001300
} else {
1301-
mask = slave->prop.sink_ports;
1301+
num_ports = hweight32(slave->prop.sink_ports);
13021302
dpn_prop = slave->prop.sink_dpn_prop;
13031303
}
13041304

1305-
for_each_set_bit(i, &mask, 32) {
1305+
for (i = 0; i < num_ports; i++) {
13061306
if (dpn_prop[i].num == port_num)
13071307
return &dpn_prop[i];
13081308
}

0 commit comments

Comments
 (0)