Skip to content

Commit d624afa

Browse files
wkzdavem330
authored andcommitted
net: dsa: mv88e6xxx: Push locking into stats snapshotting
This is more consistent with the driver's general structure. Reviewed-by: Vladimir Oltean <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: Tobias Waldekranz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9ed816b commit d624afa

File tree

1 file changed

+7
-6
lines changed
  • drivers/net/dsa/mv88e6xxx

1 file changed

+7
-6
lines changed

drivers/net/dsa/mv88e6xxx/chip.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -943,10 +943,16 @@ static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port,
943943

944944
static int mv88e6xxx_stats_snapshot(struct mv88e6xxx_chip *chip, int port)
945945
{
946+
int err;
947+
946948
if (!chip->info->ops->stats_snapshot)
947949
return -EOPNOTSUPP;
948950

949-
return chip->info->ops->stats_snapshot(chip, port);
951+
mv88e6xxx_reg_lock(chip);
952+
err = chip->info->ops->stats_snapshot(chip, port);
953+
mv88e6xxx_reg_unlock(chip);
954+
955+
return err;
950956
}
951957

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

1287-
mv88e6xxx_reg_lock(chip);
1288-
12891293
ret = mv88e6xxx_stats_snapshot(chip, port);
1290-
mv88e6xxx_reg_unlock(chip);
1291-
12921294
if (ret < 0)
12931295
return;
12941296

12951297
mv88e6xxx_get_stats(chip, port, data);
1296-
12971298
}
12981299

12991300
static int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port)

0 commit comments

Comments
 (0)