Skip to content

Commit 4efee05

Browse files
committed
Merge branch 'mvpp2-child-port-removal'
Javier Carrasco says: ==================== net: mvpp2: rework child node/port removal handling These two patches used to be part of another series [1] that did not apply to the networking tree without conflicts. This is therefore just a partial resend with no code modifications, just rebased onto net/main. Link: https://lore.kernel.org/all/20240806181026.5fe7f777@kernel.org/ [1] ==================== Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 80d021b + a7b3274 commit 4efee05

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7417,8 +7417,6 @@ static int mvpp2_get_sram(struct platform_device *pdev,
74177417

74187418
static int mvpp2_probe(struct platform_device *pdev)
74197419
{
7420-
struct fwnode_handle *fwnode = pdev->dev.fwnode;
7421-
struct fwnode_handle *port_fwnode;
74227420
struct mvpp2 *priv;
74237421
struct resource *res;
74247422
void __iomem *base;
@@ -7591,7 +7589,7 @@ static int mvpp2_probe(struct platform_device *pdev)
75917589
}
75927590

75937591
/* Map DTS-active ports. Should be done before FIFO mvpp2_init */
7594-
fwnode_for_each_available_child_node(fwnode, port_fwnode) {
7592+
device_for_each_child_node_scoped(&pdev->dev, port_fwnode) {
75957593
if (!fwnode_property_read_u32(port_fwnode, "port-id", &i))
75967594
priv->port_map |= BIT(i);
75977595
}
@@ -7614,7 +7612,7 @@ static int mvpp2_probe(struct platform_device *pdev)
76147612
goto err_axi_clk;
76157613

76167614
/* Initialize ports */
7617-
fwnode_for_each_available_child_node(fwnode, port_fwnode) {
7615+
device_for_each_child_node_scoped(&pdev->dev, port_fwnode) {
76187616
err = mvpp2_port_probe(pdev, port_fwnode, priv);
76197617
if (err < 0)
76207618
goto err_port_probe;
@@ -7653,14 +7651,8 @@ static int mvpp2_probe(struct platform_device *pdev)
76537651
return 0;
76547652

76557653
err_port_probe:
7656-
fwnode_handle_put(port_fwnode);
7657-
7658-
i = 0;
7659-
fwnode_for_each_available_child_node(fwnode, port_fwnode) {
7660-
if (priv->port_list[i])
7661-
mvpp2_port_remove(priv->port_list[i]);
7662-
i++;
7663-
}
7654+
for (i = 0; i < priv->port_count; i++)
7655+
mvpp2_port_remove(priv->port_list[i]);
76647656
err_axi_clk:
76657657
clk_disable_unprepare(priv->axi_clk);
76667658
err_mg_core_clk:
@@ -7677,18 +7669,13 @@ static int mvpp2_probe(struct platform_device *pdev)
76777669
static void mvpp2_remove(struct platform_device *pdev)
76787670
{
76797671
struct mvpp2 *priv = platform_get_drvdata(pdev);
7680-
struct fwnode_handle *fwnode = pdev->dev.fwnode;
7681-
int i = 0, poolnum = MVPP2_BM_POOLS_NUM;
7682-
struct fwnode_handle *port_fwnode;
7672+
int i, poolnum = MVPP2_BM_POOLS_NUM;
76837673

76847674
mvpp2_dbgfs_cleanup(priv);
76857675

7686-
fwnode_for_each_available_child_node(fwnode, port_fwnode) {
7687-
if (priv->port_list[i]) {
7688-
mutex_destroy(&priv->port_list[i]->gather_stats_lock);
7689-
mvpp2_port_remove(priv->port_list[i]);
7690-
}
7691-
i++;
7676+
for (i = 0; i < priv->port_count; i++) {
7677+
mutex_destroy(&priv->port_list[i]->gather_stats_lock);
7678+
mvpp2_port_remove(priv->port_list[i]);
76927679
}
76937680

76947681
destroy_workqueue(priv->stats_queue);
@@ -7711,7 +7698,7 @@ static void mvpp2_remove(struct platform_device *pdev)
77117698
aggr_txq->descs_dma);
77127699
}
77137700

7714-
if (is_acpi_node(port_fwnode))
7701+
if (!dev_of_node(&pdev->dev))
77157702
return;
77167703

77177704
clk_disable_unprepare(priv->axi_clk);

0 commit comments

Comments
 (0)