Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2 1/5] interconnect: qcom: sdm845: Walk the list safely on node removal
@ 2019-12-02 16:21 Georgi Djakov
  2019-12-02 16:21 ` [PATCH v2 2/5] interconnect: qcom: qcs404: " Georgi Djakov
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Georgi Djakov @ 2019-12-02 16:21 UTC (permalink / raw)
  To: linux-pm
  Cc: bjorn.andersson, agross, digetx, evgreen, daidavid1, masneyb,
	sibis, linux-kernel, linux-arm-msm, georgi.djakov

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 <digetx@gmail.com>
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
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);
 	}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 2/5] interconnect: qcom: qcs404: Walk the list safely on node removal
  2019-12-02 16:21 [PATCH v2 1/5] interconnect: qcom: sdm845: Walk the list safely on node removal Georgi Djakov
@ 2019-12-02 16:21 ` " Georgi Djakov
  2019-12-02 17:37   ` Bjorn Andersson
  2019-12-02 16:21 ` [PATCH v2 3/5] interconnect: qcom: msm8974: " Georgi Djakov
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Georgi Djakov @ 2019-12-02 16:21 UTC (permalink / raw)
  To: linux-pm
  Cc: bjorn.andersson, agross, digetx, evgreen, daidavid1, masneyb,
	sibis, linux-kernel, linux-arm-msm, georgi.djakov

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 <digetx@gmail.com>
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
 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);
 	}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 3/5] interconnect: qcom: msm8974: Walk the list safely on node removal
  2019-12-02 16:21 [PATCH v2 1/5] interconnect: qcom: sdm845: Walk the list safely on node removal Georgi Djakov
  2019-12-02 16:21 ` [PATCH v2 2/5] interconnect: qcom: qcs404: " Georgi Djakov
@ 2019-12-02 16:21 ` " Georgi Djakov
  2019-12-02 17:37   ` Bjorn Andersson
  2019-12-02 16:21 ` [PATCH v2 4/5] interconnect: Add a common helper for removing all nodes Georgi Djakov
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Georgi Djakov @ 2019-12-02 16:21 UTC (permalink / raw)
  To: linux-pm
  Cc: bjorn.andersson, agross, digetx, evgreen, daidavid1, masneyb,
	sibis, linux-kernel, linux-arm-msm, georgi.djakov

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 <digetx@gmail.com>
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
 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);
 	}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 4/5] interconnect: Add a common helper for removing all nodes
  2019-12-02 16:21 [PATCH v2 1/5] interconnect: qcom: sdm845: Walk the list safely on node removal Georgi Djakov
  2019-12-02 16:21 ` [PATCH v2 2/5] interconnect: qcom: qcs404: " Georgi Djakov
  2019-12-02 16:21 ` [PATCH v2 3/5] interconnect: qcom: msm8974: " Georgi Djakov
@ 2019-12-02 16:21 ` Georgi Djakov
  2019-12-02 16:21 ` [PATCH v2 5/5] interconnect: qcom: Use the new common helper for node removal Georgi Djakov
  2019-12-02 17:36 ` [PATCH v2 1/5] interconnect: qcom: sdm845: Walk the list safely on " Bjorn Andersson
  4 siblings, 0 replies; 9+ messages in thread
From: Georgi Djakov @ 2019-12-02 16:21 UTC (permalink / raw)
  To: linux-pm
  Cc: bjorn.andersson, agross, digetx, evgreen, daidavid1, masneyb,
	sibis, linux-kernel, linux-arm-msm, georgi.djakov

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 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;

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 5/5] interconnect: qcom: Use the new common helper for node removal
  2019-12-02 16:21 [PATCH v2 1/5] interconnect: qcom: sdm845: Walk the list safely on node removal Georgi Djakov
                   ` (2 preceding siblings ...)
  2019-12-02 16:21 ` [PATCH v2 4/5] interconnect: Add a common helper for removing all nodes Georgi Djakov
@ 2019-12-02 16:21 ` Georgi Djakov
  2019-12-02 17:40   ` Bjorn Andersson
  2019-12-02 17:36 ` [PATCH v2 1/5] interconnect: qcom: sdm845: Walk the list safely on " Bjorn Andersson
  4 siblings, 1 reply; 9+ messages in thread
From: Georgi Djakov @ 2019-12-02 16:21 UTC (permalink / raw)
  To: linux-pm
  Cc: bjorn.andersson, agross, digetx, evgreen, daidavid1, masneyb,
	sibis, linux-kernel, linux-arm-msm, georgi.djakov

There is a new helper function for removing all nodes. Let's use it instead
of duplicating the code.

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
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[] = {

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/5] interconnect: qcom: sdm845: Walk the list safely on node removal
  2019-12-02 16:21 [PATCH v2 1/5] interconnect: qcom: sdm845: Walk the list safely on node removal Georgi Djakov
                   ` (3 preceding siblings ...)
  2019-12-02 16:21 ` [PATCH v2 5/5] interconnect: qcom: Use the new common helper for node removal Georgi Djakov
@ 2019-12-02 17:36 ` " Bjorn Andersson
  4 siblings, 0 replies; 9+ messages in thread
From: Bjorn Andersson @ 2019-12-02 17:36 UTC (permalink / raw)
  To: Georgi Djakov
  Cc: linux-pm, agross, digetx, evgreen, daidavid1, masneyb, sibis,
	linux-kernel, linux-arm-msm

On Mon 02 Dec 08:21 PST 2019, Georgi Djakov wrote:

> 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 <digetx@gmail.com>
> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> ---
> 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);
>  	}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/5] interconnect: qcom: qcs404: Walk the list safely on node removal
  2019-12-02 16:21 ` [PATCH v2 2/5] interconnect: qcom: qcs404: " Georgi Djakov
@ 2019-12-02 17:37   ` Bjorn Andersson
  0 siblings, 0 replies; 9+ messages in thread
From: Bjorn Andersson @ 2019-12-02 17:37 UTC (permalink / raw)
  To: Georgi Djakov
  Cc: linux-pm, agross, digetx, evgreen, daidavid1, masneyb, sibis,
	linux-kernel, linux-arm-msm

On Mon 02 Dec 08:21 PST 2019, Georgi Djakov wrote:

> 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 <digetx@gmail.com>
> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> ---
>  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);
>  	}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/5] interconnect: qcom: msm8974: Walk the list safely on node removal
  2019-12-02 16:21 ` [PATCH v2 3/5] interconnect: qcom: msm8974: " Georgi Djakov
@ 2019-12-02 17:37   ` Bjorn Andersson
  0 siblings, 0 replies; 9+ messages in thread
From: Bjorn Andersson @ 2019-12-02 17:37 UTC (permalink / raw)
  To: Georgi Djakov
  Cc: linux-pm, agross, digetx, evgreen, daidavid1, masneyb, sibis,
	linux-kernel, linux-arm-msm

On Mon 02 Dec 08:21 PST 2019, Georgi Djakov wrote:

> 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 <digetx@gmail.com>
> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> ---
>  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);
>  	}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 5/5] interconnect: qcom: Use the new common helper for node removal
  2019-12-02 16:21 ` [PATCH v2 5/5] interconnect: qcom: Use the new common helper for node removal Georgi Djakov
@ 2019-12-02 17:40   ` Bjorn Andersson
  0 siblings, 0 replies; 9+ messages in thread
From: Bjorn Andersson @ 2019-12-02 17:40 UTC (permalink / raw)
  To: Georgi Djakov
  Cc: linux-pm, agross, digetx, evgreen, daidavid1, masneyb, sibis,
	linux-kernel, linux-arm-msm

On Mon 02 Dec 08:21 PST 2019, Georgi Djakov wrote:

> There is a new helper function for removing all nodes. Let's use it instead
> of duplicating the code.
> 
> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> ---
> 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[] = {

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02 16:21 [PATCH v2 1/5] interconnect: qcom: sdm845: Walk the list safely on node removal Georgi Djakov
2019-12-02 16:21 ` [PATCH v2 2/5] interconnect: qcom: qcs404: " Georgi Djakov
2019-12-02 17:37   ` Bjorn Andersson
2019-12-02 16:21 ` [PATCH v2 3/5] interconnect: qcom: msm8974: " Georgi Djakov
2019-12-02 17:37   ` Bjorn Andersson
2019-12-02 16:21 ` [PATCH v2 4/5] interconnect: Add a common helper for removing all nodes Georgi Djakov
2019-12-02 16:21 ` [PATCH v2 5/5] interconnect: qcom: Use the new common helper for node removal Georgi Djakov
2019-12-02 17:40   ` Bjorn Andersson
2019-12-02 17:36 ` [PATCH v2 1/5] interconnect: qcom: sdm845: Walk the list safely on " Bjorn Andersson

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org
	public-inbox-index linux-arm-msm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git