Skip to content

Commit 28425a1

Browse files
krzkgregkh
authored andcommitted
soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
commit 233a95f upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent af9ca9c commit 28425a1

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
@@ -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)