Skip to contentSkip to conversation

Fix backtrace warnings from bad notifier chain calls

PATCH In review Steve Twiss 2 participants 17 messages Mar 5, 2019 – Mar 6, 2019

Subsystems (3)
lore
Share & tools
lore
#1 lore raw

PATCH 1/13 regulator: da9055: Fix notifier mutex lock warning

In reply to Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes f6130be652d0 ("regulator: DA9055 regulator driver")
---
 drivers/regulator/da9055-regulator.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/da9055-regulator.c +2 -0
index 588c3d24..acba42d 100644
@@ -515,8 +515,10 @@ 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;
 }
Signature · 1 line
1.9.3
#10 lore raw

PATCH 10/13 regulator: pv88090: Fix notifier mutex lock warning

In reply to Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes c90456e36d9c ("regulator: pv88090: new regulator driver")
---
 drivers/regulator/pv88090-regulator.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/regulator/pv88090-regulator.c +4 -0
index 7a0c159..b4ff646 100644
@@ -274,9 +274,11 @@ static irqreturn_t pv88090_irq_handler(int irq, void *data)
 	if (reg_val & PV88090_E_VDD_FLT) {
 		for (i = 0; i < PV88090_MAX_REGULATORS; i++) {
 			if (chip->rdev[i] != NULL) {
+			        regulator_lock(chip->rdev[i]);
 				regulator_notifier_call_chain(chip->rdev[i],
 					REGULATOR_EVENT_UNDER_VOLTAGE,
 					NULL);
+			        regulator_unlock(chip->rdev[i]);
 			}
 		}
 
@@ -291,9 +293,11 @@ static irqreturn_t pv88090_irq_handler(int irq, void *data)
 	if (reg_val & PV88090_E_OVER_TEMP) {
 		for (i = 0; i < PV88090_MAX_REGULATORS; i++) {
 			if (chip->rdev[i] != NULL) {
+			        regulator_lock(chip->rdev[i]);
 				regulator_notifier_call_chain(chip->rdev[i],
 					REGULATOR_EVENT_OVER_TEMP,
 					NULL);
+			        regulator_unlock(chip->rdev[i]);
 			}
 		}
 
Signature · 1 line
1.9.3
#13 lore raw

PATCH 12/13 regulator: wm831x isink: Fix notifier mutex lock warning

In reply to Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes d4d6b722e780 ("regulator: Add WM831x ISINK support")
---
 drivers/regulator/wm831x-isink.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/wm831x-isink.c +2 -0
index 6dd891d..11f3511 100644
@@ -140,9 +140,11 @@ static irqreturn_t wm831x_isink_irq(int irq, void *data)
 {
 	struct wm831x_isink *isink = data;
 
+	regulator_lock(isink->regulator);
 	regulator_notifier_call_chain(isink->regulator,
 				      REGULATOR_EVENT_OVER_CURRENT,
 				      NULL);
+	regulator_unlock(isink->regulator);
 
 	return IRQ_HANDLED;
 }
Signature · 1 line
1.9.3
#11 lore raw

PATCH 11/13 regulator: wm831x: Fix notifier mutex lock warning

In reply to Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes e4ee831f949a ("regulator: Add WM831x DC-DC buck convertor support")
---
 drivers/regulator/wm831x-dcdc.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/regulator/wm831x-dcdc.c +4 -0
index 5a5bc4b..4f5461a 100644
@@ -183,9 +183,11 @@ static irqreturn_t wm831x_dcdc_uv_irq(int irq, void *data)
 {
 	struct wm831x_dcdc *dcdc = data;
 
+	regulator_lock(dcdc->regulator);
 	regulator_notifier_call_chain(dcdc->regulator,
 				      REGULATOR_EVENT_UNDER_VOLTAGE,
 				      NULL);
+	regulator_unlock(dcdc->regulator);
 
 	return IRQ_HANDLED;
 }
@@ -194,9 +196,11 @@ static irqreturn_t wm831x_dcdc_oc_irq(int irq, void *data)
 {
 	struct wm831x_dcdc *dcdc = data;
 
+	regulator_lock(dcdc->regulator);
 	regulator_notifier_call_chain(dcdc->regulator,
 				      REGULATOR_EVENT_OVER_CURRENT,
 				      NULL);
+	regulator_unlock(dcdc->regulator);
 
 	return IRQ_HANDLED;
 }
Signature · 1 line
1.9.3
#0 lore raw

cover Fix backtrace warnings from bad notifier chain calls

Hi Mark,

This patch-set fixes a WARN_ON_ONCE() backtrace call caused by not locking the mutex from the function call regulator_notifier_call_chain(). It does this for thirteen regulator drivers by adding a mutex lock surrounding the notifier calls.

This missing mutex lock has been around for a while, but the API I have used used here to fix it (i.e. regulator_lock()/regulator_unlock()) has only been in the kernel since v4.18. Therefore as this fix stands, the patches do not port back very far in kernel history.

Regards,
Steve

Steve Twiss (13):
regulator: da9055: Fix notifier mutex lock warning
regulator: da9062: Fix notifier mutex lock warning
regulator: da9063: Fix notifier mutex lock warning
regulator: da9211: Fix notifier mutex lock warning
regulator: lp8755: Fix notifier mutex lock warning
regulator: ltc3589: Fix notifier mutex lock warning
regulator: ltc3676: Fix notifier mutex lock warning
regulator: pv88060: Fix notifier mutex lock warning
regulator: pv88080: Fix notifier mutex lock warning
regulator: pv88090: Fix notifier mutex lock warning
regulator: wm831x: Fix notifier mutex lock warning
regulator: wm831x isink: Fix notifier mutex lock warning
regulator: wm831x ldo: Fix notifier mutex lock warning

 drivers/regulator/da9055-regulator.c  |  2 ++
 drivers/regulator/da9062-regulator.c  |  2 ++
 drivers/regulator/da9063-regulator.c  |  5 ++++-
 drivers/regulator/da9211-regulator.c  |  4 ++++
 drivers/regulator/lp8755.c            | 15 ++++++++++++---
 drivers/regulator/ltc3589.c           | 10 ++++++++--
 drivers/regulator/ltc3676.c           | 10 ++++++++--
 drivers/regulator/pv88060-regulator.c |  4 ++++
 drivers/regulator/pv88080-regulator.c |  4 ++++
 drivers/regulator/pv88090-regulator.c |  4 ++++
 drivers/regulator/wm831x-dcdc.c       |  4 ++++
 drivers/regulator/wm831x-isink.c      |  2 ++
 drivers/regulator/wm831x-ldo.c        |  2 ++
 13 files changed, 60 insertions(+), 8 deletions(-)
Signature · 1 line
1.9.3
#7 lore raw

PATCH 7/13 regulator: ltc3676: Fix notifier mutex lock warning

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes 37b918a034fe ("regulator: Add LTC3676 support")
---
 drivers/regulator/ltc3676.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/regulator/ltc3676.c +8 -2
index 71fd0f2..cd0f112 100644
@@ -338,17 +338,23 @@ static irqreturn_t ltc3676_isr(int irq, void *dev_id)
 	if (irqstat & LTC3676_IRQSTAT_THERMAL_WARN) {
 		dev_warn(dev, "Over-temperature Warning\n");
 		event = REGULATOR_EVENT_OVER_TEMP;
-		for (i = 0; i < LTC3676_NUM_REGULATORS; i++)
+		for (i = 0; i < LTC3676_NUM_REGULATORS; i++) {
+			regulator_lock(ltc3676->regulators[i]);
 			regulator_notifier_call_chain(ltc3676->regulators[i],
 						      event, NULL);
+			regulator_unlock(ltc3676->regulators[i]);
+		}
 	}
 
 	if (irqstat & LTC3676_IRQSTAT_UNDERVOLT_WARN) {
 		dev_info(dev, "Undervoltage Warning\n");
 		event = REGULATOR_EVENT_UNDER_VOLTAGE;
-		for (i = 0; i < LTC3676_NUM_REGULATORS; i++)
+		for (i = 0; i < LTC3676_NUM_REGULATORS; i++) {
+			regulator_lock(ltc3676->regulators[i]);
 			regulator_notifier_call_chain(ltc3676->regulators[i],
 						      event, NULL);
+			regulator_unlock(ltc3676->regulators[i]);
+		}
 	}
 
 	/* Clear warning condition */
Signature · 1 line
1.9.3
#9 lore raw

PATCH 9/13 regulator: pv88080: Fix notifier mutex lock warning

In reply to Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes 99cf3af5e2d5 ("regulator: pv88080: new regulator driver")
---
 drivers/regulator/pv88080-regulator.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/regulator/pv88080-regulator.c +4 -0
index 9a08cb2..d99f1b9 100644
@@ -384,9 +384,11 @@ static irqreturn_t pv88080_irq_handler(int irq, void *data)
 	if (reg_val & PV88080_E_VDD_FLT) {
 		for (i = 0; i < PV88080_MAX_REGULATORS; i++) {
 			if (chip->rdev[i] != NULL) {
+			        regulator_lock(chip->rdev[i]);
 				regulator_notifier_call_chain(chip->rdev[i],
 					REGULATOR_EVENT_UNDER_VOLTAGE,
 					NULL);
+			        regulator_unlock(chip->rdev[i]);
 			}
 		}
 
@@ -401,9 +403,11 @@ static irqreturn_t pv88080_irq_handler(int irq, void *data)
 	if (reg_val & PV88080_E_OVER_TEMP) {
 		for (i = 0; i < PV88080_MAX_REGULATORS; i++) {
 			if (chip->rdev[i] != NULL) {
+			        regulator_lock(chip->rdev[i]);
 				regulator_notifier_call_chain(chip->rdev[i],
 					REGULATOR_EVENT_OVER_TEMP,
 					NULL);
+			        regulator_unlock(chip->rdev[i]);
 			}
 		}
 
Signature · 1 line
1.9.3
#15 lore raw

PATCH 13/13 regulator: wm831x ldo: Fix notifier mutex lock warning

In reply to Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes d1c6b4fe668b ("regulator: Add WM831x LDO support")
---
 drivers/regulator/wm831x-ldo.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/wm831x-ldo.c +2 -0
index e4a6f88..fcd038e 100644
@@ -51,9 +51,11 @@ static irqreturn_t wm831x_ldo_uv_irq(int irq, void *data)
 {
 	struct wm831x_ldo *ldo = data;
 
+	regulator_lock(ldo->regulator);
 	regulator_notifier_call_chain(ldo->regulator,
 				      REGULATOR_EVENT_UNDER_VOLTAGE,
 				      NULL);
+	regulator_unlock(ldo->regulator);
 
 	return IRQ_HANDLED;
 }
Signature · 1 line
1.9.3
#5 lore raw

PATCH 5/13 regulator: lp8755: Fix notifier mutex lock warning

In reply to Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes b59320cc5a5e ("regulator: lp8755: new driver for LP8755")
---
 drivers/regulator/lp8755.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/regulator/lp8755.c +12 -3
index 244822b..d82d307 100644
@@ -372,10 +372,13 @@ static irqreturn_t lp8755_irq_handler(int irq, void *data)
 	for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
 		if ((flag0 & (0x4 << icnt))
 		    && (pchip->irqmask & (0x04 << icnt))
-		    && (pchip->rdev[icnt] != NULL))
+		    && (pchip->rdev[icnt] != NULL)) {
+			regulator_lock(pchip->rdev[icnt]);
 			regulator_notifier_call_chain(pchip->rdev[icnt],
 						      LP8755_EVENT_PWR_FAULT,
 						      NULL);
+			regulator_unlock(pchip->rdev[icnt]);
+		}
 
 	/* read flag1 register */
 	ret = lp8755_read(pchip, 0x0E, &flag1);
@@ -389,18 +392,24 @@ static irqreturn_t lp8755_irq_handler(int irq, void *data)
 	/* send OCP event to all regualtor devices */
 	if ((flag1 & 0x01) && (pchip->irqmask & 0x01))
 		for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
-			if (pchip->rdev[icnt] != NULL)
+			if (pchip->rdev[icnt] != NULL) {
+				regulator_lock(pchip->rdev[icnt]);
 				regulator_notifier_call_chain(pchip->rdev[icnt],
 							      LP8755_EVENT_OCP,
 							      NULL);
+				regulator_unlock(pchip->rdev[icnt]);
+			}
 
 	/* send OVP event to all regualtor devices */
 	if ((flag1 & 0x02) && (pchip->irqmask & 0x02))
 		for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
-			if (pchip->rdev[icnt] != NULL)
+			if (pchip->rdev[icnt] != NULL) {
+				regulator_lock(pchip->rdev[icnt]);
 				regulator_notifier_call_chain(pchip->rdev[icnt],
 							      LP8755_EVENT_OVP,
 							      NULL);
+				regulator_unlock(pchip->rdev[icnt]);
+			}
 	return IRQ_HANDLED;
 
 err_i2c:
Signature · 1 line
1.9.3
#8 lore raw

PATCH 8/13 regulator: pv88060: Fix notifier mutex lock warning

In reply to Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes f307a7e9b7af ("regulator: pv88060: new regulator driver")
---
 drivers/regulator/pv88060-regulator.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/regulator/pv88060-regulator.c +4 -0
index a944605..000c349 100644
@@ -276,9 +276,11 @@ static irqreturn_t pv88060_irq_handler(int irq, void *data)
 	if (reg_val & PV88060_E_VDD_FLT) {
 		for (i = 0; i < PV88060_MAX_REGULATORS; i++) {
 			if (chip->rdev[i] != NULL) {
+				regulator_lock(chip->rdev[i]);
 				regulator_notifier_call_chain(chip->rdev[i],
 					REGULATOR_EVENT_UNDER_VOLTAGE,
 					NULL);
+				regulator_unlock(chip->rdev[i]);
 			}
 		}
 
@@ -293,9 +295,11 @@ static irqreturn_t pv88060_irq_handler(int irq, void *data)
 	if (reg_val & PV88060_E_OVER_TEMP) {
 		for (i = 0; i < PV88060_MAX_REGULATORS; i++) {
 			if (chip->rdev[i] != NULL) {
+				regulator_lock(chip->rdev[i]);
 				regulator_notifier_call_chain(chip->rdev[i],
 					REGULATOR_EVENT_OVER_TEMP,
 					NULL);
+				regulator_unlock(chip->rdev[i]);
 			}
 		}
 
Signature · 1 line
1.9.3
#4 lore raw

PATCH 4/13 regulator: da9211: Fix notifier mutex lock warning

In reply to Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes 1028a37daa14 ("regulator: da9211: new regulator driver")
---
 drivers/regulator/da9211-regulator.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/regulator/da9211-regulator.c +4 -0
index 109ee12..4d7fe48 100644
@@ -322,8 +322,10 @@ static irqreturn_t da9211_irq_handler(int irq, void *data)
 		goto error_i2c;
 
 	if (reg_val & DA9211_E_OV_CURR_A) {
+	        regulator_lock(chip->rdev[0]);
 		regulator_notifier_call_chain(chip->rdev[0],
 			REGULATOR_EVENT_OVER_CURRENT, NULL);
+	        regulator_unlock(chip->rdev[0]);
 
 		err = regmap_write(chip->regmap, DA9211_REG_EVENT_B,
 			DA9211_E_OV_CURR_A);
@@ -334,8 +336,10 @@ static irqreturn_t da9211_irq_handler(int irq, void *data)
 	}
 
 	if (reg_val & DA9211_E_OV_CURR_B) {
+	        regulator_lock(chip->rdev[1]);
 		regulator_notifier_call_chain(chip->rdev[1],
 			REGULATOR_EVENT_OVER_CURRENT, NULL);
+	        regulator_unlock(chip->rdev[1]);
 
 		err = regmap_write(chip->regmap, DA9211_REG_EVENT_B,
 			DA9211_E_OV_CURR_B);
Signature · 1 line
1.9.3
#3 lore raw

PATCH 3/13 regulator: da9063: Fix notifier mutex lock warning

In reply to Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes 69ca3e58d178 ("regulator: da9063: Add Dialog DA9063 voltage regulators support.")
---
 drivers/regulator/da9063-regulator.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/regulator/da9063-regulator.c +4 -1
index 8cbcd2a..d3ea73a 100644
@@ -615,9 +615,12 @@ static irqreturn_t da9063_ldo_lim_event(int irq, void *data)
 		if (regl->info->oc_event.reg != DA9063_REG_STATUS_D)
 			continue;
 
-		if (BIT(regl->info->oc_event.lsb) & bits)
+		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);
+		}
 	}
 
 	return IRQ_HANDLED;
Signature · 1 line
1.9.3
#2 lore raw

PATCH 2/13 regulator: da9062: Fix notifier mutex lock warning

In reply to Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes 4068e5182ada ("regulator: da9062: DA9062 regulator driver")
---
 drivers/regulator/da9062-regulator.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/da9062-regulator.c +2 -0
index 34a70d9..5224304 100644
@@ -974,8 +974,10 @@ 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;
 		}
 	}
Signature · 1 line
1.9.3
#6 lore raw

PATCH 6/13 regulator: ltc3589: Fix notifier mutex lock warning

In reply to Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Fixes 3eb2c7ecb7ea ("regulator: Add LTC3589 support")
---
 drivers/regulator/ltc3589.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/regulator/ltc3589.c +8 -2
index 63f724f..75089b0 100644
@@ -419,16 +419,22 @@ static irqreturn_t ltc3589_isr(int irq, void *dev_id)
 
 	if (irqstat & LTC3589_IRQSTAT_THERMAL_WARN) {
 		event = REGULATOR_EVENT_OVER_TEMP;
-		for (i = 0; i < LTC3589_NUM_REGULATORS; i++)
+		for (i = 0; i < LTC3589_NUM_REGULATORS; i++) {
+		        regulator_lock(ltc3589->regulators[i]);
 			regulator_notifier_call_chain(ltc3589->regulators[i],
 						      event, NULL);
+		        regulator_unlock(ltc3589->regulators[i]);
+		}
 	}
 
 	if (irqstat & LTC3589_IRQSTAT_UNDERVOLT_WARN) {
 		event = REGULATOR_EVENT_UNDER_VOLTAGE;
-		for (i = 0; i < LTC3589_NUM_REGULATORS; i++)
+		for (i = 0; i < LTC3589_NUM_REGULATORS; i++) {
+		        regulator_lock(ltc3589->regulators[i]);
 			regulator_notifier_call_chain(ltc3589->regulators[i],
 						      event, NULL);
+		        regulator_unlock(ltc3589->regulators[i]);
+		}
 	}
 
 	/* Clear warning condition */
Signature · 1 line
1.9.3
Acked-by on v1 11/13
#12 lore raw

Re: [PATCH 11/13] regulator: wm831x: Fix notifier mutex lock warning

In reply to Steve Twiss
Quoted 9 lines · Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Quoted 4 lines
Fixes e4ee831f949a ("regulator: Add WM831x DC-DC buck convertor support")

---

Thanks,
Charles

Acked-by on v1 12/13
#14 lore raw

Re: [PATCH 12/13] regulator: wm831x isink: Fix notifier mutex lock warning

In reply to Steve Twiss
Quoted 9 lines · Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Quoted 4 lines
Fixes d4d6b722e780 ("regulator: Add WM831x ISINK support")

---

Thanks,
Charles

Acked-by on v1 13/13
#16 lore raw

Re: [PATCH 13/13] regulator: wm831x ldo: Fix notifier mutex lock warning

In reply to Steve Twiss
Quoted 9 lines · Steve Twiss

The mutex for the regulator_dev must be controlled by the caller of the regulator_notifier_call_chain(), as described in the comment for that function.

Failure to mutex lock and unlock surrounding the notifier call results in a kernel WARN_ON_ONCE() which will dump a backtrace for the regulator_notifier_call_chain() when that function call is first made. The mutex can be controlled using the regulator_lock/unlock() API.

Quoted 4 lines
Fixes d1c6b4fe668b ("regulator: Add WM831x LDO support")

---

Thanks,
Charles