Skip to content

Commit

Permalink
net: dsa: dsa_loop: Make dynamic debugging helpful
Browse files Browse the repository at this point in the history
Remove redundant debug prints from phy_read/write since we can trace those
calls through trace events. Enhance dynamic debug prints to print arguments
which helps figuring how what is going on at the driver level with higher level
configuration interfaces.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed May 25, 2018
1 parent 910714f commit e52cde7
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions drivers/net/dsa/dsa_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static struct phy_device *phydevs[PHY_MAX_ADDR];
static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds,
int port)
{
dev_dbg(ds->dev, "%s\n", __func__);
dev_dbg(ds->dev, "%s: port: %d\n", __func__, port);

return DSA_TAG_PROTO_NONE;
}
Expand Down Expand Up @@ -124,8 +124,6 @@ static int dsa_loop_phy_read(struct dsa_switch *ds, int port, int regnum)
struct mii_bus *bus = ps->bus;
int ret;

dev_dbg(ds->dev, "%s\n", __func__);

ret = mdiobus_read_nested(bus, ps->port_base + port, regnum);
if (ret < 0)
ps->ports[port].mib[DSA_LOOP_PHY_READ_ERR].val++;
Expand All @@ -142,8 +140,6 @@ static int dsa_loop_phy_write(struct dsa_switch *ds, int port,
struct mii_bus *bus = ps->bus;
int ret;

dev_dbg(ds->dev, "%s\n", __func__);

ret = mdiobus_write_nested(bus, ps->port_base + port, regnum, value);
if (ret < 0)
ps->ports[port].mib[DSA_LOOP_PHY_WRITE_ERR].val++;
Expand All @@ -156,27 +152,31 @@ static int dsa_loop_phy_write(struct dsa_switch *ds, int port,
static int dsa_loop_port_bridge_join(struct dsa_switch *ds, int port,
struct net_device *bridge)
{
dev_dbg(ds->dev, "%s\n", __func__);
dev_dbg(ds->dev, "%s: port: %d, bridge: %s\n",
__func__, port, bridge->name);

return 0;
}

static void dsa_loop_port_bridge_leave(struct dsa_switch *ds, int port,
struct net_device *bridge)
{
dev_dbg(ds->dev, "%s\n", __func__);
dev_dbg(ds->dev, "%s: port: %d, bridge: %s\n",
__func__, port, bridge->name);
}

static void dsa_loop_port_stp_state_set(struct dsa_switch *ds, int port,
u8 state)
{
dev_dbg(ds->dev, "%s\n", __func__);
dev_dbg(ds->dev, "%s: port: %d, state: %d\n",
__func__, port, state);
}

static int dsa_loop_port_vlan_filtering(struct dsa_switch *ds, int port,
bool vlan_filtering)
{
dev_dbg(ds->dev, "%s\n", __func__);
dev_dbg(ds->dev, "%s: port: %d, vlan_filtering: %d\n",
__func__, port, vlan_filtering);

return 0;
}
Expand All @@ -188,7 +188,8 @@ dsa_loop_port_vlan_prepare(struct dsa_switch *ds, int port,
struct dsa_loop_priv *ps = ds->priv;
struct mii_bus *bus = ps->bus;

dev_dbg(ds->dev, "%s\n", __func__);
dev_dbg(ds->dev, "%s: port: %d, vlan: %d-%d",
__func__, port, vlan->vid_begin, vlan->vid_end);

/* Just do a sleeping operation to make lockdep checks effective */
mdiobus_read(bus, ps->port_base + port, MII_BMSR);
Expand All @@ -209,8 +210,6 @@ static void dsa_loop_port_vlan_add(struct dsa_switch *ds, int port,
struct dsa_loop_vlan *vl;
u16 vid;

dev_dbg(ds->dev, "%s\n", __func__);

/* Just do a sleeping operation to make lockdep checks effective */
mdiobus_read(bus, ps->port_base + port, MII_BMSR);

Expand All @@ -222,6 +221,9 @@ static void dsa_loop_port_vlan_add(struct dsa_switch *ds, int port,
vl->untagged |= BIT(port);
else
vl->untagged &= ~BIT(port);

dev_dbg(ds->dev, "%s: port: %d vlan: %d, %stagged, pvid: %d\n",
__func__, port, vid, untagged ? "un" : "", pvid);
}

if (pvid)
Expand All @@ -237,8 +239,6 @@ static int dsa_loop_port_vlan_del(struct dsa_switch *ds, int port,
struct dsa_loop_vlan *vl;
u16 vid, pvid = ps->pvid;

dev_dbg(ds->dev, "%s\n", __func__);

/* Just do a sleeping operation to make lockdep checks effective */
mdiobus_read(bus, ps->port_base + port, MII_BMSR);

Expand All @@ -251,6 +251,9 @@ static int dsa_loop_port_vlan_del(struct dsa_switch *ds, int port,

if (pvid == vid)
pvid = 1;

dev_dbg(ds->dev, "%s: port: %d vlan: %d, %stagged, pvid: %d\n",
__func__, port, vid, untagged ? "un" : "", pvid);
}
ps->pvid = pvid;

Expand Down

0 comments on commit e52cde7

Please sign in to comment.