2019-03-05 18:56:27

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 00/13] 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(-)

--
1.9.3



2019-03-05 18:53:37

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 02/13] regulator: da9062: 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: 4068e5182ada ("regulator: da9062: DA9062 regulator driver")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-05 18:54:07

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 01/13] regulator: da9055: 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: f6130be652d0 ("regulator: DA9055 regulator driver")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-05 18:54:16

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 07/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")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-05 18:55:20

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 11/13] regulator: wm831x: 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: e4ee831f949a ("regulator: Add WM831x DC-DC buck convertor support")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-05 18:55:28

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 10/13] regulator: pv88090: 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: c90456e36d9c ("regulator: pv88090: new regulator driver")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-05 18:55:34

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 12/13] regulator: wm831x isink: 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: d4d6b722e780 ("regulator: Add WM831x ISINK support")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-05 18:58:29

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 04/13] regulator: da9211: 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: 1028a37daa14 ("regulator: da9211: new regulator driver")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-05 18:59:54

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 06/13] regulator: ltc3589: 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: 3eb2c7ecb7ea ("regulator: Add LTC3589 support")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-05 19:31:55

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 05/13] regulator: lp8755: 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: b59320cc5a5e ("regulator: lp8755: new driver for LP8755")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-05 19:31:55

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 09/13] regulator: pv88080: 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: 99cf3af5e2d5 ("regulator: pv88080: new regulator driver")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-05 19:31:58

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 08/13] regulator: pv88060: 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: f307a7e9b7af ("regulator: pv88060: new regulator driver")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-05 19:31:59

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 03/13] regulator: da9063: 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: 69ca3e58d178 ("regulator: da9063: Add Dialog DA9063 voltage regulators support.")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-05 19:32:50

by Steve Twiss

[permalink] [raw]
Subject: [PATCH 13/13] regulator: wm831x ldo: 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: d1c6b4fe668b ("regulator: Add WM831x LDO support")
Suggested-by: Adam Thomson <[email protected]>
Signed-off-by: Steve Twiss <[email protected]>
---
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


2019-03-06 09:40:38

by Charles Keepax

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

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 <[email protected]>
> Signed-off-by: Steve Twiss <[email protected]>
> ---

Acked-by: Charles Keepax <[email protected]>

Thanks,
Charles

2019-03-06 10:58:09

by Charles Keepax

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

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 <[email protected]>
> Signed-off-by: Steve Twiss <[email protected]>
> ---

Acked-by: Charles Keepax <[email protected]>

Thanks,
Charles

2019-03-06 10:58:10

by Charles Keepax

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

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 <[email protected]>
> Signed-off-by: Steve Twiss <[email protected]>
> ---

Acked-by: Charles Keepax <[email protected]>

Thanks,
Charles