Merge branch 'next-integrity' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorri...
[linux-2.6-microblaze.git] / drivers / regulator / da9211-regulator.c
index 109ee12..da37b4c 100644 (file)
@@ -1,18 +1,8 @@
-/*
- * da9211-regulator.c - Regulator device driver for DA9211/DA9212
- * /DA9213/DA9223/DA9214/DA9224/DA9215/DA9225
- * Copyright (C) 2015  Dialog Semiconductor Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0+
+//
+// da9211-regulator.c - Regulator device driver for DA9211/DA9212
+// /DA9213/DA9223/DA9214/DA9224/DA9215/DA9225
+// Copyright (C) 2015  Dialog Semiconductor Ltd.
 
 #include <linux/err.h>
 #include <linux/i2c.h>
@@ -322,8 +312,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 +326,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);