soundwire: stream: fix programming slave ports for non-continous port maps
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Mon, 29 Jul 2024 14:01:57 +0000 (16:01 +0200)
committerVinod Koul <vkoul@kernel.org>
Sat, 17 Aug 2024 17:25:05 +0000 (22:55 +0530)
commitab8d66d132bc8f1992d3eb6cab8d32dda6733c84
tree91f8a3c3e081e1358869f7aa6bf049cd1fc92b2a
parent8400291e289ee6b2bf9779ff1c83a291501f017b
soundwire: stream: fix programming slave ports for non-continous port maps

Two bitmasks in 'struct sdw_slave_prop' - 'source_ports' and
'sink_ports' - define which ports to program in
sdw_program_slave_port_params().  The masks are used to get the
appropriate data port properties ('struct sdw_get_slave_dpn_prop') from
an array.

Bitmasks can be non-continuous or can start from index different than 0,
thus when looking for matching port property for given port, we must
iterate over mask bits, not from 0 up to number of ports.

This fixes allocation and programming slave ports, when a source or sink
masks start from further index.

Fixes: f8101c74aa54 ("soundwire: Add Master and Slave port programming")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240729140157.326450-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/stream.c