Skip to content

Commit 518aee3

Browse files
Srinivas-Kandagatlavinodkoul
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 5a4c1f0 commit 518aee3

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

drivers/soundwire/qcom.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ struct qcom_swrm_ctrl {
197197
int num_dout_ports;
198198
int cols_index;
199199
int rows_index;
200-
unsigned long dout_port_mask;
201-
unsigned long din_port_mask;
200+
unsigned long port_mask;
202201
u32 intr_mask;
203202
u8 rcmd_id;
204203
u8 wcmd_id;
@@ -1146,11 +1145,7 @@ static void qcom_swrm_stream_free_ports(struct qcom_swrm_ctrl *ctrl,
11461145
mutex_lock(&ctrl->port_lock);
11471146

11481147
list_for_each_entry(m_rt, &stream->master_list, stream_node) {
1149-
if (m_rt->direction == SDW_DATA_DIR_RX)
1150-
port_mask = &ctrl->dout_port_mask;
1151-
else
1152-
port_mask = &ctrl->din_port_mask;
1153-
1148+
port_mask = &ctrl->port_mask;
11541149
list_for_each_entry(p_rt, &m_rt->port_list, port_node)
11551150
clear_bit(p_rt->num, port_mask);
11561151
}
@@ -1195,13 +1190,9 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
11951190
if (ctrl->bus.id != m_rt->bus->id)
11961191
continue;
11971192

1198-
if (m_rt->direction == SDW_DATA_DIR_RX) {
1199-
maxport = ctrl->num_dout_ports;
1200-
port_mask = &ctrl->dout_port_mask;
1201-
} else {
1202-
maxport = ctrl->num_din_ports;
1203-
port_mask = &ctrl->din_port_mask;
1204-
}
1193+
port_mask = &ctrl->port_mask;
1194+
maxport = ctrl->num_dout_ports + ctrl->num_din_ports;
1195+
12051196

12061197
list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) {
12071198
slave = s_rt->slave;
@@ -1401,8 +1392,7 @@ static int qcom_swrm_get_port_config(struct qcom_swrm_ctrl *ctrl)
14011392
return -EINVAL;
14021393

14031394
/* Valid port numbers are from 1-14, so mask out port 0 explicitly */
1404-
set_bit(0, &ctrl->dout_port_mask);
1405-
set_bit(0, &ctrl->din_port_mask);
1395+
set_bit(0, &ctrl->port_mask);
14061396

14071397
ret = of_property_read_u8_array(np, "qcom,ports-offset1",
14081398
off1, nports);

0 commit comments

Comments
 (0)