From: Mark Allyn Date: Thu, 9 Dec 2010 17:32:13 +0000 (-0800) Subject: Staging: sep: limit time to wait for reconfig shared area complete X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=be38efe11748684d54ff86810443979a59b96cfc;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git Staging: sep: limit time to wait for reconfig shared area complete Signed-off-by: Mark Allyn Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c index 5a54f984e28e..83475eb77ad8 100644 --- a/drivers/staging/sep/sep_driver.c +++ b/drivers/staging/sep/sep_driver.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include "../memrar/memrar.h" @@ -3244,6 +3245,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 */ @@ -3255,7 +3259,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) */ diff --git a/drivers/staging/sep/sep_driver_config.h b/drivers/staging/sep/sep_driver_config.h index b96045f178cd..92338c0f6bd2 100644 --- a/drivers/staging/sep/sep_driver_config.h +++ b/drivers/staging/sep/sep_driver_config.h @@ -230,5 +230,7 @@ held by the proccess (struct file) */ /* the token that defines the data pool pointers address */ #define SEP_EXT_CACHE_ADDR_VAL_TOKEN 0xBABABABA +/* Time limit for SEP to finish */ +#define WAIT_TIME 10 #endif /* SEP DRIVER CONFIG */