diff options
author | Tobias Waldekranz <tobias@waldekranz.com> | 2023-12-14 14:50:22 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-12-15 11:05:02 +0000 |
commit | d624afaf4c792457d5ffa0037156f66cdfc1df18 (patch) | |
tree | ea558c38f5624958d3663859d8289a71106ae372 | |
parent | 9ed816b106bb40be6f1254696c6887e48f2a2b8f (diff) | |
download | lwn-d624afaf4c792457d5ffa0037156f66cdfc1df18.tar.gz lwn-d624afaf4c792457d5ffa0037156f66cdfc1df18.zip |
net: dsa: mv88e6xxx: Push locking into stats snapshotting
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>
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/chip.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 07a22c74fe81..4bd3ceffde17 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -943,10 +943,16 @@ error: 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[] = { @@ -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) |