mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 01:10:54 +07:00
regulator: remove locking around regulator_notifier_call_chain()
regulator_notifier_call_chain() doesn't need rdev lock and rdev's existence is assumed in the code anyway. Remove the locks from drivers. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/42393f66dcc4d80dcd9797be45216b4035aa96cb.1597032945.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
3bca239d61
commit
e9c142b0d2
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -346,10 +346,8 @@ 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);
|
||||
@ -360,10 +358,8 @@ 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);
|
||||
|
@ -329,11 +329,9 @@ static irqreturn_t lp8755_irq_handler(int irq, void *data)
|
||||
if ((flag0 & (0x4 << icnt))
|
||||
&& (pchip->irqmask & (0x04 << icnt))
|
||||
&& (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 */
|
||||
@ -349,22 +347,18 @@ static irqreturn_t lp8755_irq_handler(int irq, void *data)
|
||||
if ((flag1 & 0x01) && (pchip->irqmask & 0x01))
|
||||
for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
|
||||
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 regulator devices */
|
||||
if ((flag1 & 0x02) && (pchip->irqmask & 0x02))
|
||||
for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++)
|
||||
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;
|
||||
|
||||
|
@ -357,22 +357,16 @@ 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++) {
|
||||
regulator_lock(ltc3589->regulators[i]);
|
||||
for (i = 0; i < LTC3589_NUM_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++) {
|
||||
regulator_lock(ltc3589->regulators[i]);
|
||||
for (i = 0; i < LTC3589_NUM_REGULATORS; i++)
|
||||
regulator_notifier_call_chain(ltc3589->regulators[i],
|
||||
event, NULL);
|
||||
regulator_unlock(ltc3589->regulators[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear warning condition */
|
||||
|
@ -276,23 +276,17 @@ 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++) {
|
||||
regulator_lock(ltc3676->regulators[i]);
|
||||
for (i = 0; i < LTC3676_NUM_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++) {
|
||||
regulator_lock(ltc3676->regulators[i]);
|
||||
for (i = 0; i < LTC3676_NUM_REGULATORS; i++)
|
||||
regulator_notifier_call_chain(ltc3676->regulators[i],
|
||||
event, NULL);
|
||||
regulator_unlock(ltc3676->regulators[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear warning condition */
|
||||
|
@ -233,13 +233,10 @@ 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]);
|
||||
if (chip->rdev[i] != NULL)
|
||||
regulator_notifier_call_chain(chip->rdev[i],
|
||||
REGULATOR_EVENT_UNDER_VOLTAGE,
|
||||
NULL);
|
||||
regulator_unlock(chip->rdev[i]);
|
||||
}
|
||||
}
|
||||
|
||||
err = regmap_write(chip->regmap, PV88060_REG_EVENT_A,
|
||||
@ -252,13 +249,10 @@ 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]);
|
||||
if (chip->rdev[i] != NULL)
|
||||
regulator_notifier_call_chain(chip->rdev[i],
|
||||
REGULATOR_EVENT_OVER_TEMP,
|
||||
NULL);
|
||||
regulator_unlock(chip->rdev[i]);
|
||||
}
|
||||
}
|
||||
|
||||
err = regmap_write(chip->regmap, PV88060_REG_EVENT_A,
|
||||
|
@ -334,13 +334,10 @@ 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]);
|
||||
if (chip->rdev[i] != NULL)
|
||||
regulator_notifier_call_chain(chip->rdev[i],
|
||||
REGULATOR_EVENT_UNDER_VOLTAGE,
|
||||
NULL);
|
||||
regulator_unlock(chip->rdev[i]);
|
||||
}
|
||||
}
|
||||
|
||||
err = regmap_write(chip->regmap, PV88080_REG_EVENT_A,
|
||||
@ -353,13 +350,10 @@ 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]);
|
||||
if (chip->rdev[i] != NULL)
|
||||
regulator_notifier_call_chain(chip->rdev[i],
|
||||
REGULATOR_EVENT_OVER_TEMP,
|
||||
NULL);
|
||||
regulator_unlock(chip->rdev[i]);
|
||||
}
|
||||
}
|
||||
|
||||
err = regmap_write(chip->regmap, PV88080_REG_EVENT_A,
|
||||
|
@ -226,13 +226,10 @@ 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]);
|
||||
if (chip->rdev[i] != NULL)
|
||||
regulator_notifier_call_chain(chip->rdev[i],
|
||||
REGULATOR_EVENT_UNDER_VOLTAGE,
|
||||
NULL);
|
||||
regulator_unlock(chip->rdev[i]);
|
||||
}
|
||||
}
|
||||
|
||||
err = regmap_write(chip->regmap, PV88090_REG_EVENT_A,
|
||||
@ -245,13 +242,10 @@ 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]);
|
||||
if (chip->rdev[i] != NULL)
|
||||
regulator_notifier_call_chain(chip->rdev[i],
|
||||
REGULATOR_EVENT_OVER_TEMP,
|
||||
NULL);
|
||||
regulator_unlock(chip->rdev[i]);
|
||||
}
|
||||
}
|
||||
|
||||
err = regmap_write(chip->regmap, PV88090_REG_EVENT_A,
|
||||
|
@ -386,10 +386,8 @@ static irqreturn_t slg51000_irq_handler(int irq, void *data)
|
||||
for (i = 0; i < SLG51000_MAX_REGULATORS; i++) {
|
||||
if (!(evt[i][R2] & SLG51000_IRQ_ILIM_FLAG_MASK) &&
|
||||
(evt[i][R0] & SLG51000_EVT_ILIM_FLAG_MASK)) {
|
||||
regulator_lock(chip->rdev[i]);
|
||||
regulator_notifier_call_chain(chip->rdev[i],
|
||||
REGULATOR_EVENT_OVER_CURRENT, NULL);
|
||||
regulator_unlock(chip->rdev[i]);
|
||||
|
||||
if (evt[i][R1] & SLG51000_STA_ILIM_FLAG_MASK)
|
||||
dev_warn(chip->dev,
|
||||
@ -403,10 +401,8 @@ static irqreturn_t slg51000_irq_handler(int irq, void *data)
|
||||
for (i = 0; i < SLG51000_MAX_REGULATORS; i++) {
|
||||
if (!(evt[i][R1] & SLG51000_STA_ILIM_FLAG_MASK) &&
|
||||
(evt[i][R1] & SLG51000_STA_VOUT_OK_FLAG_MASK)) {
|
||||
regulator_lock(chip->rdev[i]);
|
||||
regulator_notifier_call_chain(chip->rdev[i],
|
||||
REGULATOR_EVENT_OVER_TEMP, NULL);
|
||||
regulator_unlock(chip->rdev[i]);
|
||||
}
|
||||
}
|
||||
handled = IRQ_HANDLED;
|
||||
|
@ -505,15 +505,11 @@ static irqreturn_t stpmic1_curlim_irq_handler(int irq, void *data)
|
||||
{
|
||||
struct regulator_dev *rdev = (struct regulator_dev *)data;
|
||||
|
||||
regulator_lock(rdev);
|
||||
|
||||
/* Send an overcurrent notification */
|
||||
regulator_notifier_call_chain(rdev,
|
||||
REGULATOR_EVENT_OVER_CURRENT,
|
||||
NULL);
|
||||
|
||||
regulator_unlock(rdev);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
@ -178,11 +178,9 @@ 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;
|
||||
}
|
||||
@ -191,11 +189,9 @@ 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;
|
||||
}
|
||||
|
@ -99,11 +99,9 @@ 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;
|
||||
}
|
||||
|
@ -46,11 +46,9 @@ 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;
|
||||
}
|
||||
|
@ -1089,7 +1089,6 @@ static irqreturn_t pmic_uv_handler(int irq, void *data)
|
||||
{
|
||||
struct regulator_dev *rdev = (struct regulator_dev *)data;
|
||||
|
||||
regulator_lock(rdev);
|
||||
if (irq == WM8350_IRQ_CS1 || irq == WM8350_IRQ_CS2)
|
||||
regulator_notifier_call_chain(rdev,
|
||||
REGULATOR_EVENT_REGULATION_OUT,
|
||||
@ -1098,7 +1097,6 @@ static irqreturn_t pmic_uv_handler(int irq, void *data)
|
||||
regulator_notifier_call_chain(rdev,
|
||||
REGULATOR_EVENT_UNDER_VOLTAGE,
|
||||
NULL);
|
||||
regulator_unlock(rdev);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user