If the scu fails to initialize the sep, the driver will not
get a response from the reconfig shared area command

This patch forces the driver to quit after a limited time
and then return an error

Signed-off-by: Mark Allyn <[email protected]>
---
 drivers/staging/sep/sep_driver.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index 58eab3e..c631b3c 100644
--- a/drivers/staging/sep/sep_driver.c
+++ b/drivers/staging/sep/sep_driver.c
@@ -53,6 +53,7 @@
 #include <asm/cacheflush.h>
 #include <linux/sched.h>
 #include <linux/delay.h>
+#include <linux/jiffies.h>
 
 #include "../rar_register/rar_register.h"
 #include "../memrar/memrar.h"
@@ -3243,6 +3244,9 @@ static int sep_reconfig_shared_area(struct sep_device 
*sep)
 {
        int ret_val;
 
+       /* use to limit waiting for SEP */
+       unsigned long end_time;
+
        dev_dbg(&sep->pdev->dev, "reconfig shared area start\n");
 
        /* Send the new SHARED MESSAGE AREA to the SEP */
@@ -3254,7 +3258,10 @@ static int sep_reconfig_shared_area(struct sep_device 
*sep)
        /* Poll for SEP response */
        ret_val = sep_read_reg(sep, HW_HOST_SEP_HOST_GPR1_REG_ADDR);
 
-       while (ret_val != 0xffffffff && ret_val != sep->shared_bus)
+       end_time = jiffies + (WAIT_TIME * HZ);
+
+       while ((time_before(jiffies, end_time)) && (ret_val != 0xffffffff) &&
+               (ret_val != sep->shared_bus))
                ret_val = sep_read_reg(sep, HW_HOST_SEP_HOST_GPR1_REG_ADDR);
 
        /* Check the return value (register) */
-- 
1.6.3.3

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to