lkml.org 
[lkml]   [2013]   [Dec]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 02/18] power/reset: vexpress: Use sched_clock as the time source
Date
At this stage of system shutdown procedure the jiffies may
not be updated anymore, so have to base on raw sched_clock
values.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: David Woodhouse <dwmw2@infradead.org>
---
drivers/power/reset/vexpress-poweroff.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c
index 476aa49..d752233 100644
--- a/drivers/power/reset/vexpress-poweroff.c
+++ b/drivers/power/reset/vexpress-poweroff.c
@@ -15,6 +15,7 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
+#include <linux/sched.h>
#include <linux/stat.h>
#include <linux/vexpress.h>

@@ -27,12 +28,12 @@ static void vexpress_reset_do(struct device *dev, const char *what)
vexpress_config_func_get_by_dev(dev);

if (func) {
- unsigned long timeout;
+ unsigned long long timeout_ns;

err = vexpress_config_write(func, 0, 0);

- timeout = jiffies + HZ;
- while (time_before(jiffies, timeout))
+ timeout_ns = sched_clock() + 50000000;
+ while (!err && time_before64(sched_clock(), timeout_ns))
cpu_relax();
}

--
1.8.3.2



\
 
 \ /
  Last update: 2013-12-23 18:01    [W:0.281 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site