Skip to content

Commit e52cde7

Browse files
ffainellidavem330
authored andcommitted
net: dsa: dsa_loop: Make dynamic debugging helpful
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>
1 parent 910714f commit e52cde7

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

drivers/net/dsa/dsa_loop.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static struct phy_device *phydevs[PHY_MAX_ADDR];
6767
static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds,
6868
int port)
6969
{
70-
dev_dbg(ds->dev, "%s\n", __func__);
70+
dev_dbg(ds->dev, "%s: port: %d\n", __func__, port);
7171

7272
return DSA_TAG_PROTO_NONE;
7373
}
@@ -124,8 +124,6 @@ static int dsa_loop_phy_read(struct dsa_switch *ds, int port, int regnum)
124124
struct mii_bus *bus = ps->bus;
125125
int ret;
126126

127-
dev_dbg(ds->dev, "%s\n", __func__);
128-
129127
ret = mdiobus_read_nested(bus, ps->port_base + port, regnum);
130128
if (ret < 0)
131129
ps->ports[port].mib[DSA_LOOP_PHY_READ_ERR].val++;
@@ -142,8 +140,6 @@ static int dsa_loop_phy_write(struct dsa_switch *ds, int port,
142140
struct mii_bus *bus = ps->bus;
143141
int ret;
144142

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

161158
return 0;
162159
}
163160

164161
static void dsa_loop_port_bridge_leave(struct dsa_switch *ds, int port,
165162
struct net_device *bridge)
166163
{
167-
dev_dbg(ds->dev, "%s\n", __func__);
164+
dev_dbg(ds->dev, "%s: port: %d, bridge: %s\n",
165+
__func__, port, bridge->name);
168166
}
169167

170168
static void dsa_loop_port_stp_state_set(struct dsa_switch *ds, int port,
171169
u8 state)
172170
{
173-
dev_dbg(ds->dev, "%s\n", __func__);
171+
dev_dbg(ds->dev, "%s: port: %d, state: %d\n",
172+
__func__, port, state);
174173
}
175174

176175
static int dsa_loop_port_vlan_filtering(struct dsa_switch *ds, int port,
177176
bool vlan_filtering)
178177
{
179-
dev_dbg(ds->dev, "%s\n", __func__);
178+
dev_dbg(ds->dev, "%s: port: %d, vlan_filtering: %d\n",
179+
__func__, port, vlan_filtering);
180180

181181
return 0;
182182
}
@@ -188,7 +188,8 @@ dsa_loop_port_vlan_prepare(struct dsa_switch *ds, int port,
188188
struct dsa_loop_priv *ps = ds->priv;
189189
struct mii_bus *bus = ps->bus;
190190

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

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

212-
dev_dbg(ds->dev, "%s\n", __func__);
213-
214213
/* Just do a sleeping operation to make lockdep checks effective */
215214
mdiobus_read(bus, ps->port_base + port, MII_BMSR);
216215

@@ -222,6 +221,9 @@ static void dsa_loop_port_vlan_add(struct dsa_switch *ds, int port,
222221
vl->untagged |= BIT(port);
223222
else
224223
vl->untagged &= ~BIT(port);
224+
225+
dev_dbg(ds->dev, "%s: port: %d vlan: %d, %stagged, pvid: %d\n",
226+
__func__, port, vid, untagged ? "un" : "", pvid);
225227
}
226228

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

240-
dev_dbg(ds->dev, "%s\n", __func__);
241-
242242
/* Just do a sleeping operation to make lockdep checks effective */
243243
mdiobus_read(bus, ps->port_base + port, MII_BMSR);
244244

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

252252
if (pvid == vid)
253253
pvid = 1;
254+
255+
dev_dbg(ds->dev, "%s: port: %d vlan: %d, %stagged, pvid: %d\n",
256+
__func__, port, vid, untagged ? "un" : "", pvid);
254257
}
255258
ps->pvid = pvid;
256259

0 commit comments

Comments
 (0)