From patchwork Mon Dec 2 16:21:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 11269363 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A49E1593 for ; Mon, 2 Dec 2019 16:21:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECA3D2146E for ; Mon, 2 Dec 2019 16:21:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BE1Rz6vN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727418AbfLBQVj (ORCPT ); Mon, 2 Dec 2019 11:21:39 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34764 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727608AbfLBQVj (ORCPT ); Mon, 2 Dec 2019 11:21:39 -0500 Received: by mail-wr1-f67.google.com with SMTP id t2so45024587wrr.1 for ; Mon, 02 Dec 2019 08:21:37 -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:mime-version :content-transfer-encoding; bh=i3hce8rncscuvP/l1ZHZTtieB5MS4JyYpc/T2PE+Kxk=; b=BE1Rz6vNXRg7sd9D4JsqoBEe+a6i+xNVBv+xt5suxCeM/F5EH1GxIAP5zZ8GnNiX8e SDyYr7SH0N/I5WLB8b3Z0n7DI7l62lJN3psAJGsLawlizXLVRQjLEYAVuI/uA/eGwosu 4Y+oO0D1Ymr8GhkMET7OvboWgv9L7A+MWQEgSKOTv9OLFNNBX1DlgunxhAowoP1gbAhO OIQ9RJ+oaW67J5IzFVih/bd/+X8h2yJx/5lQFKxzOC4OVLi8NomZj03ZFGq9ob8p82Rt D8aa46nTbH5GZszd7+KPwWdSSS3jgclFK55df+IYNRP3jzdd8HAz7vfUGHRh7Ag/2wb0 wFXg== 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:mime-version :content-transfer-encoding; bh=i3hce8rncscuvP/l1ZHZTtieB5MS4JyYpc/T2PE+Kxk=; b=L/R5krY3dSZfkbfMZzsszTOk46CPy/eqmWVhoP04OQnnHrahAe552kk9pSAs+ePv0W T5KBvDYiBJTlIdErHfXp6gV6T0sHszPBXciMc4K2ZcdHWmi+LXS5rT98MF0FrkSGOnGJ 15W9TFS2qO1ko4Yxsfz2xNiZ0ODvB8F0ugdzW4L1hr9QRMWt6d944XiGyZltx+722HKd fzG+IKeiV+uYpCb+P/I2yrZx+dLyIzd7HSwxJCtGM/Bcnw7ZCSdgwjElkYgCRkRcJsbc mj8OGE93LZQzNNddWdkcUgQF0xnae5BPX19x+132i9bxx9T/0hEyf7WcaBT3RMcDMoJA V+7w== X-Gm-Message-State: APjAAAXSTyTvTpx39Dm0Z173gZc89GSh3MhmP8xRrT7e7IVyquRI1o7w RJYUCqpiiEVIJaXSOVXaxSJj0w== X-Google-Smtp-Source: APXvYqwca+igLoFKmAl2TQAB5hPhndZpQ1iKhmD5Qq2qjfwBwaXa2POHL77PR9uX+Zd/EezhjWLc5Q== X-Received: by 2002:adf:b19a:: with SMTP id q26mr25103318wra.79.1575303696450; Mon, 02 Dec 2019 08:21:36 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id i9sm39204516wrb.2.2019.12.02.08.21.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Dec 2019 08:21:35 -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 1/5] interconnect: qcom: sdm845: Walk the list safely on node removal Date: Mon, 2 Dec 2019 18:21:29 +0200 Message-Id: <20191202162133.7089-1-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org As we will remove items off the list using list_del(), we need to use the safe version of list_for_each_entry(). Fixes: b5d2f741077a ("interconnect: qcom: Add sdm845 interconnect provider driver") Reported-by: Dmitry Osipenko Signed-off-by: Georgi Djakov Reviewed-by: Bjorn Andersson --- v2: - Fix the number of parameters that got messed up. (Bjorn) drivers/interconnect/qcom/sdm845.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/interconnect/qcom/sdm845.c b/drivers/interconnect/qcom/sdm845.c index 502a6c22b41e..387267ee9648 100644 --- a/drivers/interconnect/qcom/sdm845.c +++ b/drivers/interconnect/qcom/sdm845.c @@ -868,9 +868,9 @@ 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; + struct icc_node *n, *tmp; - list_for_each_entry(n, &provider->nodes, node_list) { + list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) { icc_node_del(n); icc_node_destroy(n->id); } From patchwork Mon Dec 2 16:21:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 11269379 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F02D2930 for ; Mon, 2 Dec 2019 16:21:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE03D2073C for ; Mon, 2 Dec 2019 16:21:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AP6DiGL/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727635AbfLBQV6 (ORCPT ); Mon, 2 Dec 2019 11:21:58 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41714 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727617AbfLBQVj (ORCPT ); Mon, 2 Dec 2019 11:21:39 -0500 Received: by mail-wr1-f67.google.com with SMTP id b18so45062174wrj.8 for ; Mon, 02 Dec 2019 08:21:38 -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=RcVG/qj8yyYNSIPEYKFW4bW3tWMavwQ5W53FJik00WM=; b=AP6DiGL/aQDTxsAfZ1x0QW+Tv8Bg7T5RqQnXQmNd2D7OmhJ/YbRW1pmAjuDOkM2Y2F 0xGdykT8B6nyEKr9akZYeTPLwCSAridNAkPznb19AHx3u9eVgUQpuDRnw5U2avBiQfG/ PnsAwETCY+nidrFK0fkulfX1bd87h+6Gsw8LOAoJjGAarWiauj0mDJq/n7ub4OV/lUPh /Ud4d9x5Siix/pN7AZQHNsAWTmwUmH0JHHp3tnAEOtg4ZeeLd+OpAB3eKgZLLRWtGIh9 KiCfqvewrsnuUXm/K+lkeJe6tEL/9+PU77gfs6Nxmtsi0y97vQHDhZPYnH4kMNgKSYiL 48KQ== 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=RcVG/qj8yyYNSIPEYKFW4bW3tWMavwQ5W53FJik00WM=; b=YnBRxSi4wObXFOp7BkRS4zvHk13AWJvbXTCJeMvz6ng3IrGuIoYNy04M5HSm74MYRl 2koo3N1SvQ/fR+spv5p4suwI0/ebkziQSrTJsOuavubIlqsAO3bmaz+H+A39QZuW6nsQ WIXuJcHPD8G34QVyR5qZMPCD/nJm2zBweJVo4tfWQzP0qIcEGHiTgPJaTVsT6Mmf3gVE MAO4+ZYqczNV8oeF7UC2gMMmWOOoDAkBSCrRSq+JMED8AoJ2yjDxWwesouy25n3fh6LV igEM1ih1/JVOGdIyjtrxtg/ld6kinUhbtMOjWJ5l059EgLqU2T9Q1wg3TPFn64uTNEZj CeXA== X-Gm-Message-State: APjAAAUsxA95XF+Yw7SqhBJktYKKOTLmhYlBDXITxf9ungN5U2C6VoK1 TASZp6bJud7GamTkYppGFGqvAQ== X-Google-Smtp-Source: APXvYqzf7GMDnP1dmGoh6t8wKOB1vcicGtxIHotMg3u8fNgCyOCxS5AqgiMbo72c0hzwkLeTx1NJ+w== X-Received: by 2002:adf:a746:: with SMTP id e6mr15118778wrd.329.1575303697776; Mon, 02 Dec 2019 08:21:37 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id i9sm39204516wrb.2.2019.12.02.08.21.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Dec 2019 08:21:37 -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 2/5] interconnect: qcom: qcs404: Walk the list safely on node removal Date: Mon, 2 Dec 2019 18:21:30 +0200 Message-Id: <20191202162133.7089-2-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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org As we will remove items off the list using list_del(), we need to use the safe version of list_for_each_entry(). Fixes: 5e4e6c4d3ae0 ("interconnect: qcom: Add QCS404 interconnect provider driver") Reported-by: Dmitry Osipenko Signed-off-by: Georgi Djakov Reviewed-by: Bjorn Andersson --- drivers/interconnect/qcom/qcs404.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/interconnect/qcom/qcs404.c b/drivers/interconnect/qcom/qcs404.c index 5e5843e6bd06..9064f6bdaa69 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; + struct icc_node *node, *tmp; size_t num_nodes, i; int ret; @@ -485,7 +485,7 @@ static int qnoc_probe(struct platform_device *pdev) return 0; err: - list_for_each_entry(node, &provider->nodes, node_list) { + list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) { icc_node_del(node); icc_node_destroy(node->id); } @@ -499,9 +499,9 @@ 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; + struct icc_node *n, *tmp; - list_for_each_entry(n, &provider->nodes, node_list) { + list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) { icc_node_del(n); icc_node_destroy(n->id); } From patchwork Mon Dec 2 16:21:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 11269375 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63E6A1593 for ; Mon, 2 Dec 2019 16:21:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42B212146E for ; Mon, 2 Dec 2019 16:21:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bIM2E4qQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727706AbfLBQVy (ORCPT ); Mon, 2 Dec 2019 11:21:54 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41716 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727608AbfLBQVl (ORCPT ); Mon, 2 Dec 2019 11:21:41 -0500 Received: by mail-wr1-f65.google.com with SMTP id b18so45062267wrj.8 for ; Mon, 02 Dec 2019 08:21:39 -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=oMBJAp4LSOF18EKZsarCjIvV97iU3KlOms/xsyIv3iQ=; b=bIM2E4qQ6P+LyYmjxXTsCE4nf2gqeqyCpaqijLgjBd5rSLfDIbh7mwl3XW1bBKIca+ 5R4fnwcgNEiKGlQH7I2Gf+t3VDeCoW/eVANZOH5MtgbkCaU8YMQPy8TXK/gsviJ3PPpA K64lZKCfBUpvGCWnpeq0d3CnYV1mDd7D8qD37vhIwuY5LgxWRTtR60smA6p5EFYhRrZb 9mUmPaUs37tYNSOMScuGD7eojrFiwusAvQDYFvbkuS72kXfk5qgVd7kdH/3RVzsoU17L Q19VvRjKxnuiwFpBuiIwN8moJtDbTil9Z7YpRp71rpqTGuVLWgxdxQLnM5burmTv7dYy 20Kg== 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=oMBJAp4LSOF18EKZsarCjIvV97iU3KlOms/xsyIv3iQ=; b=sRXQLjZW4WL3Rzol0SL+TBYp8le0YICqMJie41yJxSoqe9c6tXcsGuIlwzJTcYMbm+ JCWr8AcbY8esWIf6vnFrpjsxH2gMKtaGATTXgAUysFoNiVtV3qXC+jy9ST4kqvfBA9az G+x2D6RfVn4cf2TpG0ndF74DzPLtnNsxlBxhMxBZkrKNyLFv9WNLft6KpmeHli/HhK8S P1N1yxC6jhf4WIEssGHv7nj7ieQPf92voxEiRYNkor7U7pqd6UXgVlXD+4DQdMzGq4SY GVt6VbWit5TP6/dDvl35Kws7XAb69itkvOEC8clz0fnkqKN+HNHUda+t/Xzt1JeIZA86 KasA== X-Gm-Message-State: APjAAAW3gJ2iUblXpg/UKEYnNx1bcEVRNb2LVQq6z3bF03f7VvGN7zml YjiJpj3v/t3lFOJmDP7xvVqG8w== X-Google-Smtp-Source: APXvYqx39MnObvyWdT1npt9UtcGiQgJph3139C2GJsoL7voal1lBRwS03vjO0tJ6oRSzK8TYFGeAHg== X-Received: by 2002:a5d:4983:: with SMTP id r3mr54752462wrq.134.1575303699158; Mon, 02 Dec 2019 08:21:39 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id i9sm39204516wrb.2.2019.12.02.08.21.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Dec 2019 08:21:38 -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 3/5] interconnect: qcom: msm8974: Walk the list safely on node removal Date: Mon, 2 Dec 2019 18:21:31 +0200 Message-Id: <20191202162133.7089-3-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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org As we will remove items off the list using list_del(), we need to use the safe version of list_for_each_entry(). Fixes: 4e60a9568dc6 ("interconnect: qcom: add msm8974 driver") Reported-by: Dmitry Osipenko Signed-off-by: Georgi Djakov Reviewed-by: Bjorn Andersson --- drivers/interconnect/qcom/msm8974.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/interconnect/qcom/msm8974.c b/drivers/interconnect/qcom/msm8974.c index f29974ea9671..ca25f31e5f0b 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; + struct icc_node *node, *tmp; size_t num_nodes, i; int ret; @@ -723,7 +723,7 @@ static int msm8974_icc_probe(struct platform_device *pdev) return 0; err_del_icc: - list_for_each_entry(node, &provider->nodes, node_list) { + list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) { icc_node_del(node); icc_node_destroy(node->id); } @@ -739,9 +739,9 @@ 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; + struct icc_node *n, *tmp; - list_for_each_entry(n, &provider->nodes, node_list) { + list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) { icc_node_del(n); icc_node_destroy(n->id); } From patchwork Mon Dec 2 16:21:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 11269371 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9CC9930 for ; Mon, 2 Dec 2019 16:21:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C903B2146E for ; Mon, 2 Dec 2019 16:21:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PZM1GdGn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727669AbfLBQVw (ORCPT ); Mon, 2 Dec 2019 11:21:52 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33570 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727665AbfLBQVm (ORCPT ); Mon, 2 Dec 2019 11:21:42 -0500 Received: by mail-wr1-f67.google.com with SMTP id b6so15435368wrq.0 for ; Mon, 02 Dec 2019 08:21:41 -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=2/SckE1LuT5fuB6gss91UGfXQhSyW3IG3sRJlwZdSOU=; b=PZM1GdGn1/lJzFG0LD8rQni//3m1CWgT7LLmGrYxuS/5/QeSaDoIaSQjYpklGZKqB2 4cScoPDEGJ5ZfZzy6zWXDd24NvW4N9lYnA1aWs2YcOBwqcIR7fCxU+pEhWNUQkJeJ8SH vUMYNenjhtW6fQk/+MPzR7K8du0wQfZM5EtI+AMRJRui1Yzow8b6vCR4XR8c/5Z9AckG bxBATOzvVxQwXm6kN3BRCWp7/JvS8vVtyKt6cK/X08si8eZPsboW+LDN6zryizMlz2I7 tg8Z+BNQR6eP9vFLaIkX7PH03CHNFOLyXUnvl5ZHms5haEdE+bYON0NIRuUP7tjJi0MV V0Qg== 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=2/SckE1LuT5fuB6gss91UGfXQhSyW3IG3sRJlwZdSOU=; b=RsQ3sTu1JPOQD/bfZwyZgoedCIzp2xWF7M8SCvE6gxjKHRCnZfiZ6Lwoav/lZiSSzK LmrcbLcLXK/A835UdF6YTD+5Yhl09VQP+zbtQ16x6pbtooYPPb3xjvcExKbWPDRF0kfe yza1ST2cM+iq1GJIP+O6jxzKY2ptR0Nfn3SRPQ051uGVQgq2JVsygR01f2MX5r3/3wo7 LknI/ZzycmnDkM2X8sjWkm4L79G42ZWGHDHj3nbCW5XFaUYe/jEZNrlfSQbRyzRj9EMI iYmESA932J4gjolg0AJCNNyFRqQpvf+H5PGj9Uf/ENgZ6+EjHUu8zlHQvAvRZkMnzd+k HSqw== X-Gm-Message-State: APjAAAX+eJ6oVA0esU+PVVDT+MyxPMAxPWF7lOZacWJbKzQgv5ZhQwQk BjmXqFc0qxvOk1x66wk7lyDL4A== X-Google-Smtp-Source: APXvYqy3xNpF3ciZicnpb/URmHtBw2s4159FTTCD7YGG1YzSJr97Sd0KRl//oaQ50TNWjJBjWYNbTw== X-Received: by 2002:a5d:6305:: with SMTP id i5mr8541802wru.119.1575303700457; Mon, 02 Dec 2019 08:21:40 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id i9sm39204516wrb.2.2019.12.02.08.21.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Dec 2019 08:21:39 -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 4/5] interconnect: Add a common helper for removing all nodes Date: Mon, 2 Dec 2019 18:21:32 +0200 Message-Id: <20191202162133.7089-4-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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The removal of all nodes from a provider seem to be a common functionality for all existing users and it would make sense to factor out this into a a common helper function. Suggested-by: Dmitry Osipenko Reviewed-by: Bjorn Andersson Signed-off-by: Georgi Djakov --- drivers/interconnect/core.c | 22 ++++++++++++++++++++++ include/linux/interconnect-provider.h | 6 ++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 8605c3e05b5e..2633fd223875 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -745,6 +745,28 @@ void icc_node_del(struct icc_node *node) } EXPORT_SYMBOL_GPL(icc_node_del); +/** + * icc_nodes_remove() - remove all previously added nodes from provider + * @provider: the interconnect provider we are removing nodes from + * + * Return: 0 on success, or an error code otherwise + */ +int icc_nodes_remove(struct icc_provider *provider) +{ + struct icc_node *n, *tmp; + + if (WARN_ON(IS_ERR_OR_NULL(provider))) + return -EINVAL; + + list_for_each_entry_safe_reverse(n, tmp, &provider->nodes, node_list) { + icc_node_del(n); + icc_node_destroy(n->id); + } + + return 0; +} +EXPORT_SYMBOL_GPL(icc_nodes_remove); + /** * icc_provider_add() - add a new interconnect provider * @provider: the interconnect provider that will be added into topology diff --git a/include/linux/interconnect-provider.h b/include/linux/interconnect-provider.h index 61dfb0beb409..0c494534b4d3 100644 --- a/include/linux/interconnect-provider.h +++ b/include/linux/interconnect-provider.h @@ -100,6 +100,7 @@ int icc_link_create(struct icc_node *node, const int dst_id); int icc_link_destroy(struct icc_node *src, struct icc_node *dst); void icc_node_add(struct icc_node *node, struct icc_provider *provider); void icc_node_del(struct icc_node *node); +int icc_nodes_remove(struct icc_provider *provider); int icc_provider_add(struct icc_provider *provider); int icc_provider_del(struct icc_provider *provider); @@ -138,6 +139,11 @@ void icc_node_del(struct icc_node *node) { } +static inline int icc_nodes_remove(struct icc_provider *provider) +{ + return -ENOTSUPP; +} + static inline int icc_provider_add(struct icc_provider *provider) { return -ENOTSUPP; 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: 11269367 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA1F7159A for ; Mon, 2 Dec 2019 16:21:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A365620748 for ; Mon, 2 Dec 2019 16:21:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wwtDicZu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727690AbfLBQVq (ORCPT ); Mon, 2 Dec 2019 11:21:46 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38424 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727677AbfLBQVo (ORCPT ); Mon, 2 Dec 2019 11:21:44 -0500 Received: by mail-wr1-f65.google.com with SMTP id y17so6419756wrh.5 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=bvSVdNhTzw8EHFZ4W/igt1UWVJ7QoDmxJ4R4VvmRUqOFuPqgND196VJ11ti9urxC0T cz8TBcRXgNxEkzcExW8Xy7C+p2BeFMxwmCut53E3dDwUJcmKjcuNoq5g+gtibVTPVUU8 tOOi20S+f9/50yvXRPQ6VeAfR3x9h3kcZfy6ptV+QBqJCJiYCejry5C8BRvu8jqwXajo uopH2m1MbysLRFAx7d4bseki92YZaddwUc2my83yK3jPPeo8EmtLAZj00IQe3BxnWKgh 3hRi6MxN75Ky4NpLZqGw3vN2OryKRuZPYj8wSLaEnEuwcgvoZvW0+T1W0l8lnnnFy+LH UvpQ== X-Gm-Message-State: APjAAAWGYgs3i6N3oXGGkBQphXBQUCGeZgVtdhsuBHklPkN9iV6p53U9 Sy8l1YNiBwA9SpFTLQu3ttmgBA== X-Google-Smtp-Source: APXvYqxQ41lsZfDRrcuKTvuCttSqE810g1FSOk7cNXrgWNOJ3ZSaBSAP/qUrkDe+9tsAVhFD4Yasug== 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 Reviewed-by: Bjorn Andersson --- 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(-) 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[] = {