summaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa/mv88e6xxx/serdes.c
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@gmail.com>2019-08-31 22:18:32 +0200
committerDavid S. Miller <davem@davemloft.net>2019-09-01 21:16:38 +0200
commit6600d8e5822d9b3f98c82db3e96df6895b1e87d8 (patch)
tree7865ae99d14dbdd6d98ce0532400b4ce63ca61b8 /drivers/net/dsa/mv88e6xxx/serdes.c
parentnet: dsa: mv88e6xxx: implement mv88e6352_serdes_get_lane (diff)
downloadlinux-6600d8e5822d9b3f98c82db3e96df6895b1e87d8.tar.xz
linux-6600d8e5822d9b3f98c82db3e96df6895b1e87d8.zip
net: dsa: mv88e6xxx: merge mv88e6352_serdes_power_set
The mv88e6352_serdes_power_set helper is only used at one place, in mv88e6352_serdes_power. Keep it simple and merge the two functions together. Use mv88e6xxx_serdes_get_lane instead of mv88e6352_port_has_serdes to avoid moving code. No functional changes. Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--drivers/net/dsa/mv88e6xxx/serdes.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c
index 9fb2773a3eb5..e8ad66987be9 100644
--- a/drivers/net/dsa/mv88e6xxx/serdes.c
+++ b/drivers/net/dsa/mv88e6xxx/serdes.c
@@ -49,11 +49,14 @@ static int mv88e6390_serdes_write(struct mv88e6xxx_chip *chip,
return mv88e6xxx_phy_write(chip, lane, reg_c45, val);
}
-static int mv88e6352_serdes_power_set(struct mv88e6xxx_chip *chip, bool on)
+int mv88e6352_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on)
{
u16 val, new_val;
int err;
+ if (!mv88e6xxx_serdes_get_lane(chip, port))
+ return 0;
+
err = mv88e6352_serdes_read(chip, MII_BMCR, &val);
if (err)
return err;
@@ -90,19 +93,6 @@ static bool mv88e6352_port_has_serdes(struct mv88e6xxx_chip *chip, int port)
return false;
}
-int mv88e6352_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on)
-{
- int err;
-
- if (mv88e6352_port_has_serdes(chip, port)) {
- err = mv88e6352_serdes_power_set(chip, on);
- if (err < 0)
- return err;
- }
-
- return 0;
-}
-
struct mv88e6352_serdes_hw_stat {
char string[ETH_GSTRING_LEN];
int sizeof_stat;