Skip to content

Commit b2523fd

Browse files
krzkheftig
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 <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Fixes: ab8d66d ("soundwire: stream: fix programming slave ports for non-continous port maps") Signed-off-by: Krzysztof Kozlowski <[email protected]> Cherry-picked-for: https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/76
1 parent 764a86f commit b2523fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/soundwire/stream.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1286,18 +1286,18 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_prop(struct sdw_slave *slave,
12861286
unsigned int port_num)
12871287
{
12881288
struct sdw_dpn_prop *dpn_prop;
1289-
unsigned long mask;
1289+
u8 num_ports;
12901290
int i;
12911291

12921292
if (direction == SDW_DATA_DIR_TX) {
1293-
mask = slave->prop.source_ports;
1293+
num_ports = hweight32(slave->prop.source_ports);
12941294
dpn_prop = slave->prop.src_dpn_prop;
12951295
} else {
1296-
mask = slave->prop.sink_ports;
1296+
num_ports = hweight32(slave->prop.sink_ports);
12971297
dpn_prop = slave->prop.sink_dpn_prop;
12981298
}
12991299

1300-
for_each_set_bit(i, &mask, 32) {
1300+
for (i = 0; i < num_ports; i++) {
13011301
if (dpn_prop[i].num == port_num)
13021302
return &dpn_prop[i];
13031303
}

0 commit comments

Comments
 (0)