Subject: linux-2.6.37-ektf-fix-circular-locking_v2.patch

Fix 10615 [1.2Testing][REG] touchscreen lockdep warning: "possible circular locking dependency detected"

[   17.959378] =======================================================
[   17.960058] [ INFO: possible circular locking dependency detected ]
[   17.960058] 2.6.37.6-24.3-adaptation-mrst #1
[   17.960058] -------------------------------------------------------
[   17.960058] sr-engine-touch/677 is trying to acquire lock:
[   17.994500]  (&ed->mutex){+.+.+.}, at: [<c1405cf7>] ektf2136_runtime_resume+0x47/0xb0
[   17.994500] 
[   17.994500] but task is already holding lock:
[   17.994500]  (&dev->mutex){+.+...}, at: [<c13f3624>] input_open_device+0x24/0xb0
[   17.994500] 
[   17.994500] which lock already depends on the new lock.

Signed-off-by: Mike Hsu <mike_t_hsu@wistron.com>
Signed-off-by: Scott Liu <scott.liu@emc.com.tw>
---
 ektf2136_spi.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

--- linux-2.6.37/drivers/input/touchscreen/ektf2136_spi.old.c	2011-07-13 15:49:05.000000000 +0800
+++ linux-2.6.37/drivers/input/touchscreen/ektf2136_spi.c	2011-07-13 16:00:26.000000000 +0800
@@ -30,11 +30,11 @@
 #include <linux/pm_runtime.h>
 
 #define DRV_NAME	"ektf2136_spi"
-#define DRIVER_VERSION	"v3.0.6"
+#define DRIVER_VERSION	"v3.0.7"
 
 #define DRV_MA_VER 3
 #define DRV_MI_VER 0
-#define DRV_SUB_MI_VER 6
+#define DRV_SUB_MI_VER 7
 
 static const char ELAN_TS_NAME[]	= "ektf2136_spi";
 
@@ -2642,11 +2642,11 @@
 	PREPARE_WORK(&ed->work, elan_touch_work_func);
 	elan_touch_register_interrupt(spi);
 
+	mutex_unlock(&ed->mutex);
+
 	pm_runtime_set_active(&ed->spi->dev);
 	pm_runtime_enable(&ed->spi->dev);
 
-	mutex_unlock(&ed->mutex);
-
 	ed->status |= STA_INIT3;
 
 	return ;
@@ -2824,15 +2824,15 @@
 	if (ed->protocol & PRO_UPDATE_FW_MODE)
 		return 0;
 
-	mutex_lock(&ed->mutex);
+	mutex_lock(&ed->sysfs_mutex);
 	ret = elan_spi_write_cmd(ed->spi, set_sleep_cmd,
 				sizeof(set_sleep_cmd), "set_sleep_cmd");
-	mutex_unlock(&ed->mutex);
 
-	if (ret < 0)
+	if (ret < 0) {
+		mutex_unlock(&ed->sysfs_mutex);
 		return ret;
+	}
 
-	mutex_lock(&ed->sysfs_mutex);
 	ed->power_state = 0;
 	mutex_unlock(&ed->sysfs_mutex);
 	msleep(100);
@@ -2853,15 +2853,15 @@
 	if (ed->protocol & PRO_UPDATE_FW_MODE)
 		return 0;
 
-	mutex_lock(&ed->mutex);
+	mutex_lock(&ed->sysfs_mutex);
 	ret = elan_spi_write_cmd(ed->spi, set_active_cmd,
 			sizeof(set_active_cmd), "set_active_cmd");
-	mutex_unlock(&ed->mutex);
 
-	if (ret < 0)
+	if (ret < 0) {
+		mutex_unlock(&ed->sysfs_mutex);
 		return ret;
+	}
 
-	mutex_lock(&ed->sysfs_mutex);
 	ed->power_state = 1;
 	mutex_unlock(&ed->sysfs_mutex);
 	msleep(100);
