Skip to content

Commit

Permalink
net: dsa: mv88e6xxx: Push locking into stats snapshotting
Browse files Browse the repository at this point in the history
This is more consistent with the driver's general structure.

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tobias Waldekranz authored and David S. Miller committed Dec 15, 2023
1 parent 9ed816b commit d624afa
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/net/dsa/mv88e6xxx/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,10 +943,16 @@ static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port,

static int mv88e6xxx_stats_snapshot(struct mv88e6xxx_chip *chip, int port)
{
int err;

if (!chip->info->ops->stats_snapshot)
return -EOPNOTSUPP;

return chip->info->ops->stats_snapshot(chip, port);
mv88e6xxx_reg_lock(chip);
err = chip->info->ops->stats_snapshot(chip, port);
mv88e6xxx_reg_unlock(chip);

return err;
}

static struct mv88e6xxx_hw_stat mv88e6xxx_hw_stats[] = {
Expand Down Expand Up @@ -1284,16 +1290,11 @@ static void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port,
struct mv88e6xxx_chip *chip = ds->priv;
int ret;

mv88e6xxx_reg_lock(chip);

ret = mv88e6xxx_stats_snapshot(chip, port);
mv88e6xxx_reg_unlock(chip);

if (ret < 0)
return;

mv88e6xxx_get_stats(chip, port, data);

}

static int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port)
Expand Down

0 comments on commit d624afa

Please sign in to comment.