From: 张晴 Date: Fri, 9 May 2014 02:06:40 +0000 (+0800) Subject: rk3288:pmic:rk808&syr82x:modify lock error X-Git-Tag: firefly_0821_release~5319 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6e7bc37e9c025d37914d45ae87c8213caa8b4bd7;p=firefly-linux-kernel-4.4.55.git rk3288:pmic:rk808&syr82x:modify lock error --- diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index d143ce34a4f9..d37d1b3ba8bb 100755 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -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); diff --git a/drivers/regulator/syr82x.c b/drivers/regulator/syr82x.c index bab496235734..ed0d4746a1b5 100755 --- a/drivers/regulator/syr82x.c +++ b/drivers/regulator/syr82x.c @@ -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;