From patchwork Thu May 22 05:02:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ai Chao X-Patchwork-Id: 891766 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 449E5175D47; Thu, 22 May 2025 05:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747890225; cv=none; b=IEJULZcFZS1zxxUHgQIP2fv0V9xDBKZQUh+7o6Y4sn4vMR3nvVOCd7ABI0EgcvvoixmustlFzz6Y9UBBXjMJhAV/ec9nQg8NQRc2binEFDzkyp+VlaEqxpw7f/QyYZGu0d7us/yAkpoVsvOuBoPPQxwR/pdukcHg1ICIVx8CJJg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747890225; c=relaxed/simple; bh=mhhKRQs8P6BKh2PDytxh4uDgF6hxeldPRk98eetlmjw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GrDpBELBX9Fi2DitrS4q/TcyryH0y62po40lnjumAcwEpET+CrswDNHAKYDEBn34Lg7ajfmxUFRxy/3adPeMj/o5bNgP0kIrwPNzesR8avritxmynNI+BaRATO/MUmlqmUjRNLR9DVc8WBzjqoR6U/Z2bMJYbGHcROx6n0TPkRc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 1e8158ce36ca11f0b29709d653e92f7d-20250522 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45, REQID:ea555cc8-6fa9-4a34-abf1-8b3b44eadeba, IP:0, U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067, CLOUDID:c89aa460ca0e367d394d49b188629272, BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:nil,Content:0|50,EDM:-3,IP: nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,L ES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 1e8158ce36ca11f0b29709d653e92f7d-20250522 Received: from node4.com.cn [(10.44.16.170)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 960776778; Thu, 22 May 2025 13:03:37 +0800 Received: from node4.com.cn (localhost [127.0.0.1]) by node4.com.cn (NSMail) with SMTP id DF9AE16003840; Thu, 22 May 2025 13:03:36 +0800 (CST) X-ns-mid: postfix-682EB028-75871135 Received: from kylin-pc.. (unknown [172.25.130.133]) by node4.com.cn (NSMail) with ESMTPA id B9FFF16001CC7; Thu, 22 May 2025 05:03:34 +0000 (UTC) From: Ai Chao To: perex@perex.cz, tiwai@suse.com, johannes@sipsolutions.net, kuninori.morimoto.gx@renesas.com, lgirdwood@gmail.com, broonie@kernel.org, jbrunet@baylibre.com, neil.armstrong@linaro.org, khilman@baylibre.com, martin.blumenstingl@googlemail.com, shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, shawnguo@kernel.org, s.hauer@pengutronix.de, srinivas.kandagatla@linaro.org Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, imx@lists.linux.dev, kernel@pengutronix.de, linux-arm-msm@vger.kernel.org, Ai Chao Subject: [PATCH v2 6/6] ASoC: qcom: Use helper function for_each_child_of_node_scoped() Date: Thu, 22 May 2025 13:02:59 +0800 Message-ID: <20250522050300.519244-7-aichao@kylinos.cn> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250522050300.519244-1-aichao@kylinos.cn> References: <20250522050300.519244-1-aichao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The for_each_child_of_node_scoped() helper provides a scope-based clean-up functionality to put the device_node automatically, and as such, there is no need to call of_node_put() directly. Thus, use this helper to simplify the code. Signed-off-by: Ai Chao --- sound/soc/qcom/lpass-cpu.c | 3 +-- sound/soc/qcom/qdsp6/q6afe-dai.c | 3 +-- sound/soc/qcom/qdsp6/q6asm-dai.c | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index 242bc16da36d..62f49fe46273 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -1046,7 +1046,6 @@ static unsigned int of_lpass_cpu_parse_sd_lines(struct device *dev, static void of_lpass_cpu_parse_dai_data(struct device *dev, struct lpass_data *data) { - struct device_node *node; int ret, i, id; /* Allow all channels by default for backwards compatibility */ @@ -1056,7 +1055,7 @@ static void of_lpass_cpu_parse_dai_data(struct device *dev, data->mi2s_capture_sd_mode[id] = LPAIF_I2SCTL_MODE_8CH; } - for_each_child_of_node(dev->of_node, node) { + for_each_child_of_node_scoped(dev->of_node, node) { ret = of_property_read_u32(node, "reg", &id); if (ret || id < 0) { dev_err(dev, "valid dai id not found: %d\n", ret); diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c index 7d9628cda875..64735f2adf8f 100644 --- a/sound/soc/qcom/qdsp6/q6afe-dai.c +++ b/sound/soc/qcom/qdsp6/q6afe-dai.c @@ -962,10 +962,9 @@ static const struct snd_soc_component_driver q6afe_dai_component = { static void of_q6afe_parse_dai_data(struct device *dev, struct q6afe_dai_data *data) { - struct device_node *node; int ret; - for_each_child_of_node(dev->of_node, node) { + for_each_child_of_node_scoped(dev->of_node, node) { unsigned int lines[Q6AFE_MAX_MI2S_LINES]; struct q6afe_dai_priv_data *priv; int id, i, num_lines; diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c index a400c9a31fea..d7680dd3a3bb 100644 --- a/sound/soc/qcom/qdsp6/q6asm-dai.c +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c @@ -1236,10 +1236,8 @@ static int of_q6asm_parse_dai_data(struct device *dev, { struct snd_soc_dai_driver *dai_drv; struct snd_soc_pcm_stream empty_stream; - struct device_node *node; int ret, id, dir, idx = 0; - pdata->num_dais = of_get_child_count(dev->of_node); if (!pdata->num_dais) { dev_err(dev, "No dais found in DT\n"); @@ -1253,7 +1251,7 @@ static int of_q6asm_parse_dai_data(struct device *dev, memset(&empty_stream, 0, sizeof(empty_stream)); - for_each_child_of_node(dev->of_node, node) { + for_each_child_of_node_scoped(dev->of_node, node) { ret = of_property_read_u32(node, "reg", &id); if (ret || id >= MAX_SESSIONS || id < 0) { dev_err(dev, "valid dai id not found:%d\n", ret);