From patchwork Thu Nov 28 13:34: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: 11266015 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 3637718B7 for ; Thu, 28 Nov 2019 13:34:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 150FF217D6 for ; Thu, 28 Nov 2019 13:34:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fKWoGZnU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726764AbfK1Nem (ORCPT ); Thu, 28 Nov 2019 08:34:42 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:50274 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbfK1Nej (ORCPT ); Thu, 28 Nov 2019 08:34:39 -0500 Received: by mail-wm1-f65.google.com with SMTP id l17so11019228wmh.0 for ; Thu, 28 Nov 2019 05:34: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=/SDaimtx4qvfQT+a77LcPCR1TXpL+CTCSqALSHB4+Rg=; b=fKWoGZnUHc0AEupO0e6BxYnAvJWsF4R3vlQfEGVemUrT1VmzmBVuRcs3pYHh1i022b gHmZKlDlHLPDLKLOFB31mC+7L1exI346izL/6cLcwo2keOu59Zw/hKq7Fx1iS2FOTJZD mrE7l2joW729IcshdEEbg8w+u5mfrT3HexEs7L86uvd6tZlm29ugtWvQDcHsUeUURYYj vsec6EgQjjsV+Rn7koKFXTjcMr42HpbtZsEwcA5vxEIBbyymZfRIf9MWFdoWveRAa2xJ y+FhU5PfevlbWXY3k+t9i7MqLgHUKy5Tn5QeNyyX0XO1UTS1j6uaZCNiWEMOzFGkdVX5 970Q== 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=/SDaimtx4qvfQT+a77LcPCR1TXpL+CTCSqALSHB4+Rg=; b=l9ZASiphZnqys3KYpp4xuFlRIoSPm9BGFrZsdOaKzJKuKvlrEN3661UBeqtteIRMy1 MzcllYqfuVw4MOMHlS7Nr1zLlw4+gb2Mg0xrr7a/AgludVgkDqA4xKeWV3nLi3mbwypC lohnFjcNz8Bxt6/VM7+G19i3tEypaeaxhYNVgPJxp6Ujq4W4fSdXPNvhO0z3zOVegB07 IPMJYEF0r/cVBgj91JYZ6wFaYODoy9gDssvkhnwL7kFFQzI2hPfsi0AqMxoF09KdQZdE UsflfWJK6nnrkpzNG60g7Kdt5yIkd0RjsCQp1QF/I60tpcB57D/H7TC1LgdRHMg757oa GWhg== X-Gm-Message-State: APjAAAWy3FWaiq/ixFZ74StJs1s7TSC9xtVQlYzRopuZ11dO7hP0F/hW tKdm79tqBS592M0/HCH6TwB9qg== X-Google-Smtp-Source: APXvYqz50wTmdDHppw64lnOGv4kBmYEywC/jd69HR/l3/KqJ/30thrOsVhsT64GKvxVlxa0p/ykg9w== X-Received: by 2002:a1c:23d5:: with SMTP id j204mr9329041wmj.0.1574948077036; Thu, 28 Nov 2019 05:34:37 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id y20sm2220451wmi.25.2019.11.28.05.34.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Nov 2019 05:34:36 -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 1/5] interconnect: qcom: sdm845: Walk the list safely on node removal Date: Thu, 28 Nov 2019 15:34:31 +0200 Message-Id: <20191128133435.25667-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 --- drivers/interconnect/qcom/sdm845.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/sdm845.c b/drivers/interconnect/qcom/sdm845.c index 502a6c22b41e..924c2d056d85 100644 --- a/drivers/interconnect/qcom/sdm845.c +++ b/drivers/interconnect/qcom/sdm845.c @@ -870,7 +870,7 @@ static int qnoc_remove(struct platform_device *pdev) struct icc_provider *provider = &qp->provider; struct icc_node *n; - list_for_each_entry(n, &provider->nodes, node_list) { + list_for_each_entry_safe(n, &provider->nodes, node_list) { icc_node_del(n); icc_node_destroy(n->id); } From patchwork Thu Nov 28 13:34: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: 11266003 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 4CD0D6C1 for ; Thu, 28 Nov 2019 13:34:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C6AA2178F for ; Thu, 28 Nov 2019 13:34:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bgiHFLu8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726742AbfK1Nem (ORCPT ); Thu, 28 Nov 2019 08:34:42 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46527 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726729AbfK1Nel (ORCPT ); Thu, 28 Nov 2019 08:34:41 -0500 Received: by mail-wr1-f67.google.com with SMTP id z7so27697571wrl.13 for ; Thu, 28 Nov 2019 05:34: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=wLwJHHdjApYdyG7yY2KSph4X2YQrPHDGykhy5Aqw6Z8=; b=bgiHFLu8ynS/16sAB+4eIkko3HK+fGyqlncWTZc32UQ3iNjt9ShZ33eLJw7yXNNcKD TP/EEVAS7wVeSxY7oq7Meo018sBlL8S2fZeeYAWV3DKJyKv3NRy2FuNhiVRWZzcCRLvc JGO/2Q/HKe+CzWp3aLxT0cCMniXHlFRYDKWJ0OeSkcsFjRS5I2O1KtkajNoGmH9qm3R1 TR931WJLk9Ffv6qBwjrGYglz21HBVz3C1x74xCDBGNDVil+KsiyOOdDdCSg9rCmnp4um SSIJ/jLdInNc1uuA+D78/rjHZkWEl3AlBo48mWHRIpxj/bYkW7V1SQuhmhBLoT0pN70M WLAg== 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=wLwJHHdjApYdyG7yY2KSph4X2YQrPHDGykhy5Aqw6Z8=; b=kILcqhS5prPmJ3kZ/mhLNa0xDTGUxeQQ/I0PFfVim8YdS44w0Od3WOlauAKB6wI4kV I/8/tLj739rezXJBsMAKncUtWT4k2MeqWM1PjNEE/OWAt8w8CM5gm8OnadW/XimuB+Z2 gVfd9tYFVYsog3GY/Rru2c6m7pGMcNQL3zP4MT+G5eV3J3JHlLmyOZf6acE5GadGW36W 1ST+gkzuFSS28PTzJ/vP5qqn19HWZ2p8X8+uDaOR8GTdZoNDlmYVdyEMHVCOFx3ifvNY uT5Zjg+SH+R5mDxe+PRrArv0tS/bUnp66cNvsdN18N5POyJLaCdoTzPpIx3RQB+v3lC3 iwHQ== X-Gm-Message-State: APjAAAWIWfZuZjbTYQE/5gXLWVpWUqAaCqHVhBkcUYnjTa4ROPP9ZrJF uI5b+gOsa4A8ydT0metTAQbbEw== X-Google-Smtp-Source: APXvYqxcKq0U6gGtpcy9xqY7Tw6Tx53nu1boMNRPw2zCymn44RKNCySHUEyNHfBn7+z+FSz6BUXB2Q== X-Received: by 2002:a5d:6181:: with SMTP id j1mr46853978wru.251.1574948078252; Thu, 28 Nov 2019 05:34:38 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id y20sm2220451wmi.25.2019.11.28.05.34.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Nov 2019 05:34: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 2/5] interconnect: qcom: qcs404: Walk the list safely on node removal Date: Thu, 28 Nov 2019 15:34:32 +0200 Message-Id: <20191128133435.25667-2-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191128133435.25667-1-georgi.djakov@linaro.org> References: <20191128133435.25667-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 --- drivers/interconnect/qcom/qcs404.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/interconnect/qcom/qcs404.c b/drivers/interconnect/qcom/qcs404.c index b4966d8f3348..d2b455021416 100644 --- a/drivers/interconnect/qcom/qcs404.c +++ b/drivers/interconnect/qcom/qcs404.c @@ -494,7 +494,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, &provider->nodes, node_list) { icc_node_del(node); icc_node_destroy(node->id); } @@ -510,7 +510,7 @@ static int qnoc_remove(struct platform_device *pdev) struct icc_provider *provider = &qp->provider; struct icc_node *n; - list_for_each_entry(n, &provider->nodes, node_list) { + list_for_each_entry_safe(n, &provider->nodes, node_list) { icc_node_del(n); icc_node_destroy(n->id); } From patchwork Thu Nov 28 13:34: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: 11266021 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 CA01114B7 for ; Thu, 28 Nov 2019 13:34:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A93202178F for ; Thu, 28 Nov 2019 13:34:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="m4dlAYMM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726754AbfK1Nem (ORCPT ); Thu, 28 Nov 2019 08:34:42 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34048 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726726AbfK1Nel (ORCPT ); Thu, 28 Nov 2019 08:34:41 -0500 Received: by mail-wr1-f65.google.com with SMTP id t2so31112723wrr.1 for ; Thu, 28 Nov 2019 05:34:40 -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=V0r1Vz9ksKDupLD9OJqzUcDOf67hQCL9kz7e13IH3GE=; b=m4dlAYMM/PIeKCsaJqVlO08YbmIhD6RhsLm7nOtLkOytXmO3qq1q/NJvnv0LeaLeXq oOxVm1tA7z9hL1eDdcBG3ZUiO1MH5iA1h4sF3xpAlE1lKk6ohD8GACAbkL7U1OghSHi+ tmZI95GQrE0w++WAg0zQJylT9wyydK5AgU2j0e1JsJ11SuNdMrOSjevlP/Ik/E+liFev RBrkrVi/nH5XUspOIPSa7aKqMRRDTzxZY7KpqXEQXr2a5qAohXFKbjJ78CV33+TMQcxj UIzA9mthlQkhSlOU/7B04DggmQ2Ez87farNVp7idFzMk/LaeYnLpnkvgL4+KwERgHQjJ O16A== 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=V0r1Vz9ksKDupLD9OJqzUcDOf67hQCL9kz7e13IH3GE=; b=A46WZk2l3QtfOFM9pW3SaUuiwVQCUwR/5ukyi0qr9C00+dKfl5BJ3X9/gHHe6NTXb9 DpyohsXylj2o+fSPEufN1KNh+btkbPP+5iNu9Jow5WgPv0bdwQ8CO8RpNWcO+/uegwkb ca5OgHQ6+Ng4zwJRrBZt8sQlZ85x5DvawbbI8E8QhJZOYdK3qfMzG4qczQ1cEzpjZCX6 0EXfF/xNfVgqPNL19YNbuECd1DHYnH0N0uR6oYau0vtjzZ/0myZZjfWy1TlKTVrsvW/b 8d0FK+1s/JkVVv0htMWzscinn1xR6UlnYKLpetKN6X5FATeoM0GLKn/01PMqCGVJQOp/ xavg== X-Gm-Message-State: APjAAAW4d/T05ImCHxXgy+IC9hD3aVUEKYtTJ9hqmp1OUK3ejgqwxiwN Nc3ztmi4Fx5vNvpAV4aAN5Mitg== X-Google-Smtp-Source: APXvYqy1rwDcBh0cI1GWX7oMKqVb5qJCvtu5a2XAY1XhhuLyV/p3LIlUO78MiO0KUCQBqiPRluL1bg== X-Received: by 2002:adf:f303:: with SMTP id i3mr46618947wro.157.1574948079524; Thu, 28 Nov 2019 05:34:39 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id y20sm2220451wmi.25.2019.11.28.05.34.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Nov 2019 05:34: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 3/5] interconnect: qcom: msm8974: Walk the list safely on node removal Date: Thu, 28 Nov 2019 15:34:33 +0200 Message-Id: <20191128133435.25667-3-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191128133435.25667-1-georgi.djakov@linaro.org> References: <20191128133435.25667-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: Brian Masney --- drivers/interconnect/qcom/msm8974.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/interconnect/qcom/msm8974.c b/drivers/interconnect/qcom/msm8974.c index ce599a0c83d9..0a1a8ba6afa7 100644 --- a/drivers/interconnect/qcom/msm8974.c +++ b/drivers/interconnect/qcom/msm8974.c @@ -732,7 +732,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, &provider->nodes, node_list) { icc_node_del(node); icc_node_destroy(node->id); } @@ -750,7 +750,7 @@ static int msm8974_icc_remove(struct platform_device *pdev) struct icc_provider *provider = &qp->provider; struct icc_node *n; - list_for_each_entry(n, &provider->nodes, node_list) { + list_for_each_entry_safe(n, &provider->nodes, node_list) { icc_node_del(n); icc_node_destroy(n->id); } From patchwork Thu Nov 28 13:34:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 11266013 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 C81726C1 for ; Thu, 28 Nov 2019 13:34:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6583217D6 for ; Thu, 28 Nov 2019 13:34:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="EZxEFdIx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726608AbfK1New (ORCPT ); Thu, 28 Nov 2019 08:34:52 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:32874 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726730AbfK1Nem (ORCPT ); Thu, 28 Nov 2019 08:34:42 -0500 Received: by mail-wm1-f65.google.com with SMTP id y23so2891486wma.0 for ; Thu, 28 Nov 2019 05:34: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=efZXdx8nOE9IRhU/0a0pMggKVJBaJwNsJBonEmaYwBU=; b=EZxEFdIxvM62pDLBLLIcES0NSWNTez/Q9a9uibJWaZ3fpi98XzuotDpSxZ2Ni1JC9p Osoa0ZmcJGtW9bz8oF3eTtEsDo3cWTXVM65Pp+UxtNwwW/y52U4MLg2PKQw5nuuUbnCY 91v0xn/r7zmwsm6zVneHY20HFX4ZKRbf/rQF5T+iApX/Lpvy+1QMXKY4NzURC4HoE1RC W+wSvMNPr1zRBZNs0t8/cHMoGyUJ7m/GSgeH5bbtafyMcJv2cbBtFg7xmon8QOYBmfON KUy5wwJQus2MYRSx/tvqiaPK3DvKPq/Vp3LDRY165O62TU/Dr2TbMLo/0b0nY4Luc7Rx frtA== 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=efZXdx8nOE9IRhU/0a0pMggKVJBaJwNsJBonEmaYwBU=; b=M6w9Bb8fzpmDFyvUgFN6Gl0WDfhWrND6SL88lcwf39nvnJKZCQZRR8xHCH4vMyI4fz X9VyDP3izKiybRxkE85kFTc1DkWT08e0PP2gezuiFF2os5OqHh6ddQFBihGVxSHO3pLi BJX28xw+Euxy0NZUFelK4MXAOB5ZrfqUm/DoehiQruBXgw+vgaUlkk3/ol2/wudpRE0c 8d/at7bDm+Z4i3fpo2qg/cwbHv+OyF/mDezNHQd7ZuJPC02oQs9AVzBW+B/f8xWsQszj qZQEg7SeS+xePVjWEdHf+rXzdZvOGd6mGaTSrliKvS3ajNSlvXZ5wkBF5NaQtkUNNYB9 xxzw== X-Gm-Message-State: APjAAAUrFqHCjKRaR5VnF9ucIZ2mC+rjKikmOJiWH+Y41+HWiktwduS6 a8ShW7t3NFuZlOakJ/L1NQMCHA== X-Google-Smtp-Source: APXvYqwwb/ogD8FJGE0VinCuLLQUf1L1Nd1+voYXxUCs8+wa9MLOJK5JYZXlbgdV0e2MpXbmUoEpxA== X-Received: by 2002:a7b:cd82:: with SMTP id y2mr8272892wmj.58.1574948080885; Thu, 28 Nov 2019 05:34:40 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id y20sm2220451wmi.25.2019.11.28.05.34.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Nov 2019 05:34:40 -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 4/5] interconnect: Add a common helper for removing all nodes Date: Thu, 28 Nov 2019 15:34:34 +0200 Message-Id: <20191128133435.25667-4-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191128133435.25667-1-georgi.djakov@linaro.org> References: <20191128133435.25667-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 Signed-off-by: Georgi Djakov Reviewed-by: Bjorn Andersson --- 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 467c539310f3..0e4852feb395 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -735,6 +735,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 b16f9effa555..31440c921216 100644 --- a/include/linux/interconnect-provider.h +++ b/include/linux/interconnect-provider.h @@ -98,6 +98,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); @@ -130,6 +131,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 Thu Nov 28 13:34:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 11266007 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 0AF8E6C1 for ; Thu, 28 Nov 2019 13:34:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D54DC21781 for ; Thu, 28 Nov 2019 13:34:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="w7KZ1TIq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726703AbfK1Neq (ORCPT ); Thu, 28 Nov 2019 08:34:46 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39350 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726616AbfK1Neq (ORCPT ); Thu, 28 Nov 2019 08:34:46 -0500 Received: by mail-wm1-f65.google.com with SMTP id s14so4898651wmh.4 for ; Thu, 28 Nov 2019 05:34: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=8VrphYeqahrQ5kATlO0grU5q+TZ5g96u9ghQO6Q2fFc=; b=w7KZ1TIqRorqFk6V1hPTFmPCV+1JsZnF6guXwmyWEmd2W7y9YMCY2uwvxnvykWSA6f OsOSqJsju0xA5ElMwpLTwVTRv+KgcOwVqfZccUsaSaxCRkyLOSj0qvii+PazYdpeCffQ IC4Xunj4UuQIFPzmkkZANHwXqAB64nMhMa+ixovKeNQUyJtjA9TjeYonMCz20PF1aonP A33R5BIWPqXSNyxyGTgTP0WYofOi2L1YNjBeTEXqgCAJH7ZCXxOuZP13AGhJLI9pqIqn ZeNR8Op/b22RzqQAWtf4p1HVMSovwHjxeyFFkV0+fLXM6lwm21OXN5OetG6ysGEnCuc/ o80A== 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=8VrphYeqahrQ5kATlO0grU5q+TZ5g96u9ghQO6Q2fFc=; b=dCYx0/JBpqNVjSF13Ph32hxHuVNZ44udTTm+x+EAmF2wVZqoEXTg7JQsLroOT8TxBX bN0btUlGjPCxKbYeuT/MpVRHGgQRx4PQE/7HaeUIoFCwuMUX7kujRulBK51gEM20cICe hcDPq+0Z7kBebbkhji+RQvdO1diMd6YLuqNHZQt6qYTwDJpjKakJfv5jb+jyMkTAtHrG FMd4EazjCPLCGCLCksE7isxFa34AziInv0ZwJbVVwi0Zy76RK8YKb1NqvwLK7NmyX0GA cJbzcTHusddmtl6G0Si4q0x7f6FXamewDqdl+uO4BtOGaJhFCPYkxkr1NZ0ABGjmQ2zl 7/aQ== X-Gm-Message-State: APjAAAUmS+2ufqyUycODv4ztyQAd1k5bcvMsty+JFlG7lvlMWuGwgk4R EOc0D0F8T6SuIjI/x9elOckrkZd17fY= X-Google-Smtp-Source: APXvYqyDndcOfTmJ55lnby2VAYUUKyUwBpprxa7XtgXE/tKbSY5omtNvM2XPx2ePvPyTj7Mg+KyTJQ== X-Received: by 2002:a1c:1b88:: with SMTP id b130mr8979340wmb.4.1574948082044; Thu, 28 Nov 2019 05:34:42 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id y20sm2220451wmi.25.2019.11.28.05.34.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Nov 2019 05:34: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 5/5] interconnect: qcom: Use the new common helper for node removal Date: Thu, 28 Nov 2019 15:34:35 +0200 Message-Id: <20191128133435.25667-5-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191128133435.25667-1-georgi.djakov@linaro.org> References: <20191128133435.25667-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. In addition to the above, instead of duplicating the code, simplify the probe function error path by calling driver removal function directly. Signed-off-by: Georgi Djakov --- drivers/interconnect/qcom/msm8974.c | 40 ++++++++++------------------- drivers/interconnect/qcom/qcs404.c | 31 ++++++++-------------- drivers/interconnect/qcom/sdm845.c | 29 +++++++-------------- 3 files changed, 33 insertions(+), 67 deletions(-) diff --git a/drivers/interconnect/qcom/msm8974.c b/drivers/interconnect/qcom/msm8974.c index 0a1a8ba6afa7..8823dce811c3 100644 --- a/drivers/interconnect/qcom/msm8974.c +++ b/drivers/interconnect/qcom/msm8974.c @@ -644,6 +644,15 @@ static int msm8974_icc_set(struct icc_node *src, struct icc_node *dst) return 0; } +static int msm8974_icc_remove(struct platform_device *pdev) +{ + struct msm8974_icc_provider *qp = platform_get_drvdata(pdev); + + icc_nodes_remove(&qp->provider); + clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); + return icc_provider_del(&qp->provider); +} + static int msm8974_icc_probe(struct platform_device *pdev) { const struct msm8974_icc_desc *desc; @@ -701,7 +710,8 @@ static int msm8974_icc_probe(struct platform_device *pdev) ret = icc_provider_add(provider); if (ret) { dev_err(dev, "error adding interconnect provider: %d\n", ret); - goto err_disable_clks; + clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); + return ret; } for (i = 0; i < num_nodes; i++) { @@ -710,7 +720,7 @@ static int msm8974_icc_probe(struct platform_device *pdev) node = icc_node_create(qnodes[i]->id); if (IS_ERR(node)) { ret = PTR_ERR(node); - goto err_del_icc; + goto err; } node->name = qnodes[i]->name; @@ -731,34 +741,12 @@ static int msm8974_icc_probe(struct platform_device *pdev) return 0; -err_del_icc: - list_for_each_entry_safe(node, &provider->nodes, node_list) { - icc_node_del(node); - icc_node_destroy(node->id); - } - icc_provider_del(provider); - -err_disable_clks: - clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); +err: + msm8974_icc_remove(pdev); return ret; } -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; - - list_for_each_entry_safe(n, &provider->nodes, node_list) { - icc_node_del(n); - icc_node_destroy(n->id); - } - clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); - - return icc_provider_del(provider); -} - static const struct of_device_id msm8974_noc_of_match[] = { { .compatible = "qcom,msm8974-bimc", .data = &msm8974_bimc}, { .compatible = "qcom,msm8974-cnoc", .data = &msm8974_cnoc}, diff --git a/drivers/interconnect/qcom/qcs404.c b/drivers/interconnect/qcom/qcs404.c index d2b455021416..a4c6ba715f61 100644 --- a/drivers/interconnect/qcom/qcs404.c +++ b/drivers/interconnect/qcom/qcs404.c @@ -406,6 +406,15 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) return 0; } +static int qnoc_remove(struct platform_device *pdev) +{ + struct qcom_icc_provider *qp = platform_get_drvdata(pdev); + + clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); + icc_nodes_remove(&qp->provider); + return icc_provider_del(&qp->provider); +} + static int qnoc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -494,31 +503,11 @@ static int qnoc_probe(struct platform_device *pdev) return 0; err: - list_for_each_entry_safe(node, &provider->nodes, node_list) { - icc_node_del(node); - icc_node_destroy(node->id); - } - clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); - icc_provider_del(provider); + qnoc_remove(pdev); return ret; } -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; - - list_for_each_entry_safe(n, &provider->nodes, node_list) { - icc_node_del(n); - icc_node_destroy(n->id); - } - clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); - - return icc_provider_del(provider); -} - static const struct of_device_id qcs404_noc_of_match[] = { { .compatible = "qcom,qcs404-bimc", .data = &qcs404_bimc }, { .compatible = "qcom,qcs404-pcnoc", .data = &qcs404_pcnoc }, diff --git a/drivers/interconnect/qcom/sdm845.c b/drivers/interconnect/qcom/sdm845.c index 924c2d056d85..2b8f13e78471 100644 --- a/drivers/interconnect/qcom/sdm845.c +++ b/drivers/interconnect/qcom/sdm845.c @@ -768,6 +768,14 @@ static int cmp_vcd(const void *_l, const void *_r) return 1; } +static int qnoc_remove(struct platform_device *pdev) +{ + struct qcom_icc_provider *qp = platform_get_drvdata(pdev); + + icc_nodes_remove(&qp->provider); + return icc_provider_del(&qp->provider); +} + static int qnoc_probe(struct platform_device *pdev) { const struct qcom_icc_desc *desc; @@ -855,29 +863,10 @@ 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_provider_del(provider); + qnoc_remove(pdev); return ret; } -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; - - list_for_each_entry_safe(n, &provider->nodes, node_list) { - icc_node_del(n); - icc_node_destroy(n->id); - } - - return icc_provider_del(provider); -} - static const struct of_device_id qnoc_of_match[] = { { .compatible = "qcom,sdm845-rsc-hlos", .data = &sdm845_rsc_hlos }, { },