Skip to content

Commit

Permalink
net: dsa: remove PHY device argument from .set_eee
Browse files Browse the repository at this point in the history
The DSA switch operations for EEE are only meant to configure a port's
MAC EEE settings. The port's PHY EEE settings are accessed by the DSA
layer and must be made available via a proper PHY driver.

In order to reduce this confusion, remove the phy_device argument from
the .set_eee operation.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vivien Didelot authored and David S. Miller committed Aug 2, 2017
1 parent c48f7eb commit 46587e4
Showing 5 changed files with 5 additions and 15 deletions.
1 change: 0 additions & 1 deletion drivers/net/dsa/bcm_sf2.c
Original file line number Diff line number Diff line change
@@ -353,7 +353,6 @@ static int bcm_sf2_sw_get_eee(struct dsa_switch *ds, int port,
}

static int bcm_sf2_sw_set_eee(struct dsa_switch *ds, int port,
struct phy_device *phydev,
struct ethtool_eee *e)
{
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
2 changes: 1 addition & 1 deletion drivers/net/dsa/mv88e6xxx/chip.c
Original file line number Diff line number Diff line change
@@ -850,7 +850,7 @@ static int mv88e6xxx_get_eee(struct dsa_switch *ds, int port,
}

static int mv88e6xxx_set_eee(struct dsa_switch *ds, int port,
struct phy_device *phydev, struct ethtool_eee *e)
struct ethtool_eee *e)
{
struct mv88e6xxx_chip *chip = ds->priv;
int err;
14 changes: 3 additions & 11 deletions drivers/net/dsa/qca8k.c
Original file line number Diff line number Diff line change
@@ -637,29 +637,21 @@ qca8k_get_sset_count(struct dsa_switch *ds)
return ARRAY_SIZE(ar8327_mib);
}

static void
qca8k_eee_enable_set(struct dsa_switch *ds, int port, bool enable)
static int
qca8k_set_eee(struct dsa_switch *ds, int port, struct ethtool_eee *eee)
{
struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
u32 lpi_en = QCA8K_REG_EEE_CTRL_LPI_EN(port);
u32 reg;

mutex_lock(&priv->reg_mutex);
reg = qca8k_read(priv, QCA8K_REG_EEE_CTRL);
if (enable)
if (eee->eee_enabled)
reg |= lpi_en;
else
reg &= ~lpi_en;
qca8k_write(priv, QCA8K_REG_EEE_CTRL, reg);
mutex_unlock(&priv->reg_mutex);
}

static int
qca8k_set_eee(struct dsa_switch *ds, int port,
struct phy_device *phydev,
struct ethtool_eee *e)
{
qca8k_eee_enable_set(ds, port, e->eee_enabled);

return 0;
}
1 change: 0 additions & 1 deletion include/net/dsa.h
Original file line number Diff line number Diff line change
@@ -335,7 +335,6 @@ struct dsa_switch_ops {
* EEE setttings
*/
int (*set_eee)(struct dsa_switch *ds, int port,
struct phy_device *phydev,
struct ethtool_eee *e);
int (*get_eee)(struct dsa_switch *ds, int port,
struct ethtool_eee *e);
2 changes: 1 addition & 1 deletion net/dsa/slave.c
Original file line number Diff line number Diff line change
@@ -655,7 +655,7 @@ static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e)
if (!ds->ops->set_eee)
return -EOPNOTSUPP;

ret = ds->ops->set_eee(ds, p->dp->index, p->phy, e);
ret = ds->ops->set_eee(ds, p->dp->index, e);
if (ret)
return ret;

0 comments on commit 46587e4

Please sign in to comment.