net: dsa: mv88e6xxx: introduce helpers for handling chip->reg_lock
This is a no-op that simply moves all locking and unlocking of ->reg_lock into trivial helpers. I did that to be able to easily add some ad hoc instrumentation to those helpers to get some information on contention and hold times of the mutex. Perhaps others want to do something similar at some point, so this frees them from doing the 'sed -i' yoga, and have a much smaller 'git diff' while fiddling. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
3e5bfb189e
commit
c9acece064
@@ -893,20 +893,20 @@ static irqreturn_t mv88e6xxx_g2_watchdog_thread_fn(int irq, void *dev_id)
|
||||
struct mv88e6xxx_chip *chip = dev_id;
|
||||
irqreturn_t ret = IRQ_NONE;
|
||||
|
||||
mutex_lock(&chip->reg_lock);
|
||||
mv88e6xxx_reg_lock(chip);
|
||||
if (chip->info->ops->watchdog_ops->irq_action)
|
||||
ret = chip->info->ops->watchdog_ops->irq_action(chip, irq);
|
||||
mutex_unlock(&chip->reg_lock);
|
||||
mv88e6xxx_reg_unlock(chip);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void mv88e6xxx_g2_watchdog_free(struct mv88e6xxx_chip *chip)
|
||||
{
|
||||
mutex_lock(&chip->reg_lock);
|
||||
mv88e6xxx_reg_lock(chip);
|
||||
if (chip->info->ops->watchdog_ops->irq_free)
|
||||
chip->info->ops->watchdog_ops->irq_free(chip);
|
||||
mutex_unlock(&chip->reg_lock);
|
||||
mv88e6xxx_reg_unlock(chip);
|
||||
|
||||
free_irq(chip->watchdog_irq, chip);
|
||||
irq_dispose_mapping(chip->watchdog_irq);
|
||||
@@ -928,10 +928,10 @@ static int mv88e6xxx_g2_watchdog_setup(struct mv88e6xxx_chip *chip)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
mutex_lock(&chip->reg_lock);
|
||||
mv88e6xxx_reg_lock(chip);
|
||||
if (chip->info->ops->watchdog_ops->irq_setup)
|
||||
err = chip->info->ops->watchdog_ops->irq_setup(chip);
|
||||
mutex_unlock(&chip->reg_lock);
|
||||
mv88e6xxx_reg_unlock(chip);
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -986,9 +986,9 @@ static irqreturn_t mv88e6xxx_g2_irq_thread_fn(int irq, void *dev_id)
|
||||
int err;
|
||||
u16 reg;
|
||||
|
||||
mutex_lock(&chip->reg_lock);
|
||||
mv88e6xxx_reg_lock(chip);
|
||||
err = mv88e6xxx_g2_int_source(chip, ®);
|
||||
mutex_unlock(&chip->reg_lock);
|
||||
mv88e6xxx_reg_unlock(chip);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
@@ -1007,7 +1007,7 @@ static void mv88e6xxx_g2_irq_bus_lock(struct irq_data *d)
|
||||
{
|
||||
struct mv88e6xxx_chip *chip = irq_data_get_irq_chip_data(d);
|
||||
|
||||
mutex_lock(&chip->reg_lock);
|
||||
mv88e6xxx_reg_lock(chip);
|
||||
}
|
||||
|
||||
static void mv88e6xxx_g2_irq_bus_sync_unlock(struct irq_data *d)
|
||||
@@ -1019,7 +1019,7 @@ static void mv88e6xxx_g2_irq_bus_sync_unlock(struct irq_data *d)
|
||||
if (err)
|
||||
dev_err(chip->dev, "failed to mask interrupts\n");
|
||||
|
||||
mutex_unlock(&chip->reg_lock);
|
||||
mv88e6xxx_reg_unlock(chip);
|
||||
}
|
||||
|
||||
static const struct irq_chip mv88e6xxx_g2_irq_chip = {
|
||||
|
Reference in New Issue
Block a user