soundwire: bus: Fix wrong port number in sdw_handle_slave_alerts()
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Sat, 17 Sep 2022 14:02:56 +0000 (15:02 +0100)
committerVinod Koul <vkoul@kernel.org>
Tue, 20 Sep 2022 05:05:39 +0000 (10:35 +0530)
for_each_set_bit() gives the bit-number counting from 0 (LSbit==0).
When processing INTSTAT2, bit 0 is DP4 so the port number is (bit + 4).
Likewise for INTSTAT3 bit 0 is DP11 so port number is (bit + 11).

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220917140256.689678-1-rf@opensource.cirrus.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/bus.c

index 8eded1a552270690dadac4697852fd947e04ebea..df0ae869ee51dd3f816ac939dfb6d533b4645173 100644 (file)
@@ -1622,7 +1622,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
                        port = buf2[0] & SDW_SCP_INTSTAT2_PORT4_10;
                        for_each_set_bit(bit, &port, 8) {
                                /* scp2 ports start from 4 */
-                               port_num = bit + 3;
+                               port_num = bit + 4;
                                sdw_handle_port_interrupt(slave,
                                                port_num,
                                                &port_status[port_num]);
@@ -1634,7 +1634,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
                        port = buf2[1] & SDW_SCP_INTSTAT3_PORT11_14;
                        for_each_set_bit(bit, &port, 8) {
                                /* scp3 ports start from 11 */
-                               port_num = bit + 10;
+                               port_num = bit + 11;
                                sdw_handle_port_interrupt(slave,
                                                port_num,
                                                &port_status[port_num]);