Unverified Commit 567444fb authored by Mark Brown's avatar Mark Brown
Browse files

Merge series "regulator: unexport regulator_lock/unlock()" from Michał...

Merge series "regulator: unexport regulator_lock/unlock()" from Michał Mirosław <mirq-linux@rere.qmqm.pl>:

This removes regulator_lock/unlock() calls around
regulator_notifier_call_chain() as they are redundant - drivers
already have to guarantee regulator_dev's existence during the call.

This should make reasoing about the lock easier, as this was the only
use outside regulator core code.

The only client that needed recursive locking from the notifier chain
was drivers/usb/host/ohci-da8xx.c, which responds to over-current
notification by calling regulator_disable().

Michał Mirosław (3):
  regulator: don't require mutex for regulator_notifier_call_chain()
  regulator: remove locking around regulator_notifier_call_chain()
  regulator: unexport regulator_lock/unlock()

 drivers/regulator/core.c               | 11 +++--------
 drivers/regulator/da9055-regulator.c   |  2 --
 drivers/regulator/da9062-regulator.c   |  2 --
 drivers/regulator/da9063-regulator.c   |  2 --
 drivers/regulator/da9210-regulator.c   |  4 ----
 drivers/regulator/da9211-regulator.c   |  4 ----
 drivers/regulator/lp8755.c             |  6 ------
 drivers/regulator/ltc3589.c            | 10 ++--------
 drivers/regulator/ltc3676.c            | 10 ++--------
 drivers/regulator/pv88060-regulator.c  | 10 ++--------
 drivers/regulator/pv88080-regulator.c  | 10 ++--------
 drivers/regulator/pv88090-regulator.c  | 10 ++--------
 drivers/regulator/slg51000-regulator.c |  4 ----
 drivers/regulator/stpmic1_regulator.c  |  4 ----
 drivers/regulator/wm831x-dcdc.c        |  4 ----
 drivers/regulator/wm831x-isink.c       |  2 --
 drivers/regulator/wm831x-ldo.c         |  2 --
 drivers/regulator/wm8350-regulator.c   |  2 --
 include/linux/regulator/driver.h       |  3 ---
 19 files changed, 13 insertions(+), 89 deletions(-)

--
2.20.1
parents 6dc9674d e9c142b0
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -4725,14 +4725,11 @@ EXPORT_SYMBOL_GPL(regulator_bulk_free);
 * @data: callback-specific data.
 *
 * Called by regulator drivers to notify clients a regulator event has
 * occurred. We also notify regulator clients downstream.
 * Note lock must be held by caller.
 * occurred.
 */
int regulator_notifier_call_chain(struct regulator_dev *rdev,
				  unsigned long event, void *data)
{
	lockdep_assert_held_once(&rdev->mutex.base);

	_notifier_call_chain(rdev, event, data);
	return NOTIFY_DONE;

+0 −2
Original line number Diff line number Diff line
@@ -485,10 +485,8 @@ static irqreturn_t da9055_ldo5_6_oc_irq(int irq, void *data)
{
	struct da9055_regulator *regulator = data;

	regulator_lock(regulator->rdev);
	regulator_notifier_call_chain(regulator->rdev,
				      REGULATOR_EVENT_OVER_CURRENT, NULL);
	regulator_unlock(regulator->rdev);

	return IRQ_HANDLED;
}
+0 −2
Original line number Diff line number Diff line
@@ -907,10 +907,8 @@ static irqreturn_t da9062_ldo_lim_event(int irq, void *data)
			continue;

		if (BIT(regl->info->oc_event.lsb) & bits) {
			regulator_lock(regl->rdev);
			regulator_notifier_call_chain(regl->rdev,
					REGULATOR_EVENT_OVER_CURRENT, NULL);
			regulator_unlock(regl->rdev);
			handled = IRQ_HANDLED;
		}
	}
+0 −2
Original line number Diff line number Diff line
@@ -574,10 +574,8 @@ static irqreturn_t da9063_ldo_lim_event(int irq, void *data)
			continue;

		if (BIT(regl->info->oc_event.lsb) & bits) {
			regulator_lock(regl->rdev);
			regulator_notifier_call_chain(regl->rdev,
					REGULATOR_EVENT_OVER_CURRENT, NULL);
			regulator_unlock(regl->rdev);
		}
	}

+0 −4
Original line number Diff line number Diff line
@@ -77,8 +77,6 @@ static irqreturn_t da9210_irq_handler(int irq, void *data)
	if (error < 0)
		goto error_i2c;

	regulator_lock(chip->rdev);

	if (val & DA9210_E_OVCURR) {
		regulator_notifier_call_chain(chip->rdev,
					      REGULATOR_EVENT_OVER_CURRENT,
@@ -103,8 +101,6 @@ static irqreturn_t da9210_irq_handler(int irq, void *data)
		handled |= DA9210_E_VMAX;
	}

	regulator_unlock(chip->rdev);

	if (handled) {
		/* Clear handled events */
		error = regmap_write(chip->regmap, DA9210_REG_EVENT_B, handled);
Loading