Commit 774439e5 authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: dsa: mv888e6xxx: do not use netdev printing

The mv888e6xxx driver accesses a port's netdev mostly for printing.

This is bad for 2 reasons: DSA and CPU ports do not have a netdev
pointer; it doesn't give us a correct picture of why a DSA driver might
need to access a port's netdev.

Instead simply use dev_* printing functions with chip->dev (or ds->dev
depending on the scope, both guaranteed to exist), with a p%d prefix for
the target port.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fff88030
...@@ -489,8 +489,7 @@ static int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port, ...@@ -489,8 +489,7 @@ static int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port,
err = 0; err = 0;
restore_link: restore_link:
if (chip->info->ops->port_set_link(chip, port, link)) if (chip->info->ops->port_set_link(chip, port, link))
netdev_err(chip->ds->ports[port].netdev, dev_err(chip->dev, "p%d: failed to restore MAC's link\n", port);
"failed to restore MAC's link\n");
return err; return err;
} }
...@@ -514,7 +513,7 @@ static void mv88e6xxx_adjust_link(struct dsa_switch *ds, int port, ...@@ -514,7 +513,7 @@ static void mv88e6xxx_adjust_link(struct dsa_switch *ds, int port,
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
if (err && err != -EOPNOTSUPP) if (err && err != -EOPNOTSUPP)
netdev_err(ds->ports[port].netdev, "failed to configure MAC\n"); dev_err(ds->dev, "p%d: failed to configure MAC\n", port);
} }
static int mv88e6xxx_stats_snapshot(struct mv88e6xxx_chip *chip, int port) static int mv88e6xxx_stats_snapshot(struct mv88e6xxx_chip *chip, int port)
...@@ -941,7 +940,7 @@ static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port, ...@@ -941,7 +940,7 @@ static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port,
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
if (err) if (err)
netdev_err(ds->ports[port].netdev, "failed to update state\n"); dev_err(ds->dev, "p%d: failed to update state\n", port);
} }
static int mv88e6xxx_atu_setup(struct mv88e6xxx_chip *chip) static int mv88e6xxx_atu_setup(struct mv88e6xxx_chip *chip)
...@@ -1009,7 +1008,7 @@ static void mv88e6xxx_port_fast_age(struct dsa_switch *ds, int port) ...@@ -1009,7 +1008,7 @@ static void mv88e6xxx_port_fast_age(struct dsa_switch *ds, int port)
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
if (err) if (err)
netdev_err(ds->ports[port].netdev, "failed to flush ATU\n"); dev_err(ds->dev, "p%d: failed to flush ATU\n", port);
} }
static int mv88e6xxx_vtu_setup(struct mv88e6xxx_chip *chip) static int mv88e6xxx_vtu_setup(struct mv88e6xxx_chip *chip)
...@@ -1214,9 +1213,8 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port, ...@@ -1214,9 +1213,8 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port,
if (!ds->ports[i].bridge_dev) if (!ds->ports[i].bridge_dev)
continue; continue;
netdev_warn(ds->ports[port].netdev, dev_err(ds->dev, "p%d: hw VLAN %d already used by %s\n",
"hardware VLAN %d already used by %s\n", port, vlan.vid,
vlan.vid,
netdev_name(ds->ports[i].bridge_dev)); netdev_name(ds->ports[i].bridge_dev));
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto unlock; goto unlock;
...@@ -1311,12 +1309,11 @@ static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port, ...@@ -1311,12 +1309,11 @@ static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port,
for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid)
if (_mv88e6xxx_port_vlan_add(chip, port, vid, member)) if (_mv88e6xxx_port_vlan_add(chip, port, vid, member))
netdev_err(ds->ports[port].netdev, dev_err(ds->dev, "p%d: failed to add VLAN %d%c\n", port,
"failed to add VLAN %d%c\n",
vid, untagged ? 'u' : 't'); vid, untagged ? 'u' : 't');
if (pvid && mv88e6xxx_port_set_pvid(chip, port, vlan->vid_end)) if (pvid && mv88e6xxx_port_set_pvid(chip, port, vlan->vid_end))
netdev_err(ds->ports[port].netdev, "failed to set PVID %d\n", dev_err(ds->dev, "p%d: failed to set PVID %d\n", port,
vlan->vid_end); vlan->vid_end);
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
...@@ -1451,7 +1448,8 @@ static void mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port, ...@@ -1451,7 +1448,8 @@ static void mv88e6xxx_port_fdb_add(struct dsa_switch *ds, int port,
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
if (mv88e6xxx_port_db_load_purge(chip, port, fdb->addr, fdb->vid, if (mv88e6xxx_port_db_load_purge(chip, port, fdb->addr, fdb->vid,
GLOBAL_ATU_DATA_STATE_UC_STATIC)) GLOBAL_ATU_DATA_STATE_UC_STATIC))
netdev_err(ds->ports[port].netdev, "failed to load unicast MAC address\n"); dev_err(ds->dev, "p%d: failed to load unicast MAC address\n",
port);
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
} }
...@@ -3793,7 +3791,8 @@ static void mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port, ...@@ -3793,7 +3791,8 @@ static void mv88e6xxx_port_mdb_add(struct dsa_switch *ds, int port,
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
if (mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, if (mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid,
GLOBAL_ATU_DATA_STATE_MC_STATIC)) GLOBAL_ATU_DATA_STATE_MC_STATIC))
netdev_err(ds->ports[port].netdev, "failed to load multicast MAC address\n"); dev_err(ds->dev, "p%d: failed to load multicast MAC address\n",
port);
mutex_unlock(&chip->reg_lock); mutex_unlock(&chip->reg_lock);
} }
......
...@@ -76,7 +76,7 @@ static int mv88e6xxx_port_set_rgmii_delay(struct mv88e6xxx_chip *chip, int port, ...@@ -76,7 +76,7 @@ static int mv88e6xxx_port_set_rgmii_delay(struct mv88e6xxx_chip *chip, int port,
if (err) if (err)
return err; return err;
netdev_dbg(chip->ds->ports[port].netdev, "delay RXCLK %s, TXCLK %s\n", dev_dbg(chip->dev, "p%d: delay RXCLK %s, TXCLK %s\n", port,
reg & PORT_PCS_CTRL_RGMII_DELAY_RXCLK ? "yes" : "no", reg & PORT_PCS_CTRL_RGMII_DELAY_RXCLK ? "yes" : "no",
reg & PORT_PCS_CTRL_RGMII_DELAY_TXCLK ? "yes" : "no"); reg & PORT_PCS_CTRL_RGMII_DELAY_TXCLK ? "yes" : "no");
...@@ -130,7 +130,7 @@ int mv88e6xxx_port_set_link(struct mv88e6xxx_chip *chip, int port, int link) ...@@ -130,7 +130,7 @@ int mv88e6xxx_port_set_link(struct mv88e6xxx_chip *chip, int port, int link)
if (err) if (err)
return err; return err;
netdev_dbg(chip->ds->ports[port].netdev, "%s link %s\n", dev_dbg(chip->dev, "p%d: %s link %s\n", port,
reg & PORT_PCS_CTRL_FORCE_LINK ? "Force" : "Unforce", reg & PORT_PCS_CTRL_FORCE_LINK ? "Force" : "Unforce",
reg & PORT_PCS_CTRL_LINK_UP ? "up" : "down"); reg & PORT_PCS_CTRL_LINK_UP ? "up" : "down");
...@@ -166,7 +166,7 @@ int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup) ...@@ -166,7 +166,7 @@ int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup)
if (err) if (err)
return err; return err;
netdev_dbg(chip->ds->ports[port].netdev, "%s %s duplex\n", dev_dbg(chip->dev, "p%d: %s %s duplex\n", port,
reg & PORT_PCS_CTRL_FORCE_DUPLEX ? "Force" : "Unforce", reg & PORT_PCS_CTRL_FORCE_DUPLEX ? "Force" : "Unforce",
reg & PORT_PCS_CTRL_DUPLEX_FULL ? "full" : "half"); reg & PORT_PCS_CTRL_DUPLEX_FULL ? "full" : "half");
...@@ -226,10 +226,9 @@ static int mv88e6xxx_port_set_speed(struct mv88e6xxx_chip *chip, int port, ...@@ -226,10 +226,9 @@ static int mv88e6xxx_port_set_speed(struct mv88e6xxx_chip *chip, int port,
return err; return err;
if (speed) if (speed)
netdev_dbg(chip->ds->ports[port].netdev, dev_dbg(chip->dev, "p%d: Speed set to %d Mbps\n", port, speed);
"Speed set to %d Mbps\n", speed);
else else
netdev_dbg(chip->ds->ports[port].netdev, "Speed unforced\n"); dev_dbg(chip->dev, "p%d: Speed unforced\n", port);
return 0; return 0;
} }
...@@ -419,7 +418,7 @@ int mv88e6xxx_port_set_state(struct mv88e6xxx_chip *chip, int port, u8 state) ...@@ -419,7 +418,7 @@ int mv88e6xxx_port_set_state(struct mv88e6xxx_chip *chip, int port, u8 state)
if (err) if (err)
return err; return err;
netdev_dbg(chip->ds->ports[port].netdev, "PortState set to %s\n", dev_dbg(chip->dev, "p%d: PortState set to %s\n", port,
mv88e6xxx_port_state_names[state]); mv88e6xxx_port_state_names[state]);
return 0; return 0;
...@@ -580,8 +579,7 @@ int mv88e6xxx_port_set_vlan_map(struct mv88e6xxx_chip *chip, int port, u16 map) ...@@ -580,8 +579,7 @@ int mv88e6xxx_port_set_vlan_map(struct mv88e6xxx_chip *chip, int port, u16 map)
if (err) if (err)
return err; return err;
netdev_dbg(chip->ds->ports[port].netdev, "VLANTable set to %.3x\n", dev_dbg(chip->dev, "p%d: VLANTable set to %.3x\n", port, map);
map);
return 0; return 0;
} }
...@@ -646,7 +644,7 @@ int mv88e6xxx_port_set_fid(struct mv88e6xxx_chip *chip, int port, u16 fid) ...@@ -646,7 +644,7 @@ int mv88e6xxx_port_set_fid(struct mv88e6xxx_chip *chip, int port, u16 fid)
return err; return err;
} }
netdev_dbg(chip->ds->ports[port].netdev, "FID set to %u\n", fid); dev_dbg(chip->dev, "p%d: FID set to %u\n", port, fid);
return 0; return 0;
} }
...@@ -683,8 +681,7 @@ int mv88e6xxx_port_set_pvid(struct mv88e6xxx_chip *chip, int port, u16 pvid) ...@@ -683,8 +681,7 @@ int mv88e6xxx_port_set_pvid(struct mv88e6xxx_chip *chip, int port, u16 pvid)
if (err) if (err)
return err; return err;
netdev_dbg(chip->ds->ports[port].netdev, "DefaultVID set to %u\n", dev_dbg(chip->dev, "p%d: DefaultVID set to %u\n", port, pvid);
pvid);
return 0; return 0;
} }
...@@ -761,7 +758,7 @@ int mv88e6xxx_port_set_8021q_mode(struct mv88e6xxx_chip *chip, int port, ...@@ -761,7 +758,7 @@ int mv88e6xxx_port_set_8021q_mode(struct mv88e6xxx_chip *chip, int port,
if (err) if (err)
return err; return err;
netdev_dbg(chip->ds->ports[port].netdev, "802.1QMode set to %s\n", dev_dbg(chip->dev, "p%d: 802.1QMode set to %s\n", port,
mv88e6xxx_port_8021q_mode_names[mode]); mv88e6xxx_port_8021q_mode_names[mode]);
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