linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/13] regulator: da9055: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
@ 2019-02-26 14:59 ` Steve Twiss
  2019-02-26 15:19 ` [PATCH 02/13] regulator: da9062: " Steve Twiss
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 14:59 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML

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")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/da9055-regulator.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/da9055-regulator.c b/drivers/regulator/da9055-regulator.c
index 588c3d24..acba42d 100644
--- a/drivers/regulator/da9055-regulator.c
+++ b/drivers/regulator/da9055-regulator.c
@@ -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;
 }
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 02/13] regulator: da9062: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
  2019-02-26 14:59 ` [PATCH 01/13] regulator: da9055: Fix notifier mutex lock warning Steve Twiss
@ 2019-02-26 15:19 ` Steve Twiss
  2019-02-26 15:23 ` [PATCH 03/13] regulator: da9063: " Steve Twiss
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 15:19 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML

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")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/da9062-regulator.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c
index 34a70d9..5224304 100644
--- a/drivers/regulator/da9062-regulator.c
+++ b/drivers/regulator/da9062-regulator.c
@@ -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;
 		}
 	}
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 03/13] regulator: da9063: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
  2019-02-26 14:59 ` [PATCH 01/13] regulator: da9055: Fix notifier mutex lock warning Steve Twiss
  2019-02-26 15:19 ` [PATCH 02/13] regulator: da9062: " Steve Twiss
@ 2019-02-26 15:23 ` Steve Twiss
  2019-02-26 15:27 ` [PATCH 04/13] regulator: da9211: " Steve Twiss
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 15:23 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML

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.")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/da9063-regulator.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index 8cbcd2a..d3ea73a 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -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;
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 04/13] regulator: da9211: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
                   ` (2 preceding siblings ...)
  2019-02-26 15:23 ` [PATCH 03/13] regulator: da9063: " Steve Twiss
@ 2019-02-26 15:27 ` Steve Twiss
  2019-02-26 15:32 ` [PATCH 05/13] regulator: lp8755: " Steve Twiss
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 15:27 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML

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")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/da9211-regulator.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c
index 109ee12..4d7fe48 100644
--- a/drivers/regulator/da9211-regulator.c
+++ b/drivers/regulator/da9211-regulator.c
@@ -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);
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 05/13] regulator: lp8755: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
                   ` (3 preceding siblings ...)
  2019-02-26 15:27 ` [PATCH 04/13] regulator: da9211: " Steve Twiss
@ 2019-02-26 15:32 ` Steve Twiss
  2019-02-26 15:35 ` [PATCH 06/13] regulator: ltc3589: " Steve Twiss
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 15:32 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML

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")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/lp8755.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c
index 244822b..d82d307 100644
--- a/drivers/regulator/lp8755.c
+++ b/drivers/regulator/lp8755.c
@@ -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:
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 06/13] regulator: ltc3589: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
                   ` (4 preceding siblings ...)
  2019-02-26 15:32 ` [PATCH 05/13] regulator: lp8755: " Steve Twiss
@ 2019-02-26 15:35 ` Steve Twiss
  2019-02-26 15:38 ` [PATCH 07/13] regulator: ltc3676: " Steve Twiss
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 15:35 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML

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")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/ltc3589.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/ltc3589.c b/drivers/regulator/ltc3589.c
index 63f724f..75089b0 100644
--- a/drivers/regulator/ltc3589.c
+++ b/drivers/regulator/ltc3589.c
@@ -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 */
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 07/13] regulator: ltc3676: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
                   ` (5 preceding siblings ...)
  2019-02-26 15:35 ` [PATCH 06/13] regulator: ltc3589: " Steve Twiss
@ 2019-02-26 15:38 ` Steve Twiss
  2019-02-26 15:42 ` [PATCH 08/13] regulator: pv88060: " Steve Twiss
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 15:38 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML

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")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/ltc3676.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/ltc3676.c b/drivers/regulator/ltc3676.c
index 71fd0f2..cd0f112 100644
--- a/drivers/regulator/ltc3676.c
+++ b/drivers/regulator/ltc3676.c
@@ -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 */
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 08/13] regulator: pv88060: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
                   ` (6 preceding siblings ...)
  2019-02-26 15:38 ` [PATCH 07/13] regulator: ltc3676: " Steve Twiss
@ 2019-02-26 15:42 ` Steve Twiss
  2019-02-26 15:44 ` [PATCH 09/13] regulator: pv88080: " Steve Twiss
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 15:42 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML

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")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/pv88060-regulator.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/regulator/pv88060-regulator.c b/drivers/regulator/pv88060-regulator.c
index a944605..000c349 100644
--- a/drivers/regulator/pv88060-regulator.c
+++ b/drivers/regulator/pv88060-regulator.c
@@ -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]);
 			}
 		}
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 09/13] regulator: pv88080: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
                   ` (7 preceding siblings ...)
  2019-02-26 15:42 ` [PATCH 08/13] regulator: pv88060: " Steve Twiss
@ 2019-02-26 15:44 ` Steve Twiss
  2019-02-26 15:46 ` [PATCH 10/13] regulator: pv88090: " Steve Twiss
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 15:44 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML

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")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/pv88080-regulator.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/regulator/pv88080-regulator.c b/drivers/regulator/pv88080-regulator.c
index 9a08cb2..d99f1b9 100644
--- a/drivers/regulator/pv88080-regulator.c
+++ b/drivers/regulator/pv88080-regulator.c
@@ -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]);
 			}
 		}
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 10/13] regulator: pv88090: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
                   ` (8 preceding siblings ...)
  2019-02-26 15:44 ` [PATCH 09/13] regulator: pv88080: " Steve Twiss
@ 2019-02-26 15:46 ` Steve Twiss
  2019-02-26 15:48 ` [PATCH 11/13] regulator: wm831x: " Steve Twiss
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 15:46 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML

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")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/pv88090-regulator.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/regulator/pv88090-regulator.c b/drivers/regulator/pv88090-regulator.c
index 7a0c159..b4ff646 100644
--- a/drivers/regulator/pv88090-regulator.c
+++ b/drivers/regulator/pv88090-regulator.c
@@ -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]);
 			}
 		}
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 11/13] regulator: wm831x: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
                   ` (9 preceding siblings ...)
  2019-02-26 15:46 ` [PATCH 10/13] regulator: pv88090: " Steve Twiss
@ 2019-02-26 15:48 ` Steve Twiss
  2019-03-06  9:27   ` Charles Keepax
  2019-02-26 15:51 ` [PATCH 12/13] regulator: wm831x isink: " Steve Twiss
  2019-02-26 15:54 ` [PATCH 13/13] regulator: wm831x ldo: " Steve Twiss
  12 siblings, 1 reply; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 15:48 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML, Cirrus Patches

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")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/wm831x-dcdc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 5a5bc4b..4f5461a 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -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;
 }
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 12/13] regulator: wm831x isink: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
                   ` (10 preceding siblings ...)
  2019-02-26 15:48 ` [PATCH 11/13] regulator: wm831x: " Steve Twiss
@ 2019-02-26 15:51 ` Steve Twiss
  2019-03-06  9:28   ` Charles Keepax
  2019-02-26 15:54 ` [PATCH 13/13] regulator: wm831x ldo: " Steve Twiss
  12 siblings, 1 reply; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 15:51 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML, Cirrus Patches

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")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/wm831x-isink.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c
index 6dd891d..11f3511 100644
--- a/drivers/regulator/wm831x-isink.c
+++ b/drivers/regulator/wm831x-isink.c
@@ -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;
 }
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 13/13] regulator: wm831x ldo: Fix notifier mutex lock warning
  2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
                   ` (11 preceding siblings ...)
  2019-02-26 15:51 ` [PATCH 12/13] regulator: wm831x isink: " Steve Twiss
@ 2019-02-26 15:54 ` Steve Twiss
  2019-03-06  9:28   ` Charles Keepax
  12 siblings, 1 reply; 17+ messages in thread
From: Steve Twiss @ 2019-02-26 15:54 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML, Cirrus Patches

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")
Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
 drivers/regulator/wm831x-ldo.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index e4a6f88..fcd038e 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -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;
 }
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls
@ 2019-03-05 17:59 Steve Twiss
  2019-02-26 14:59 ` [PATCH 01/13] regulator: da9055: Fix notifier mutex lock warning Steve Twiss
                   ` (12 more replies)
  0 siblings, 13 replies; 17+ messages in thread
From: Steve Twiss @ 2019-03-05 17:59 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: Support Opensource, LKML, Cirrus Patches


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(-)

-- 
1.9.3


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 11/13] regulator: wm831x: Fix notifier mutex lock warning
  2019-02-26 15:48 ` [PATCH 11/13] regulator: wm831x: " Steve Twiss
@ 2019-03-06  9:27   ` Charles Keepax
  0 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2019-03-06  9:27 UTC (permalink / raw)
  To: Steve Twiss
  Cc: Liam Girdwood, Mark Brown, Support Opensource, LKML, Cirrus Patches

On Tue, Feb 26, 2019 at 03:48:46PM +0000, Steve Twiss wrote:
> 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")
> Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 12/13] regulator: wm831x isink: Fix notifier mutex lock warning
  2019-02-26 15:51 ` [PATCH 12/13] regulator: wm831x isink: " Steve Twiss
@ 2019-03-06  9:28   ` Charles Keepax
  0 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2019-03-06  9:28 UTC (permalink / raw)
  To: Steve Twiss
  Cc: Liam Girdwood, Mark Brown, Support Opensource, LKML, Cirrus Patches

On Tue, Feb 26, 2019 at 03:51:28PM +0000, Steve Twiss wrote:
> 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")
> Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 13/13] regulator: wm831x ldo: Fix notifier mutex lock warning
  2019-02-26 15:54 ` [PATCH 13/13] regulator: wm831x ldo: " Steve Twiss
@ 2019-03-06  9:28   ` Charles Keepax
  0 siblings, 0 replies; 17+ messages in thread
From: Charles Keepax @ 2019-03-06  9:28 UTC (permalink / raw)
  To: Steve Twiss
  Cc: Liam Girdwood, Mark Brown, Support Opensource, LKML, Cirrus Patches

On Tue, Feb 26, 2019 at 03:54:01PM +0000, Steve Twiss wrote:
> 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")
> Suggested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-03-06  9:28 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-05 17:59 [PATCH 00/13] Fix backtrace warnings from bad notifier chain calls Steve Twiss
2019-02-26 14:59 ` [PATCH 01/13] regulator: da9055: Fix notifier mutex lock warning Steve Twiss
2019-02-26 15:19 ` [PATCH 02/13] regulator: da9062: " Steve Twiss
2019-02-26 15:23 ` [PATCH 03/13] regulator: da9063: " Steve Twiss
2019-02-26 15:27 ` [PATCH 04/13] regulator: da9211: " Steve Twiss
2019-02-26 15:32 ` [PATCH 05/13] regulator: lp8755: " Steve Twiss
2019-02-26 15:35 ` [PATCH 06/13] regulator: ltc3589: " Steve Twiss
2019-02-26 15:38 ` [PATCH 07/13] regulator: ltc3676: " Steve Twiss
2019-02-26 15:42 ` [PATCH 08/13] regulator: pv88060: " Steve Twiss
2019-02-26 15:44 ` [PATCH 09/13] regulator: pv88080: " Steve Twiss
2019-02-26 15:46 ` [PATCH 10/13] regulator: pv88090: " Steve Twiss
2019-02-26 15:48 ` [PATCH 11/13] regulator: wm831x: " Steve Twiss
2019-03-06  9:27   ` Charles Keepax
2019-02-26 15:51 ` [PATCH 12/13] regulator: wm831x isink: " Steve Twiss
2019-03-06  9:28   ` Charles Keepax
2019-02-26 15:54 ` [PATCH 13/13] regulator: wm831x ldo: " Steve Twiss
2019-03-06  9:28   ` Charles Keepax

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).