power: bq2419x: acquire mutex lock
Kunal Agrawal [Thu, 31 Jan 2013 03:47:41 +0000 (08:47 +0530)]
add changes to acquire mutex lock at the start of the function.

Bug 1225027

Signed-off-by: Kunal Agrawal <kunala@nvidia.com>
Change-Id: I2a7b9cb243fa45590039be635d85f4245823baed
Reviewed-on: http://git-master/r/195821
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

drivers/power/bq2419x-charger.c

index 6b0c6fb..b240ad0 100644 (file)
@@ -81,6 +81,7 @@ static int current_to_reg(const unsigned int *tbl,
 static int bq2419x_charger_enable(struct bq2419x_charger *charger)
 {
        int ret;
+       mutex_lock(&bq_charger->mutex);
        if (bq_charger && bq_charger->shutdown_complete) {
                mutex_unlock(&bq_charger->mutex);
                return -ENODEV;
@@ -97,6 +98,7 @@ static int bq2419x_charger_enable(struct bq2419x_charger *charger)
 static int bq2419x_charger_disable(struct bq2419x_charger *charger)
 {
        int ret;
+       mutex_lock(&bq_charger->mutex);
        if (bq_charger && bq_charger->shutdown_complete) {
                mutex_unlock(&bq_charger->mutex);
                return -ENODEV;
@@ -142,6 +144,7 @@ static int bq2419x_init(struct bq2419x_charger *charger)
 {
        int val, ret = 0;
 
+       mutex_lock(&bq_charger->mutex);
        if (bq_charger && bq_charger->shutdown_complete) {
                mutex_unlock(&bq_charger->mutex);
                return -ENODEV;