Commit 5d641071 authored by Yusuf Caglar Akyuz's avatar Yusuf Caglar Akyuz Committed by Kevin Hilman

I2C: DaVinci: Fix GPIO expander driver

- Get i2c adapter with address 1 not 0 in davinci_i2c_expander_read
- Unlock mutex on error exit path in davinci_i2c_expander_op
Signed-off-by: default avatarYusuf Caglar Akyuz <caglarakyuz@gmail.com>
Signed-off-by: default avatarKevin Hilman <khilman@mvista.com>
parent f08a2aaa
...@@ -26,8 +26,8 @@ static int davinci_i2c_expander_read(u8 size, u8 * val, u16 addr) ...@@ -26,8 +26,8 @@ static int davinci_i2c_expander_read(u8 size, u8 * val, u16 addr)
int err; int err;
struct i2c_msg msg[1]; struct i2c_msg msg[1];
adap = i2c_get_adapter(0); adap = i2c_get_adapter(1);
if (!adap) if (!adap)
return -ENODEV; return -ENODEV;
msg->addr = addr; msg->addr = addr;
...@@ -48,7 +48,7 @@ static int davinci_i2c_expander_write(u8 size, u8 * val, u16 addr) ...@@ -48,7 +48,7 @@ static int davinci_i2c_expander_write(u8 size, u8 * val, u16 addr)
int err; int err;
struct i2c_msg msg[1]; struct i2c_msg msg[1];
adap = i2c_get_adapter(0); adap = i2c_get_adapter(1);
if (!adap) if (!adap)
return -ENODEV; return -ENODEV;
...@@ -76,8 +76,10 @@ int davinci_i2c_expander_op(u16 client_addr, u35_expander_ops pin, u8 val) ...@@ -76,8 +76,10 @@ int davinci_i2c_expander_op(u16 client_addr, u35_expander_ops pin, u8 val)
mutex_lock(&expander_lock); mutex_lock(&expander_lock);
err = davinci_i2c_expander_read(1, &data_to_u35, 0x3A); err = davinci_i2c_expander_read(1, &data_to_u35, 0x3A);
if (err < 0) if (err < 0) {
mutex_unlock(&expander_lock);
return err; return err;
}
if (client_addr == 0x3A) { if (client_addr == 0x3A) {
switch (pin) { switch (pin) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment