From patchwork Mon Nov 20 19:07:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13461939 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E5F7C2BB3F for ; Mon, 20 Nov 2023 19:08:32 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2BA30DF4; Mon, 20 Nov 2023 20:08:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2BA30DF4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1700507310; bh=m55U/K1A+lSnlct0C4IVi+teNYUlxMIIHZvxWK7g7q4=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=jvad5e1yNXKP/Dqn3pnvA0WFkEpNmMyJQC7h+ozWuMV8Ir3qHhaf1RZrLHZHqz81a BOBzK2oVY8JRJrZS9GztLQjf1h0CPEI2VSEdnEqAieYDeHo3BAfs1mi0ivaBUbl816 jGiibkhvhIk/k//p2ayJpmV8iKB/pVr0WiRcqjRA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9BEC0F805B4; Mon, 20 Nov 2023 20:07:58 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id C6A73F8057B; Mon, 20 Nov 2023 20:07:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BAD9DF80310; Mon, 20 Nov 2023 20:07:52 +0100 (CET) Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id ED54EF80249 for ; Mon, 20 Nov 2023 20:07:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ED54EF80249 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=F1yzP9HH Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a00b056ca38so79575466b.2 for ; Mon, 20 Nov 2023 11:07:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700507263; x=1701112063; darn=alsa-project.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FTpXl/MjWFr4GOxbA7yucE3ugQ9dkFJq52yIdGzpXCM=; b=F1yzP9HH3icc4OEkdJXessWkwXwP9Z1aZkzWXM/+O5gIpU6uaopDUCZrAYM1zHoF9i ZP7U6YEHgoIYfClWoodiXAY+n1J/Mu0IwRdpKr48kUGFNiYKbqJ1Rakfcq7ZWWwaO1rK mTGSrkqyThaUfxRAq8Ojc3d6ydSA0gCsnB/naKP1SiC6IstbbY03FWKVSgDwOAjd0y0s OKBP2l0WR6JYH/cW9+0bl2WGUTZl0088bxUGLsnvaUiBgMW8KN4/tEuztwkr3vxcCLgE w242ClIakE4h5xe2/J/qc0EosgVqNwGUme3h0rRv64Ma2+dCzB5iMHemIXdT/8K6b6Y4 sDzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700507263; x=1701112063; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FTpXl/MjWFr4GOxbA7yucE3ugQ9dkFJq52yIdGzpXCM=; b=HGkChtsv7JVhTtwKTtu7GjKLNxZMh+WXiYg78kzDk8EjXPcdjHjeOFfd0HRrB7j/Rc oFJeF7/xx3b/Uh3+f8kP9hbrDl+jOgLj32rYc6SRbIXiI9PWeGj4GTQ+J4x0TxJ10NY4 cd7liHUwdlVFvR00hhWV+0qyS3tgL7uYxOV4YYhLGV5zRBJ5xyKJMqW+vzY1YKhyEZdx NGNlCraBUORV6qqlkKnHWDt4eqWhBoZ9QPciKLULGEzY4jQnkXIc8yJ/4PTcg51Mzw+t LcLWaSCd+q3vUU5z7/lG2lJjrybCkzDhQq1zXJWp/712fcW/o1UOVpt8KY4almf8vM2s tMaQ== X-Gm-Message-State: AOJu0Yz+lbl4g8iONHd4i+EUkqd3OeF0hnwNE36WeqGBCXmgUrr3tDsj hMnqBaxn7J7t4piIekJIUFGrbw== X-Google-Smtp-Source: AGHT+IHCotI7oUSuFgXAQc4G4brytJuxRZwajqwIVB16jasq+WxHZRt/dsvF1AgDGC0xrVfamLAQ5A== X-Received: by 2002:a17:906:c244:b0:9db:e46c:569 with SMTP id bl4-20020a170906c24400b009dbe46c0569mr6001995ejb.45.1700507263410; Mon, 20 Nov 2023 11:07:43 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 11:07:43 -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 1/2] soundwire: qcom: drop unneeded qcom_swrm_stream_alloc_ports() cleanup Date: Mon, 20 Nov 2023 20:07:39 +0100 Message-Id: <20231120190740.339350-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Message-ID-Hash: JE5GFFBVXKJZIMLUBZON235THC5HWHQO X-Message-ID-Hash: JE5GFFBVXKJZIMLUBZON235THC5HWHQO X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The cleanup in "err" goto label clears bits from pconfig array which is a local variable. This does not have any effect outside of this function, so drop this useless code. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Konrad Dybcio --- drivers/soundwire/qcom.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index a1e2d6c98186..754870a4a047 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -1157,7 +1157,7 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl, struct sdw_port_runtime *p_rt; struct sdw_slave *slave; unsigned long *port_mask; - int i, maxport, pn, nports = 0, ret = 0; + int maxport, pn, nports = 0, ret = 0; unsigned int m_port; mutex_lock(&ctrl->port_lock); @@ -1183,7 +1183,7 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl, if (pn > maxport) { dev_err(ctrl->dev, "All ports busy\n"); ret = -EBUSY; - goto err; + goto out; } set_bit(pn, port_mask); pconfig[nports].num = pn; @@ -1205,12 +1205,7 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl, sconfig.bps = 1; sdw_stream_add_master(&ctrl->bus, &sconfig, pconfig, nports, stream); -err: - if (ret) { - for (i = 0; i < nports; i++) - clear_bit(pconfig[i].num, port_mask); - } - +out: mutex_unlock(&ctrl->port_lock); return ret; From patchwork Mon Nov 20 19:07:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13461940 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1034EC2BB3F for ; Mon, 20 Nov 2023 19:08:47 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BF717DEE; Mon, 20 Nov 2023 20:08:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BF717DEE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1700507325; bh=FpvpcXsF6QOAKDHyNhoncj99puNYtYw/t4txj7sygec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=MDCbxu+HRDuIiDsasmk1Qe3afOWa8CfzZEzsG9uNaP0eAI6OxpkiegjCK7nButhox YkQ0Yr824/f3AYGLWG06F8OLPD8AjeMMhihMzeEpZnap5sLOGDgkSxQZutyaymQldM cxefRc5QIgi3+CyMse+vwHQ3kB7AwaTaZ4wNxIvM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A015EF805BF; Mon, 20 Nov 2023 20:07:59 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id AFC9AF805C6; Mon, 20 Nov 2023 20:07:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 263ACF802E8; Mon, 20 Nov 2023 20:07:54 +0100 (CET) Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9D393F80093 for ; Mon, 20 Nov 2023 20:07:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9D393F80093 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=RZ5lHyyc Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-9ae2cc4d17eso647039766b.1 for ; Mon, 20 Nov 2023 11:07:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700507265; x=1701112065; darn=alsa-project.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=RZ5lHyyc1Ww2wMwhj1iR3I2zEa+LNgN221kcnt1VuY9kgrpydVyHfADkb2mEUCEw5X Powtvw/A3VnQaWcykgZjglyrk0D00+n0EE8bMs/hdIowhSpNUG1aeRAy/+bhKmxCoNFy xTVJzhw5vOkby4I33IB2KFx7cpMga4+swDmk5jLjahe/h17iNy3Fu45KNJdb16htTEts h5JB2pAXG6wuIOna2puNFliVFtztdRxwjeE+YtyGMHApBOCho3KeuezCOkOOmtTnQV8v 9RNSyRtfqBzfmrbYvveOVhQgY0iFtkiD8+35IWDn7zOmOhgpc+U0ZsIKfBmqgIzvYVWH AvgA== 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=ElEtmCDwMKP7Qizshwy8NChKjAbKRAYSBg0s44QJq2+4ok0rbLEsXUndkgMQ2sVQNd BZtOGXVBa7Mts08Z8057pREvdf6rVcSGrhHQ/W2QND7jTFsnbVVrp2xBSmEOXvFzHdJS V3jOp5SkOJJRl+kAVpUVhpPgwzGP4gHuoqETeZEVlyvg07ACPi17m5wzdS0VTeLvYtix 73zgMmiq9eYmgn1uW8XwR2C0y4KGc6EXlOpupOgtgRPqs52KlOfLGVQJ8WMMLeYZbYUP YKBlja5j3vZYIaiwWgz2h/NZlnpf/mCR6jPnJpTznRTy/5Mq8726eFtOxMU+6CYbADmG wv+g== X-Gm-Message-State: AOJu0Yz7NWFb+wu1XTDYb2jbAScnI4hNOu8jpvK2QdEpas/K0HzW891u phJormfVq5cdiRjyxXiPfkynRA== X-Google-Smtp-Source: AGHT+IFzePfbHnSU85wD/UiMsfBrFBH+dK0SBJM1TR0leyATrt8D374mvtWaZJyFxdwoOqbJ+3B6KA== 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 Message-ID-Hash: 63MADI2ZPNTL6M2XLZ6QYU4M6HFIESBF X-Message-ID-Hash: 63MADI2ZPNTL6M2XLZ6QYU4M6HFIESBF X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 Reviewed-by: Konrad Dybcio --- 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: