mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Allyn <mark.a.allyn@intel.com>
To: linux-kernel@vger.kernel.org, greg@kroah.com,
	mark.a.allyn@intel.com, alan@linux.intel.com,
	dmitry.kasatkin@nokia.com
Subject: [PATCH 08/11] sep: limit time to wait for reconfig shared area complete
Date: Thu,  9 Dec 2010 09:32:13 -0800	[thread overview]
Message-ID: <1291915933-18582-1-git-send-email-mark.a.allyn@intel.com> (raw)

Signed-off-by: Mark Allyn <mark.a.allyn@intel.com>
---
 drivers/staging/sep/sep_driver.c        |    9 ++++++++-
 drivers/staging/sep/sep_driver_config.h |    2 ++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index 5a54f98..83475eb 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 <linux/rar_register.h>
 
 #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 b96045f..92338c0 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 */
-- 
1.6.3.3


                 reply	other threads:[~2010-12-09 17:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291915933-18582-1-git-send-email-mark.a.allyn@intel.com \
    --to=mark.a.allyn@intel.com \
    --cc=alan@linux.intel.com \
    --cc=dmitry.kasatkin@nokia.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome