forked from Minki/linux
net: dsa: remove bool devlink_port_setup
Since dsa_port_devlink_setup() and dsa_port_devlink_teardown() are already called from code paths which only execute once per port (due to the existing bool dp->setup), keeping another dp->devlink_port_setup is redundant, because we can already manage to balance the calls properly (and not call teardown when setup was never called, or call setup twice, or things like that). Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
c698a5fbf7
commit
61e4a51621
@ -294,8 +294,6 @@ struct dsa_port {
|
||||
|
||||
u8 lag_tx_enabled:1;
|
||||
|
||||
u8 devlink_port_setup:1;
|
||||
|
||||
/* Master state bits, valid only on CPU ports */
|
||||
u8 master_admin_up:1;
|
||||
u8 master_oper_up:1;
|
||||
|
@ -510,7 +510,6 @@ static int dsa_port_devlink_setup(struct dsa_port *dp)
|
||||
ds->ops->port_teardown(ds, dp->index);
|
||||
return err;
|
||||
}
|
||||
dp->devlink_port_setup = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -520,13 +519,12 @@ static void dsa_port_devlink_teardown(struct dsa_port *dp)
|
||||
struct devlink_port *dlp = &dp->devlink_port;
|
||||
struct dsa_switch *ds = dp->ds;
|
||||
|
||||
if (dp->devlink_port_setup) {
|
||||
devlink_port_unregister(dlp);
|
||||
if (ds->ops->port_teardown)
|
||||
ds->ops->port_teardown(ds, dp->index);
|
||||
devlink_port_fini(dlp);
|
||||
}
|
||||
dp->devlink_port_setup = false;
|
||||
devlink_port_unregister(dlp);
|
||||
|
||||
if (ds->ops->port_teardown)
|
||||
ds->ops->port_teardown(ds, dp->index);
|
||||
|
||||
devlink_port_fini(dlp);
|
||||
}
|
||||
|
||||
static int dsa_port_setup(struct dsa_port *dp)
|
||||
|
Loading…
Reference in New Issue
Block a user