Skip to content

Commit ad3703a

Browse files
author
Georgi Djakov
committed
interconnect: qcom: Use the new common helper for node removal
There is a new helper function for removing all nodes. Let's use it instead of duplicating the code. Reviewed-by: Bjorn Andersson <[email protected]> Signed-off-by: Georgi Djakov <[email protected]>
1 parent 3cce2c6 commit ad3703a

File tree

3 files changed

+11
-39
lines changed

3 files changed

+11
-39
lines changed

drivers/interconnect/qcom/msm8974.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ static int msm8974_icc_probe(struct platform_device *pdev)
652652
struct device *dev = &pdev->dev;
653653
struct icc_onecell_data *data;
654654
struct icc_provider *provider;
655-
struct icc_node *node, *tmp;
655+
struct icc_node *node;
656656
size_t num_nodes, i;
657657
int ret;
658658

@@ -732,10 +732,7 @@ static int msm8974_icc_probe(struct platform_device *pdev)
732732
return 0;
733733

734734
err_del_icc:
735-
list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) {
736-
icc_node_del(node);
737-
icc_node_destroy(node->id);
738-
}
735+
icc_nodes_remove(provider);
739736
icc_provider_del(provider);
740737

741738
err_disable_clks:
@@ -747,16 +744,10 @@ static int msm8974_icc_probe(struct platform_device *pdev)
747744
static int msm8974_icc_remove(struct platform_device *pdev)
748745
{
749746
struct msm8974_icc_provider *qp = platform_get_drvdata(pdev);
750-
struct icc_provider *provider = &qp->provider;
751-
struct icc_node *n, *tmp;
752747

753-
list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) {
754-
icc_node_del(n);
755-
icc_node_destroy(n->id);
756-
}
748+
icc_nodes_remove(&qp->provider);
757749
clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks);
758-
759-
return icc_provider_del(provider);
750+
return icc_provider_del(&qp->provider);
760751
}
761752

762753
static const struct of_device_id msm8974_noc_of_match[] = {

drivers/interconnect/qcom/qcs404.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ static int qnoc_probe(struct platform_device *pdev)
414414
struct icc_provider *provider;
415415
struct qcom_icc_node **qnodes;
416416
struct qcom_icc_provider *qp;
417-
struct icc_node *node, *tmp;
417+
struct icc_node *node;
418418
size_t num_nodes, i;
419419
int ret;
420420

@@ -494,10 +494,7 @@ static int qnoc_probe(struct platform_device *pdev)
494494

495495
return 0;
496496
err:
497-
list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) {
498-
icc_node_del(node);
499-
icc_node_destroy(node->id);
500-
}
497+
icc_nodes_remove(provider);
501498
clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks);
502499
icc_provider_del(provider);
503500

@@ -507,16 +504,10 @@ static int qnoc_probe(struct platform_device *pdev)
507504
static int qnoc_remove(struct platform_device *pdev)
508505
{
509506
struct qcom_icc_provider *qp = platform_get_drvdata(pdev);
510-
struct icc_provider *provider = &qp->provider;
511-
struct icc_node *n, *tmp;
512507

513-
list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) {
514-
icc_node_del(n);
515-
icc_node_destroy(n->id);
516-
}
508+
icc_nodes_remove(&qp->provider);
517509
clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks);
518-
519-
return icc_provider_del(provider);
510+
return icc_provider_del(&qp->provider);
520511
}
521512

522513
static const struct of_device_id qcs404_noc_of_match[] = {

drivers/interconnect/qcom/sdm845.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -855,27 +855,17 @@ static int qnoc_probe(struct platform_device *pdev)
855855

856856
return ret;
857857
err:
858-
list_for_each_entry(node, &provider->nodes, node_list) {
859-
icc_node_del(node);
860-
icc_node_destroy(node->id);
861-
}
862-
858+
icc_nodes_remove(provider);
863859
icc_provider_del(provider);
864860
return ret;
865861
}
866862

867863
static int qnoc_remove(struct platform_device *pdev)
868864
{
869865
struct qcom_icc_provider *qp = platform_get_drvdata(pdev);
870-
struct icc_provider *provider = &qp->provider;
871-
struct icc_node *n, *tmp;
872-
873-
list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) {
874-
icc_node_del(n);
875-
icc_node_destroy(n->id);
876-
}
877866

878-
return icc_provider_del(provider);
867+
icc_nodes_remove(&qp->provider);
868+
return icc_provider_del(&qp->provider);
879869
}
880870

881871
static const struct of_device_id qnoc_of_match[] = {

0 commit comments

Comments
 (0)