Skip to content

Commit 5bdc61e

Browse files
krzkvinodkoul
authored andcommitted
soundwire: qcom: move sconfig in qcom_swrm_stream_alloc_ports() out of critical section
Setting members of local variable "sconfig" in qcom_swrm_stream_alloc_ports() does not depend on any earlier code in this function, so can be moved up before the critical section. This makes the code a bit easier to follow because critical section is smaller. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Konrad Dybcio <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 5c68b66 commit 5bdc61e

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

drivers/soundwire/qcom.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,17 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
11601160
int maxport, pn, nports = 0, ret = 0;
11611161
unsigned int m_port;
11621162

1163+
if (direction == SNDRV_PCM_STREAM_CAPTURE)
1164+
sconfig.direction = SDW_DATA_DIR_TX;
1165+
else
1166+
sconfig.direction = SDW_DATA_DIR_RX;
1167+
1168+
/* hw parameters wil be ignored as we only support PDM */
1169+
sconfig.ch_count = 1;
1170+
sconfig.frame_rate = params_rate(params);
1171+
sconfig.type = stream->type;
1172+
sconfig.bps = 1;
1173+
11631174
mutex_lock(&ctrl->port_lock);
11641175
list_for_each_entry(m_rt, &stream->master_list, stream_node) {
11651176
if (m_rt->direction == SDW_DATA_DIR_RX) {
@@ -1193,16 +1204,6 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
11931204
}
11941205
}
11951206

1196-
if (direction == SNDRV_PCM_STREAM_CAPTURE)
1197-
sconfig.direction = SDW_DATA_DIR_TX;
1198-
else
1199-
sconfig.direction = SDW_DATA_DIR_RX;
1200-
1201-
/* hw parameters wil be ignored as we only support PDM */
1202-
sconfig.ch_count = 1;
1203-
sconfig.frame_rate = params_rate(params);
1204-
sconfig.type = stream->type;
1205-
sconfig.bps = 1;
12061207
sdw_stream_add_master(&ctrl->bus, &sconfig, pconfig,
12071208
nports, stream);
12081209
out:

0 commit comments

Comments
 (0)