Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers:soundwire: qcom: cleanup port maask calculations

Cleanup the port map calculations, existing masks of having separate
masks for in and out ports is not really required.
Having a single mask for all the ports in the controller is simple and
cuts of some unnecessary code.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20240618-soundwire-port-map-v1-1-9644e5545b9b@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Srinivas Kandagatla and committed by
Vinod Koul
518aee32 5a4c1f02

+6 -16
+6 -16
drivers/soundwire/qcom.c
··· 197 197 int num_dout_ports; 198 198 int cols_index; 199 199 int rows_index; 200 - unsigned long dout_port_mask; 201 - unsigned long din_port_mask; 200 + unsigned long port_mask; 202 201 u32 intr_mask; 203 202 u8 rcmd_id; 204 203 u8 wcmd_id; ··· 1145 1146 mutex_lock(&ctrl->port_lock); 1146 1147 1147 1148 list_for_each_entry(m_rt, &stream->master_list, stream_node) { 1148 - if (m_rt->direction == SDW_DATA_DIR_RX) 1149 - port_mask = &ctrl->dout_port_mask; 1150 - else 1151 - port_mask = &ctrl->din_port_mask; 1152 - 1149 + port_mask = &ctrl->port_mask; 1153 1150 list_for_each_entry(p_rt, &m_rt->port_list, port_node) 1154 1151 clear_bit(p_rt->num, port_mask); 1155 1152 } ··· 1190 1195 if (ctrl->bus.id != m_rt->bus->id) 1191 1196 continue; 1192 1197 1193 - if (m_rt->direction == SDW_DATA_DIR_RX) { 1194 - maxport = ctrl->num_dout_ports; 1195 - port_mask = &ctrl->dout_port_mask; 1196 - } else { 1197 - maxport = ctrl->num_din_ports; 1198 - port_mask = &ctrl->din_port_mask; 1199 - } 1198 + port_mask = &ctrl->port_mask; 1199 + maxport = ctrl->num_dout_ports + ctrl->num_din_ports; 1200 + 1200 1201 1201 1202 list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) { 1202 1203 slave = s_rt->slave; ··· 1392 1401 return -EINVAL; 1393 1402 1394 1403 /* Valid port numbers are from 1-14, so mask out port 0 explicitly */ 1395 - set_bit(0, &ctrl->dout_port_mask); 1396 - set_bit(0, &ctrl->din_port_mask); 1404 + set_bit(0, &ctrl->port_mask); 1397 1405 1398 1406 ret = of_property_read_u8_array(np, "qcom,ports-offset1", 1399 1407 off1, nports);