Hi,

I was trying to use my usb memory stick on my DVEVM with latest git 
kernel and noticed that switching J7 on board for host mode causes 
kernel to get locked. I think the problem is triggered by i2c gpio 
expander driver.  I'm not sure if I'm missing anything else or not, 
but following patch seems to make it work for me.

Regards,
Caglar




>From ce80eb6c57aed829da5b141f0a04fccd71ceb073 Mon Sep 17 00:00:00 2001
From: Yusuf Caglar Akyuz <[EMAIL PROTECTED]>
Date: Wed, 2 Apr 2008 10:28:06 +0300
Subject: [PATCH] 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: Yusuf Caglar Akyuz <[EMAIL PROTECTED]>
---
 drivers/i2c/chips/gpio_expander_davinci.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/chips/gpio_expander_davinci.c b/drivers/i2c/chips/gpio_expander_davinci.c
index 33b7c8d..db5b504 100644
--- a/drivers/i2c/chips/gpio_expander_davinci.c
+++ b/drivers/i2c/chips/gpio_expander_davinci.c
@@ -26,8 +26,8 @@ static int davinci_i2c_expander_read(u8 size, u8 * val, u16 addr)
 	int err;
 	struct i2c_msg msg[1];
 
-        adap = i2c_get_adapter(0);
-        if (!adap)
+	adap = i2c_get_adapter(1);
+	if (!adap)
 		return -ENODEV;
 
 	msg->addr = addr;
@@ -48,7 +48,7 @@ static int davinci_i2c_expander_write(u8 size, u8 * val, u16 addr)
 	int err;
 	struct i2c_msg msg[1];
 
-        adap = i2c_get_adapter(0);
+	adap = i2c_get_adapter(1);
         if (!adap)
 		return -ENODEV;
 
@@ -76,8 +76,10 @@ int davinci_i2c_expander_op(u16 client_addr, u35_expander_ops pin, u8 val)
 	mutex_lock(&expander_lock);
 
 	err = davinci_i2c_expander_read(1, &data_to_u35, 0x3A);
-	if (err < 0)
+	if (err < 0) {
+		mutex_unlock(&expander_lock);
 		return err;
+	}
 
 	if (client_addr == 0x3A) {
 		switch (pin) {
-- 
1.5.4.4


_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to