Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2453876rdb; Mon, 20 Nov 2023 11:09:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHf3E2ytb4+HJ8vFa6zLzVMXexAi+UfkZfJYZln1gJekI46q9gVdeRlA1mTv1Mm1T23FQ+/ X-Received: by 2002:a05:6a20:da8a:b0:186:603b:6b4a with SMTP id iy10-20020a056a20da8a00b00186603b6b4amr8342371pzb.32.1700507371541; Mon, 20 Nov 2023 11:09:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700507371; cv=none; d=google.com; s=arc-20160816; b=b9RB35Flqrv9kOBBqro8xHuXRIJORl2+A6pfG7w43Vq4hjnp0DjB2LXOuetxeXTuAm DaOv8mvOjRpww5xKD+CxA+pYCyABJ2WRNhN9Yej1JNJVtcHQJHbEJYZECKlpj2SHCKhj GovXV513ukHcXFAPlV1m1U4bfsGRfBC1EcufcAKT3SRUZ01gx5Vubm/yFXQu/MwdbrDH ttuoTVoAr4Ut15KtD8+dBtVI/AddpYt0KkNMWFwUGTDk8S5RLoO2hw/yu9dd2uxZLYUx 2QTufT8Oz8c+Q1HRhzuMl2ha/TxpImKji2jFAfa5LcHdoeaYJu7DCC5Fj+MBQzbOn/MH m/3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fcghsarjrS3tHRySGsk8wGm4K++pTmTjyafJFK3g/Cs=; fh=6pu/Hu042HChh718+qWoPctCY+1u//Tk2FTXnA+DAJU=; b=KAx1/AO9pWvmuaWcrEZsWBoIiNItUcRQaggg1DxQfbyd3ErELF79wTunG8nGS7lJ5F W0+Mb6KVOOv5J+PCcbJ7NfRfO5DC6SXVGwGkw67qWCO4krSmz+BGskAfqtA/9cA4bhOS 0YQL5ppJ8acqHGS6qW7bLjDMh01pBNS2RSSRFqqgCUxXjlt1hDWRPh28NIx28lOk5MUV 4MiEkJcxAlKP+EXiofBN/MU/J84AsS9shWpLlnv1avP0HA7OODxIwbsM4Ku0AWPdvXK2 U3yrx6UAJhUJiU7T4rb3Fp1rspURs9NmITd8bWDQY+v0sTedSjsLhLVKTyQg4MK6YRDp ZgSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f35kR+nN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d18-20020a056a00199200b006cb90b336dcsi3162464pfl.267.2023.11.20.11.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 11:09:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f35kR+nN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6391F80FA862; Mon, 20 Nov 2023 11:08:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232300AbjKTTHy (ORCPT + 99 others); Mon, 20 Nov 2023 14:07:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231859AbjKTTHv (ORCPT ); Mon, 20 Nov 2023 14:07:51 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58A56ED for ; Mon, 20 Nov 2023 11:07:46 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-9e1021dbd28so646756966b.3 for ; Mon, 20 Nov 2023 11:07:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700507265; x=1701112065; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fcghsarjrS3tHRySGsk8wGm4K++pTmTjyafJFK3g/Cs=; b=f35kR+nNnKF+FPTdCG1sKB/Lf7bbiCp5lEm6ewPm3RLyGjyTvsg0JpHxOH/1WK8+u8 /USDkwM1FmL7bNOtE44bi4vKmV3cyXml23u+dyVLZ9L8qPZJMDqwnCxIFS6eiPlMazZJ GHVYPhk+frGXbYTlJBBE7RGdLCWudqojLL8KpcadfKBHbKwftIl4sF+jyhEOJ3NkwURU DxzDG10X0cPY7g/xXxdyD1KrKRJCXvhEjkI2/7O4ew5DTs4x7QCHp7jwxuhuur4YgON9 OmRcC/GKWatrR/CxtHwrQ6mpBH1NFEKaGGfrNCrubzpzQdfG04lCpCM+/Zn/HT5WJwMp veiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700507265; x=1701112065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fcghsarjrS3tHRySGsk8wGm4K++pTmTjyafJFK3g/Cs=; b=RwSR33Wk/B8aO8TRL89JqOTWiUo213h+h5A3Z5cGZwCIYjlP/Qx0bhvatxClNq1ppp Vn3vMnUaw/FmHdOiIiJnQGDr+RLQ2x5J5lLp+OHGxO8Aiv7N2u97WCDgXaOGqPBNyMMd lBZZb9s7Sa8VqhHbfJASwjLtS5ALz1XvY0ueWpK4atdim/FyhRaRe0WFvMMlse7ikWSB GKfCvL1+pAe16V537dUsatO0b1yXw+dMABcmIsUfrl5BxpTs5TJ22Bva8miLHGzdEzM+ sQld2mqp2+nILnY6Rmeoz0c0YF1uIk9RycMEg10ZckRhXRUV9V7GEhgUi4dz39ntO49W 4B5g== X-Gm-Message-State: AOJu0Yybwc81P7od6DgxkNjuNc95pUoNElHpQEQuJjgouGNwygDKS/Tr OVRT56HUWU3d9Tqe3/pVzyZ1cw== X-Received: by 2002:a17:906:3f18:b0:9fe:aacb:bf6a with SMTP id c24-20020a1709063f1800b009feaacbbf6amr2737368ejj.69.1700507264786; Mon, 20 Nov 2023 11:07:44 -0800 (PST) Received: from krzk-bin.. ([178.197.222.11]) by smtp.gmail.com with ESMTPSA id a18-20020a1709066d5200b00977cad140a8sm4177521ejt.218.2023.11.20.11.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 11:07:44 -0800 (PST) From: Krzysztof Kozlowski To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 2/2] soundwire: qcom: move sconfig in qcom_swrm_stream_alloc_ports() out of critical section Date: Mon, 20 Nov 2023 20:07:40 +0100 Message-Id: <20231120190740.339350-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231120190740.339350-1-krzysztof.kozlowski@linaro.org> References: <20231120190740.339350-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 11:08:06 -0800 (PST) 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 --- drivers/soundwire/qcom.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 754870a4a047..e9a52c1bd359 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -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: -- 2.34.1