From: Georgi Djakov <georgi.djakov@linaro.org>
To: gregkh@linuxfoundation.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Georgi Djakov <georgi.djakov@linaro.org>,
Dmitry Osipenko <digetx@gmail.com>,
Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: [PATCH 01/12] interconnect: Add a common helper for removing all nodes
Date: Fri, 17 Jan 2020 11:58:05 +0200 [thread overview]
Message-ID: <20200117095816.23575-2-georgi.djakov@linaro.org> (raw)
In-Reply-To: <20200117095816.23575-1-georgi.djakov@linaro.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 <digetx@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
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;
next prev parent reply other threads:[~2020-01-17 9:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-17 9:58 [GIT PULL 00/12] interconnect changes for 5.6 Georgi Djakov
2020-01-17 9:58 ` Georgi Djakov [this message]
2020-01-17 9:58 ` [PATCH 02/12] interconnect: qcom: Use the new common helper for node removal Georgi Djakov
2020-01-17 9:58 ` [PATCH 03/12] interconnect: Move internal structs into a separate file Georgi Djakov
2020-01-17 9:58 ` [PATCH 04/12] interconnect: Add a name to struct icc_path Georgi Djakov
2020-01-17 9:58 ` [PATCH 05/12] interconnect: Add basic tracepoints Georgi Djakov
2020-01-17 9:58 ` [PATCH 06/12] interconnect: Add a common standard aggregate function Georgi Djakov
2020-01-17 9:58 ` [PATCH 07/12] interconnect: qcom: Use the " Georgi Djakov
2020-01-17 9:58 ` [PATCH 08/12] interconnect: Add interconnect_graph file to debugfs Georgi Djakov
2020-01-17 9:58 ` [PATCH 09/12] interconnect: Print the tag in the debugfs summary Georgi Djakov
2020-01-17 9:58 ` [PATCH 10/12] interconnect: Check for valid path in icc_set_bw() Georgi Djakov
2020-01-17 9:58 ` [PATCH 11/12] dt-bindings: interconnect: Add Qualcomm MSM8916 DT bindings Georgi Djakov
2020-01-17 9:58 ` [PATCH 12/12] interconnect: qcom: Add MSM8916 interconnect provider driver Georgi Djakov
2020-01-22 9:05 ` [GIT PULL 00/12] interconnect changes for 5.6 Greg KH
2020-01-22 9:15 ` Georgi Djakov
2020-01-22 9:07 ` Georgi Djakov
2020-01-22 9:15 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200117095816.23575-2-georgi.djakov@linaro.org \
--to=georgi.djakov@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=digetx@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox