Commit 38ec70cc authored by Ioana Ciornei's avatar Ioana Ciornei Committed by Greg Kroah-Hartman

staging: fsl-dpaa2/ethsw: use bool when encoding learning/flooding state

Use a bool instead of an u8 in ethsw_set_learning() and
ethsw_port_set_flood() to encode an binary type property.
Reported-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/1565700187-16048-6-git-send-email-ioana.ciornei@nxp.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 47980a20
...@@ -149,12 +149,12 @@ static int ethsw_port_add_vlan(struct ethsw_port_priv *port_priv, ...@@ -149,12 +149,12 @@ static int ethsw_port_add_vlan(struct ethsw_port_priv *port_priv,
return 0; return 0;
} }
static int ethsw_set_learning(struct ethsw_core *ethsw, u8 flag) static int ethsw_set_learning(struct ethsw_core *ethsw, bool enable)
{ {
enum dpsw_fdb_learning_mode learn_mode; enum dpsw_fdb_learning_mode learn_mode;
int err; int err;
if (flag) if (enable)
learn_mode = DPSW_FDB_LEARNING_MODE_HW; learn_mode = DPSW_FDB_LEARNING_MODE_HW;
else else
learn_mode = DPSW_FDB_LEARNING_MODE_DIS; learn_mode = DPSW_FDB_LEARNING_MODE_DIS;
...@@ -165,24 +165,24 @@ static int ethsw_set_learning(struct ethsw_core *ethsw, u8 flag) ...@@ -165,24 +165,24 @@ static int ethsw_set_learning(struct ethsw_core *ethsw, u8 flag)
dev_err(ethsw->dev, "dpsw_fdb_set_learning_mode err %d\n", err); dev_err(ethsw->dev, "dpsw_fdb_set_learning_mode err %d\n", err);
return err; return err;
} }
ethsw->learning = !!flag; ethsw->learning = enable;
return 0; return 0;
} }
static int ethsw_port_set_flood(struct ethsw_port_priv *port_priv, u8 flag) static int ethsw_port_set_flood(struct ethsw_port_priv *port_priv, bool enable)
{ {
int err; int err;
err = dpsw_if_set_flooding(port_priv->ethsw_data->mc_io, 0, err = dpsw_if_set_flooding(port_priv->ethsw_data->mc_io, 0,
port_priv->ethsw_data->dpsw_handle, port_priv->ethsw_data->dpsw_handle,
port_priv->idx, flag); port_priv->idx, enable);
if (err) { if (err) {
netdev_err(port_priv->netdev, netdev_err(port_priv->netdev,
"dpsw_if_set_flooding err %d\n", err); "dpsw_if_set_flooding err %d\n", err);
return err; return err;
} }
port_priv->flood = !!flag; port_priv->flood = enable;
return 0; return 0;
} }
......
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