Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8839859ybl; Fri, 17 Jan 2020 01:59:36 -0800 (PST) X-Google-Smtp-Source: APXvYqwpzWJgBs+9zgfFETAZvSsD0i3oRQwmW5HDc791eNTMPv8wLD9o6qIEWZm0o/gUJ2ZLLtD6 X-Received: by 2002:a05:6830:1e1c:: with SMTP id s28mr5366016otr.335.1579255176567; Fri, 17 Jan 2020 01:59:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579255176; cv=none; d=google.com; s=arc-20160816; b=GrcSNIG6VwfsgxLmNPqWRGzecFbBRUunc8jc0j1IgvfrvJZJlAIlnX1qxQXR48Q078 yB+SzyC+o++PaajqTSpSBx/yqG2vOkVxbMXsquwM8k4ZxugZG0jwHm5XhBWPJovjwVLJ uqnNUWUviaMaSvE0/XyI9MklRYECuwr8FhFrRDQbLiBzgkRe1raNN3W1QF4GR7vS/kjO LgNUPL2tQDyIPEtEaDza5Zv5FBywIEidQ3TghqrYqtOm5z9xS2tSGzp+7qjwEWm2wvkE k4VzCQSpblIaUnkEsEetxxVrSTxTVKY8JXSF0s4G5Chhfgn6jhpD5sgiYMYJAcc6U16o z9yg== 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=qe7hebl/mzA5Y4yspidYJnXz8QIxCuPLK7wWr6/hKiU=; b=b2625VEyQ+SpYi4t6SZyp6SdL3NvYX+/zS6LWSKivo+ykhZHc63f7wxewY7+p0P7Xm 2RZHLj2xyysA6NMRI3ZsPzzZv11ZvGXpbqmnKj6cVF0GPmoE8MSAZ+w7zXfmPq3+woLi Kg4+E/ShF+x9aWQ2JXbgotaSHg4s8Cf+RUW8p2ZDzLu/D3daEK+9TPlZVpNFAO+bAELP YPObkXzcO3Hm7Xi5cefXxaOvTL2oLZuh29T+/6atryrLw6R3qqRMMk9ntwfq2RIVUh13 gSFYyA1QwRbxZQeQCvtmuy9g5m20wDyI6kp1i1S4HhrL8gTX4E1oK+TtugVAL+gqOHG7 q9Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XnUDwVsA; 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 19si13130999oiq.128.2020.01.17.01.59.25; Fri, 17 Jan 2020 01:59:36 -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=XnUDwVsA; 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 S1728778AbgAQJ6Y (ORCPT + 99 others); Fri, 17 Jan 2020 04:58:24 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:53174 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726553AbgAQJ6V (ORCPT ); Fri, 17 Jan 2020 04:58:21 -0500 Received: by mail-wm1-f66.google.com with SMTP id p9so6801810wmc.2 for ; Fri, 17 Jan 2020 01:58:20 -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=qe7hebl/mzA5Y4yspidYJnXz8QIxCuPLK7wWr6/hKiU=; b=XnUDwVsAsNbFlvaGv/Mxxp0g86KC+WA5dTFlLpL3YnqfDrJo/0yGU2CmRdOBii7lpG cgNKD4vTO3v0iOZt1Jh7WC8sDleIaoYBdJDF3pzL8Mg0w0h3bmnLF7/+Gnqmj/TiHn+u LgoRzxYHQuZERRdKSOJOMMAT6ez71f4mH4BW+EgVXHQYR9g2DLgjw0Pzwxh9veFGhnew XLurquhFXdcDw336nu8esZFEMSAOfVZ+8RqYK9Q5pBxPJ/DvIcxT8WuwRCPTppiMo8ny NnuooOC+D0jo5hqmTC7sFj/rP5wAb3Ve1hNlMQmlo44t+cq8FP/9A3jqncxCeKwrI1PW mu7g== 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=qe7hebl/mzA5Y4yspidYJnXz8QIxCuPLK7wWr6/hKiU=; b=K0MCnv/eV4cIiQd5eiYvZVn1DxNzBj08Mj+xrN//9pw5J9c309rqH1iMlbIm3SzWpi S6v9n0fQSL1LvxXdmErHY2daLruEu7m5kboUJPPccVk5xjcjRjaaJPWwzCGYhDH4ryp5 iPnIpXP9a6tg82JZHaRaPU/jc9BCafciSnsjMJ7Y5vZZnBQ6CFHr0z+5vcMs3Ss6VoQX kRP6YPtgoxuDJK6609bfsc6mCLkWVSE6C6fzTKcQhE+JrQeQLdGeEy7hKbRfzNSdqkzt cdVQ84fY4lxkmtbSIdu77+LAaadRZUMKn+onD4BpVzDYU/lVZsa/pU7jjJoN4QgnqCWs A6/Q== X-Gm-Message-State: APjAAAU3/pvtI5bnEdX7KGdoI6Qmf0HA4LA9S25RnxtwItWYCTnP79uw F6cG+WuOY/rh/0uf7tgtzY8WUg== X-Received: by 2002:a05:600c:2046:: with SMTP id p6mr3729467wmg.110.1579255099536; Fri, 17 Jan 2020 01:58:19 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id r62sm9967007wma.32.2020.01.17.01.58.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jan 2020 01:58:19 -0800 (PST) From: Georgi Djakov To: gregkh@linuxfoundation.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Georgi Djakov , Dmitry Osipenko , Bjorn Andersson Subject: [PATCH 01/12] interconnect: Add a common helper for removing all nodes Date: Fri, 17 Jan 2020 11:58:05 +0200 Message-Id: <20200117095816.23575-2-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200117095816.23575-1-georgi.djakov@linaro.org> References: <20200117095816.23575-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 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 c498796adc07..1b811423020a 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -742,6 +742,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;