Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6793517ybc; Thu, 28 Nov 2019 05:38:07 -0800 (PST) X-Google-Smtp-Source: APXvYqz110eOmlOtddOSFSN2Y0ixqdn238Carb6d2jwMPcgDi3UBnvz/wY9GnA5K+nRk5R/agJqs X-Received: by 2002:a05:6402:305b:: with SMTP id bu27mr38898759edb.191.1574948287171; Thu, 28 Nov 2019 05:38:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574948287; cv=none; d=google.com; s=arc-20160816; b=fcyxnDzd07w1/1ut+YeX37oRDtAKnzqXcR3dMHL+RjQ0ryLTyTVMRg/7NaQUwvftyu X11oz5dlh3t8/HKvcguOxe033wGXNMc20tcuF9ATTgYFgGGziYY9lOXUVNF9F6LKlX7h uyAgn2FbAJtV4gQhNRGgjdulAS59cUV02VaHnnBUyw0zL1YNrQm8ZcnXc6sYfw3C2scx vCZyzGFyGvvEQeRZg0sSlrVUZCyXoHof2E3A/1I+vnQ9dfUfThL3pzlDrLHYRqPOqf1C 5G2pkzYBD1eEyhCpSe1BmEFjooEwXqxxaLFey6ZgMEwV4ssMlwjO4rrPF9JikJ2b8fsV C4Kg== 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=efZXdx8nOE9IRhU/0a0pMggKVJBaJwNsJBonEmaYwBU=; b=NOfWclus86zKNer5/kBajEyW9eNZhhJXKv6NySXX8JF53ZhCWBrY6h/Yvj2hU/D4dM 6e3WIY9g3YeAa0aL6n37yIi0Bq1pzGS/Et4faQVNAE49CvSbFlYX0q1EbhktlMaO4vmm 08cPlJUgVRwTun8x0vdplrEPiKfRI7fiuMa4KF3Xwu+Mx7fhWNNWsjy73mzEjXufaEjk 4FKTcF0d9WyUtF1itOa6TKZ3h0YAtRLQXVpNpB8mTsNotFXlaPyi1hb/usjXxFbgVFm2 KqZSeaNucmhJHZIhOrJSVWkmm+V0a+yAOACBx/TWG4Z+VVaOxkVUeMuR6W5BGDzFTFny +ing== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EZxEFdIx; 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 w23si5283138edr.447.2019.11.28.05.37.42; Thu, 28 Nov 2019 05:38:07 -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=EZxEFdIx; 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 S1726983AbfK1Ney (ORCPT + 99 others); Thu, 28 Nov 2019 08:34:54 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:50289 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726731AbfK1Nem (ORCPT ); Thu, 28 Nov 2019 08:34:42 -0500 Received: by mail-wm1-f68.google.com with SMTP id l17so11019450wmh.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=uZ126WlXRnV67O5iJrqCdDy+lUMaejs43DoEvUDisz7pq6WSfeKdoneMqJrzDaBqKZ QUvLmUH7gAZelKcWn2yeOD1DwtX+tsg8MxvQuzqJsGACawmCHEe0P02SLEy97TibKCno wH4ITy9z6lFg5jB0E03C3Acnttx53Jz0Ko4hAy87WXaubwwXE75lMsdJBhue3oXjxeEY iiQBbHPoUdqgHqV8JPaFWTJyRrROPjtK4a6Orjc/zCYhglmzHqt2LI+db+476WkS4GIc +kg82oOqJt57XHeqHM0zeCmHHzjVlJ9lfrxSpqSJ7B73kLaC4PQYT1Z8GD+7HVUtNgZK OC4w== X-Gm-Message-State: APjAAAXvFlDbZ5WVF4NFLCXuEhzB8vY/rgN7b3DlsCDvX0FkPNBr4iGV 037ssrO8HaymKF3mPmB4vVdkBg== 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- 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;