rk3288:pmic:rk808&syr82x:modify lock error
author张晴 <zhangqing@rock-chips.com>
Fri, 9 May 2014 02:06:40 +0000 (10:06 +0800)
committer张晴 <zhangqing@rock-chips.com>
Fri, 9 May 2014 02:06:40 +0000 (10:06 +0800)
drivers/mfd/rk808.c
drivers/regulator/syr82x.c

index d143ce34a4f9aa81c4f77e44647cf9bd3b6a04de..d37d1b3ba8bb39e16eacbf5cbd204870d084b9d0 100755 (executable)
@@ -809,9 +809,10 @@ int rk808_reg_read(struct rk808 *rk808, u8 reg)
 
        ret = rk808_i2c_read(rk808, reg, 1, &val);
        DBG("reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff);
-       if (ret < 0)
-               return ret;
-
+       if (ret < 0){
+                mutex_unlock(&rk808->io_lock);
+                return ret;
+       }
        mutex_unlock(&rk808->io_lock);
 
        return val & 0xff;      
@@ -842,17 +843,22 @@ EXPORT_SYMBOL_GPL(rk808_reg_write);
 
        ret = rk808_i2c_read(rk808, reg, 1, &tmp);
        DBG("1 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff);
-       if (ret < 0)
-               return ret;
+       if (ret < 0){
+                mutex_unlock(&rk808->io_lock);
+                return ret;
+       }
        tmp = (tmp & ~mask) | val;
        ret = rk808_i2c_write(rk808, reg, 1, tmp);
        DBG("reg write 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff);
-       if (ret < 0)
-               return ret;
-       
+       if (ret < 0){
+                mutex_unlock(&rk808->io_lock);
+                return ret;
+       }
        ret = rk808_i2c_read(rk808, reg, 1, &tmp);
-       if (ret < 0)
-               return ret;
+       if (ret < 0){
+                mutex_unlock(&rk808->io_lock);
+                return ret;
+       }
        DBG("2 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff);
        mutex_unlock(&rk808->io_lock);
 
index bab496235734561879da3b7758979abea66c2c4c..ed0d4746a1b547dc5504982748c5318b2c191b8a 100755 (executable)
@@ -388,9 +388,10 @@ static int syr82x_reg_read(struct syr82x *syr82x, u8 reg)
        ret = syr82x_i2c_read(syr82x->i2c, reg, 1, &val);
 
        DBG("reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff);
-       if (ret < 0)
+       if (ret < 0){
+               mutex_unlock(&syr82x->io_lock);
                return ret;
-
+       }
        mutex_unlock(&syr82x->io_lock);
 
        return val & 0xff;      
@@ -405,17 +406,23 @@ static int syr82x_set_bits(struct syr82x *syr82x, u8 reg, u16 mask, u16 val)
 
        ret = syr82x_i2c_read(syr82x->i2c, reg, 1, &tmp);
        DBG("1 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff);
-       if (ret < 0)
-               return ret;
+       if (ret < 0){
+                mutex_unlock(&syr82x->io_lock);
+                return ret;
+        }
        tmp = (tmp & ~mask) | val;
        ret = syr82x_i2c_write(syr82x->i2c, reg, 1, tmp);
        DBG("reg write 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff);
-       if (ret < 0)
-               return ret;
+       if (ret < 0){
+                mutex_unlock(&syr82x->io_lock);
+                return ret;
+        }
        ret = syr82x_i2c_read(syr82x->i2c, reg, 1, &tmp);
        DBG("2 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff);
-       if (ret < 0)
-               return ret;
+       if (ret < 0){
+                mutex_unlock(&syr82x->io_lock);
+                return ret;
+        }
        mutex_unlock(&syr82x->io_lock);
 
        return 0;//ret;