summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-05-26 18:02:42 -0400
committerDavid S. Miller <davem@davemloft.net>2017-05-27 18:54:02 -0400
commit523a89041c319bc0f6df60627ccb2413f441fb84 (patch)
treebdfaff9d79a4611e4eb8dd923c5077df4e5134a0
parent5f1d258d5389643ee306bf616385d992ce39eac5 (diff)
downloadlinux-523a89041c319bc0f6df60627ccb2413f441fb84.tar.gz
linux-523a89041c319bc0f6df60627ccb2413f441fb84.tar.bz2
linux-523a89041c319bc0f6df60627ccb2413f441fb84.zip
net: dsa: mv88e6xxx: handle SERDES error appropriately
mv88e6xxx_serdes_power returns an error, so no need to print an error message inside of it. Rather print it in its caller when the error is ignored, which is in the mv88e6xxx_port_disable void function. Catch and return its error in the counterpart mv88e6xxx_port_enable. Fixes: 04aca9938255 ("dsa: mv88e6xxx: Enable/Disable SERDES on port enable/disable") Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index c2f38f6770aa..742c0eae7fa3 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1806,16 +1806,10 @@ static int mv88e6xxx_setup_egress_floods(struct mv88e6xxx_chip *chip, int port)
static int mv88e6xxx_serdes_power(struct mv88e6xxx_chip *chip, int port,
bool on)
{
- int err = 0;
-
- if (chip->info->ops->serdes_power) {
- err = chip->info->ops->serdes_power(chip, port, on);
- if (err)
- dev_err(chip->dev,
- "Failed to change SERDES power: %d\n", err);
- }
+ if (chip->info->ops->serdes_power)
+ return chip->info->ops->serdes_power(chip, port, on);
- return err;
+ return 0;
}
static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
@@ -1982,10 +1976,10 @@ static int mv88e6xxx_port_enable(struct dsa_switch *ds, int port,
struct phy_device *phydev)
{
struct mv88e6xxx_chip *chip = ds->priv;
- int err = 0;
+ int err;
mutex_lock(&chip->reg_lock);
- mv88e6xxx_serdes_power(chip, port, true);
+ err = mv88e6xxx_serdes_power(chip, port, true);
mutex_unlock(&chip->reg_lock);
return err;
@@ -1997,7 +1991,8 @@ static void mv88e6xxx_port_disable(struct dsa_switch *ds, int port,
struct mv88e6xxx_chip *chip = ds->priv;
mutex_lock(&chip->reg_lock);
- mv88e6xxx_serdes_power(chip, port, false);
+ if (mv88e6xxx_serdes_power(chip, port, false))
+ dev_err(chip->dev, "failed to power off SERDES\n");
mutex_unlock(&chip->reg_lock);
}