soundwire: qcom: move sconfig in qcom_swrm_stream_alloc_ports() out of critical section
[linux-2.6-microblaze.git] / drivers / soundwire / qcom.c
index 754870a..e9a52c1 100644 (file)
@@ -1160,6 +1160,17 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
        int maxport, pn, nports = 0, ret = 0;
        unsigned int m_port;
 
+       if (direction == SNDRV_PCM_STREAM_CAPTURE)
+               sconfig.direction = SDW_DATA_DIR_TX;
+       else
+               sconfig.direction = SDW_DATA_DIR_RX;
+
+       /* hw parameters wil be ignored as we only support PDM */
+       sconfig.ch_count = 1;
+       sconfig.frame_rate = params_rate(params);
+       sconfig.type = stream->type;
+       sconfig.bps = 1;
+
        mutex_lock(&ctrl->port_lock);
        list_for_each_entry(m_rt, &stream->master_list, stream_node) {
                if (m_rt->direction == SDW_DATA_DIR_RX) {
@@ -1193,16 +1204,6 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
                }
        }
 
-       if (direction == SNDRV_PCM_STREAM_CAPTURE)
-               sconfig.direction = SDW_DATA_DIR_TX;
-       else
-               sconfig.direction = SDW_DATA_DIR_RX;
-
-       /* hw parameters wil be ignored as we only support PDM */
-       sconfig.ch_count = 1;
-       sconfig.frame_rate = params_rate(params);
-       sconfig.type = stream->type;
-       sconfig.bps = 1;
        sdw_stream_add_master(&ctrl->bus, &sconfig, pconfig,
                              nports, stream);
 out: