diff options
author | Andrew Lunn <andrew@lunn.ch> | 2015-04-02 05:06:36 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-02 05:55:40 +0300 |
commit | fd3a0ee4063e4f44d915df8f117d9e0d8b05950a (patch) | |
tree | 4852b462842e2e06bfccd0f16b817affb48f6d91 /drivers/net/dsa/mv88e6171.c | |
parent | 4914358567d81d6f1d95f7809c77658c55555f1c (diff) | |
download | linux-fd3a0ee4063e4f44d915df8f117d9e0d8b05950a.tar.xz |
net: dsa: Consolidate phy read and write functions
Move the common code for reading and writing phy registers into the
shared mv88e6xxx.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6171.c')
-rw-r--r-- | drivers/net/dsa/mv88e6171.c | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c index 69b35d124de5..4d6038991a59 100644 --- a/drivers/net/dsa/mv88e6171.c +++ b/drivers/net/dsa/mv88e6171.c @@ -258,42 +258,6 @@ static int mv88e6171_setup(struct dsa_switch *ds) return 0; } -static int mv88e6171_port_to_phy_addr(struct dsa_switch *ds, int port) -{ - struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); - - if (port >= 0 && port < ps->num_ports) - return port; - return -1; -} - -static int -mv88e6171_phy_read(struct dsa_switch *ds, int port, int regnum) -{ - struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); - int addr = mv88e6171_port_to_phy_addr(ds, port); - int ret; - - mutex_lock(&ps->phy_mutex); - ret = mv88e6xxx_phy_read_indirect(ds, addr, regnum); - mutex_unlock(&ps->phy_mutex); - return ret; -} - -static int -mv88e6171_phy_write(struct dsa_switch *ds, - int port, int regnum, u16 val) -{ - struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); - int addr = mv88e6171_port_to_phy_addr(ds, port); - int ret; - - mutex_lock(&ps->phy_mutex); - ret = mv88e6xxx_phy_write_indirect(ds, addr, regnum, val); - mutex_unlock(&ps->phy_mutex); - return ret; -} - static struct mv88e6xxx_hw_stat mv88e6171_hw_stats[] = { { "in_good_octets", 8, 0x00, }, { "in_bad_octets", 4, 0x02, }, @@ -375,8 +339,8 @@ struct dsa_switch_driver mv88e6171_switch_driver = { .probe = mv88e6171_probe, .setup = mv88e6171_setup, .set_addr = mv88e6xxx_set_addr_indirect, - .phy_read = mv88e6171_phy_read, - .phy_write = mv88e6171_phy_write, + .phy_read = mv88e6xxx_phy_read_indirect, + .phy_write = mv88e6xxx_phy_write_indirect, .poll_link = mv88e6xxx_poll_link, .get_strings = mv88e6171_get_strings, .get_ethtool_stats = mv88e6171_get_ethtool_stats, |