]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
d104124ad52b6d721500c1ba37fff284c1f782ac
[thirdparty/kernel/stable-queue.git] /
1 From 233a95fd574fde1c375c486540a90304a2d2d49f Mon Sep 17 00:00:00 2001
2 From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
3 Date: Mon, 9 Sep 2024 18:47:46 +0200
4 Subject: soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
5
6 From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
7
8 commit 233a95fd574fde1c375c486540a90304a2d2d49f upstream.
9
10 This reverts commit ab8d66d132bc8f1992d3eb6cab8d32dda6733c84 because it
11 breaks codecs using non-continuous masks in source and sink ports. The
12 commit missed the point that port numbers are not used as indices for
13 iterating over prop.sink_ports or prop.source_ports.
14
15 Soundwire core and existing codecs expect that the array passed as
16 prop.sink_ports and prop.source_ports is continuous. The port mask still
17 might be non-continuous, but that's unrelated.
18
19 Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
20 Closes: https://lore.kernel.org/all/b6c75eee-761d-44c8-8413-2a5b34ee2f98@linux.intel.com/
21 Fixes: ab8d66d132bc ("soundwire: stream: fix programming slave ports for non-continous port maps")
22 Acked-by: Bard Liao <yung-chuan.liao@linux.intel.com>
23 Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
24 Cc: stable@vger.kernel.org
25 Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
26 Tested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
27 Link: https://lore.kernel.org/r/20240909164746.136629-1-krzysztof.kozlowski@linaro.org
28 Signed-off-by: Vinod Koul <vkoul@kernel.org>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30 ---
31 drivers/soundwire/stream.c | 8 ++++----
32 1 file changed, 4 insertions(+), 4 deletions(-)
33
34 --- a/drivers/soundwire/stream.c
35 +++ b/drivers/soundwire/stream.c
36 @@ -1272,18 +1272,18 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_p
37 unsigned int port_num)
38 {
39 struct sdw_dpn_prop *dpn_prop;
40 - unsigned long mask;
41 + u8 num_ports;
42 int i;
43
44 if (direction == SDW_DATA_DIR_TX) {
45 - mask = slave->prop.source_ports;
46 + num_ports = hweight32(slave->prop.source_ports);
47 dpn_prop = slave->prop.src_dpn_prop;
48 } else {
49 - mask = slave->prop.sink_ports;
50 + num_ports = hweight32(slave->prop.sink_ports);
51 dpn_prop = slave->prop.sink_dpn_prop;
52 }
53
54 - for_each_set_bit(i, &mask, 32) {
55 + for (i = 0; i < num_ports; i++) {
56 if (dpn_prop[i].num == port_num)
57 return &dpn_prop[i];
58 }