From patchwork Mon Dec 2 16:21:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 180621 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp183097ile; Mon, 2 Dec 2019 08:21:51 -0800 (PST) X-Google-Smtp-Source: APXvYqxSdSTvFb7AVw+mdtgMFiKQit/XvJpSrJdeR53csPcJBYq4YuOavl51g/EtLnzhYlzOPfyh X-Received: by 2002:adf:8041:: with SMTP id 59mr5411894wrk.257.1575303710852; Mon, 02 Dec 2019 08:21:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575303710; cv=none; d=google.com; s=arc-20160816; b=TPg99DVHn8rIotGC9el+Uo731VGb+Sz1/azvXuFDO0xGFo0S8SW15kzyepnYbbSbLb E86hPuQuolTdABNPxFBlCP04p4qr6vT2k73FDlQYQb6clBXPECDmZyYwFTzG6frt7I5n zy4VXFaWHbUI8QSgM+/Ic8nCEIJIi1PyUZi73pwu5u5DTS0ZxOIkO+ZOr554xtkz+McG LA3NK5ot1jAp7EXztXt6BiiY71cIIULcfBKm/Yk5LZRGGPV+l4ifPu12sZR/uOm1dhQy DHlAIRB4AoENuBHTzvGofiv5gWfhhZmSS0YEuPwHoZChB3EQ8+J4QYYDO1+t9AdKTHjn aJOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GH8jZgvcmqwZW7+ZZ9HpIyzBO+HHjblMrgUlhjTkr1o=; b=ceEdADNXv1co1kozWrJAmBTi1faJbNw/Kz7t2v5aSADoaCZPI8yyAtwopMPpaaaRdA dGlSH+2zwH0uYqtAW+nkiem9U9Vbepg2boFG3RxP2XKIn5s6ILREkpiLUl9wTfzFzMPE uguLeADtJ10dBWF1Ppckk5Zm1OXKDXZUTPS2BoYNKo3kcMm+CA8bRP8gP1+eWcJWsQmK yOVQwTZapqZnX8KFV9NvkbWf+LGrF1/esCj5tKdp2V51FgrpIebquvSgFbdifI2yQE/h YsRQk+AmLHaOQS6EVlssxQT+5MXTW+boQvDgkZZ2I9m4NPlJK+nfxckWt0yjnzfHPUYo 6vfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wwtDicZu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t18si20736645ejx.354.2019.12.02.08.21.50; Mon, 02 Dec 2019 08:21:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wwtDicZu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727698AbfLBQVs (ORCPT + 27 others); Mon, 2 Dec 2019 11:21:48 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:37691 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727669AbfLBQVo (ORCPT ); Mon, 2 Dec 2019 11:21:44 -0500 Received: by mail-wr1-f67.google.com with SMTP id w15so14102916wru.4 for ; Mon, 02 Dec 2019 08:21:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GH8jZgvcmqwZW7+ZZ9HpIyzBO+HHjblMrgUlhjTkr1o=; b=wwtDicZu/7SddGtkXbL33maSZtHCYO1JIf/RboO5KNIbTfhdubKaXiB0DDzKrNXSFd mvW7wprl/QvhrWIV6DVSHClsxvjmXgXb5C3Fdiom2wnOk+/ZqtUyKgua2NP3D7dgZwPl W4aEAsm+q7hDiDs3N+PdYefY9Yb1gL92Tiq2cJq7I8qz/k1fcHJTM4eY56UHAgpD+E5u 9IM7JZegB0O6G+9j4AdIaykPuWdwa3oDEcv45hGOEq4foDjRFHRkxVfEz3St9EO7bl1m 5S+QFGCE96gNpq2PMDEiHRgiVmCzFnpXQNj/Mn0rfk6KsiNM7xWjEIht+gBKGoR2XUXE 8nkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GH8jZgvcmqwZW7+ZZ9HpIyzBO+HHjblMrgUlhjTkr1o=; b=sXLlbprGbZ1o9e2jcVFdTtYdgWvAbit+DkcAnkhz1p+G4hkNvg6nx8w7NSDWHpbfXQ XdtkhyFvLSwndk09yKb/oG1QQLkrRRVbFYALFS/M4YauCn97RcaBBz8yBx48/rHxyBn3 9T4KKMFsxM09b59Rn5LXeVFLCyBZN5OtUuGBktNbcmoLnzwLpK14OY3DRdKF7CxW9goM dECXJbVrrzsJKBBk/3wdHUQ8x2JV3PZAnbTitzzLNpcYqAhnS/7rza7v9mNQdNP/vAS2 wk4onHWC7JwPLFJt0bavOqpXK/QaRJiVpvDi47NZfkZG6B96et1bHNFX7xdXkqwVygKD E0kg== X-Gm-Message-State: APjAAAXkSUJKSdW2y2DvJibWz9kCtanIlGt+dF5rWobg5uP/YleigJ2S 9WPmgf6bkrmCEsfvfd22S3KB+A== X-Received: by 2002:adf:b19a:: with SMTP id q26mr25103882wra.79.1575303701678; Mon, 02 Dec 2019 08:21:41 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id i9sm39204516wrb.2.2019.12.02.08.21.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Dec 2019 08:21:41 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org Cc: bjorn.andersson@linaro.org, agross@kernel.org, digetx@gmail.com, evgreen@chromium.org, daidavid1@codeaurora.org, masneyb@onstation.org, sibis@codeaurora.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v2 5/5] interconnect: qcom: Use the new common helper for node removal Date: Mon, 2 Dec 2019 18:21:33 +0200 Message-Id: <20191202162133.7089-5-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191202162133.7089-1-georgi.djakov@linaro.org> References: <20191202162133.7089-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a new helper function for removing all nodes. Let's use it instead of duplicating the code. Signed-off-by: Georgi Djakov --- v2: - Don't call qnoc_remove() directly from probe. (Dmitry) drivers/interconnect/qcom/msm8974.c | 17 ++++------------- drivers/interconnect/qcom/qcs404.c | 17 ++++------------- drivers/interconnect/qcom/sdm845.c | 16 +++------------- 3 files changed, 11 insertions(+), 39 deletions(-) Reviewed-by: Bjorn Andersson diff --git a/drivers/interconnect/qcom/msm8974.c b/drivers/interconnect/qcom/msm8974.c index ca25f31e5f0b..3a313e11e73d 100644 --- a/drivers/interconnect/qcom/msm8974.c +++ b/drivers/interconnect/qcom/msm8974.c @@ -643,7 +643,7 @@ static int msm8974_icc_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct icc_onecell_data *data; struct icc_provider *provider; - struct icc_node *node, *tmp; + struct icc_node *node; size_t num_nodes, i; int ret; @@ -723,10 +723,7 @@ static int msm8974_icc_probe(struct platform_device *pdev) return 0; err_del_icc: - list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) { - icc_node_del(node); - icc_node_destroy(node->id); - } + icc_nodes_remove(provider); icc_provider_del(provider); err_disable_clks: @@ -738,16 +735,10 @@ static int msm8974_icc_probe(struct platform_device *pdev) static int msm8974_icc_remove(struct platform_device *pdev) { struct msm8974_icc_provider *qp = platform_get_drvdata(pdev); - struct icc_provider *provider = &qp->provider; - struct icc_node *n, *tmp; - list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) { - icc_node_del(n); - icc_node_destroy(n->id); - } + icc_nodes_remove(&qp->provider); clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); - - return icc_provider_del(provider); + return icc_provider_del(&qp->provider); } static const struct of_device_id msm8974_noc_of_match[] = { diff --git a/drivers/interconnect/qcom/qcs404.c b/drivers/interconnect/qcom/qcs404.c index 9064f6bdaa69..d4769a5ea182 100644 --- a/drivers/interconnect/qcom/qcs404.c +++ b/drivers/interconnect/qcom/qcs404.c @@ -405,7 +405,7 @@ static int qnoc_probe(struct platform_device *pdev) struct icc_provider *provider; struct qcom_icc_node **qnodes; struct qcom_icc_provider *qp; - struct icc_node *node, *tmp; + struct icc_node *node; size_t num_nodes, i; int ret; @@ -485,10 +485,7 @@ static int qnoc_probe(struct platform_device *pdev) return 0; err: - list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) { - icc_node_del(node); - icc_node_destroy(node->id); - } + icc_nodes_remove(provider); clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); icc_provider_del(provider); @@ -498,16 +495,10 @@ static int qnoc_probe(struct platform_device *pdev) static int qnoc_remove(struct platform_device *pdev) { struct qcom_icc_provider *qp = platform_get_drvdata(pdev); - struct icc_provider *provider = &qp->provider; - struct icc_node *n, *tmp; - list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) { - icc_node_del(n); - icc_node_destroy(n->id); - } + icc_nodes_remove(&qp->provider); clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); - - return icc_provider_del(provider); + return icc_provider_del(&qp->provider); } static const struct of_device_id qcs404_noc_of_match[] = { diff --git a/drivers/interconnect/qcom/sdm845.c b/drivers/interconnect/qcom/sdm845.c index 387267ee9648..f078cf0fce56 100644 --- a/drivers/interconnect/qcom/sdm845.c +++ b/drivers/interconnect/qcom/sdm845.c @@ -855,11 +855,7 @@ static int qnoc_probe(struct platform_device *pdev) return ret; err: - list_for_each_entry(node, &provider->nodes, node_list) { - icc_node_del(node); - icc_node_destroy(node->id); - } - + icc_nodes_remove(provider); icc_provider_del(provider); return ret; } @@ -867,15 +863,9 @@ static int qnoc_probe(struct platform_device *pdev) static int qnoc_remove(struct platform_device *pdev) { struct qcom_icc_provider *qp = platform_get_drvdata(pdev); - struct icc_provider *provider = &qp->provider; - struct icc_node *n, *tmp; - - list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) { - icc_node_del(n); - icc_node_destroy(n->id); - } - return icc_provider_del(provider); + icc_nodes_remove(&qp->provider); + return icc_provider_del(&qp->provider); } static const struct of_device_id qnoc_of_match[] = {