Commit 60ed96bd authored by Paolo Abeni's avatar Paolo Abeni

Merge branch 'fix-ti-am65-cpsw-nuss-module-removal'

Nicolas Pitre says:

====================
fix ti-am65-cpsw-nuss module removal

Fix issues preventing rmmod of ti-am65-cpsw-nuss from working properly.

v3:

  - more patch submission minutiae

v2: https://lore.kernel.org/netdev/20241003172105.2712027-2-nico@fluxnic.net/T/

  - conform to netdev patch submission customs
  - address patch review trivias

v1: https://lore.kernel.org/netdev/20240927025301.1312590-2-nico@fluxnic.net/T/
====================

Link: https://patch.msgid.link/20241004041218.2809774-1-nico@fluxnic.netSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents 3dc6e998 03c96bc9
...@@ -2744,10 +2744,9 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx) ...@@ -2744,10 +2744,9 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx)
return 0; return 0;
/* alloc netdev */ /* alloc netdev */
port->ndev = devm_alloc_etherdev_mqs(common->dev, port->ndev = alloc_etherdev_mqs(sizeof(struct am65_cpsw_ndev_priv),
sizeof(struct am65_cpsw_ndev_priv), AM65_CPSW_MAX_QUEUES,
AM65_CPSW_MAX_QUEUES, AM65_CPSW_MAX_QUEUES);
AM65_CPSW_MAX_QUEUES);
if (!port->ndev) { if (!port->ndev) {
dev_err(dev, "error allocating slave net_device %u\n", dev_err(dev, "error allocating slave net_device %u\n",
port->port_id); port->port_id);
...@@ -2868,8 +2867,12 @@ static void am65_cpsw_nuss_cleanup_ndev(struct am65_cpsw_common *common) ...@@ -2868,8 +2867,12 @@ static void am65_cpsw_nuss_cleanup_ndev(struct am65_cpsw_common *common)
for (i = 0; i < common->port_num; i++) { for (i = 0; i < common->port_num; i++) {
port = &common->ports[i]; port = &common->ports[i];
if (port->ndev && port->ndev->reg_state == NETREG_REGISTERED) if (!port->ndev)
continue;
if (port->ndev->reg_state == NETREG_REGISTERED)
unregister_netdev(port->ndev); unregister_netdev(port->ndev);
free_netdev(port->ndev);
port->ndev = NULL;
} }
} }
...@@ -3613,16 +3616,17 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev) ...@@ -3613,16 +3616,17 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
ret = am65_cpsw_nuss_init_ndevs(common); ret = am65_cpsw_nuss_init_ndevs(common);
if (ret) if (ret)
goto err_free_phylink; goto err_ndevs_clear;
ret = am65_cpsw_nuss_register_ndevs(common); ret = am65_cpsw_nuss_register_ndevs(common);
if (ret) if (ret)
goto err_free_phylink; goto err_ndevs_clear;
pm_runtime_put(dev); pm_runtime_put(dev);
return 0; return 0;
err_free_phylink: err_ndevs_clear:
am65_cpsw_nuss_cleanup_ndev(common);
am65_cpsw_nuss_phylink_cleanup(common); am65_cpsw_nuss_phylink_cleanup(common);
am65_cpts_release(common->cpts); am65_cpts_release(common->cpts);
err_of_clear: err_of_clear:
...@@ -3652,13 +3656,13 @@ static void am65_cpsw_nuss_remove(struct platform_device *pdev) ...@@ -3652,13 +3656,13 @@ static void am65_cpsw_nuss_remove(struct platform_device *pdev)
return; return;
} }
am65_cpsw_unregister_devlink(common);
am65_cpsw_unregister_notifiers(common); am65_cpsw_unregister_notifiers(common);
/* must unregister ndevs here because DD release_driver routine calls /* must unregister ndevs here because DD release_driver routine calls
* dma_deconfigure(dev) before devres_release_all(dev) * dma_deconfigure(dev) before devres_release_all(dev)
*/ */
am65_cpsw_nuss_cleanup_ndev(common); am65_cpsw_nuss_cleanup_ndev(common);
am65_cpsw_unregister_devlink(common);
am65_cpsw_nuss_phylink_cleanup(common); am65_cpsw_nuss_phylink_cleanup(common);
am65_cpts_release(common->cpts); am65_cpts_release(common->cpts);
am65_cpsw_disable_serdes_phy(common); am65_cpsw_disable_serdes_phy(common);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment