Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rswitch: fix netdev initialization order #4

Open
wants to merge 1 commit into
base: v5.10.41/rcar-5.1.7.rc2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions drivers/net/ethernet/renesas/rswitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -2609,7 +2609,7 @@ static void rswitch_set_mac_address(struct rswitch_device *rdev)
of_node_put(ports);
}

static int rswitch_ndev_register(struct rswitch_private *priv, int index)
static int rswitch_ndev_create(struct rswitch_private *priv, int index)
{
struct platform_device *pdev = priv->pdev;
struct net_device *ndev;
Expand Down Expand Up @@ -2650,11 +2650,6 @@ static int rswitch_ndev_register(struct rswitch_private *priv, int index)

rswitch_set_mac_address(rdev);

/* Network device register */
err = register_netdev(ndev);
if (err)
goto out_reg_netdev;

/* FIXME: it seems S4 VPF has FWPBFCSDC0/1 only so that we cannot set
* CSD = 1 (rx_chain->index = 1) for FWPBFCS03. So, use index = 0
* for the RX.
Expand All @@ -2676,9 +2671,6 @@ static int rswitch_ndev_register(struct rswitch_private *priv, int index)
rswitch_rxdmac_free(ndev, priv);

out_rxdmac:
unregister_netdev(ndev);

out_reg_netdev:
netif_napi_del(&rdev->napi);
free_netdev(ndev);

Expand Down Expand Up @@ -2833,7 +2825,7 @@ static int rswitch_init(struct rswitch_private *priv)
goto out;

for (i = 0; i < num_ndev; i++) {
err = rswitch_ndev_register(priv, i);
err = rswitch_ndev_create(priv, i);
if (err < 0)
goto out;
}
Expand All @@ -2852,6 +2844,14 @@ static int rswitch_init(struct rswitch_private *priv)
if (err < 0)
goto out;

/* Register devices so Linux network stack can access them now */

for (i = 0; i < num_ndev; i++) {
err = register_netdev(priv->rdev[i]->ndev);
if (err)
goto out;
}

return 0;

out:
Expand Down