[02/12] power/reset: vexpress: Use udelay instead of timers

Message ID 1392138636-29240-3-git-send-email-pawel.moll@arm.com
State New
Headers show

Commit Message

Pawel Moll Feb. 11, 2014, 5:10 p.m.
At this stage of system shutdown procedure the jiffies may
not be updated anymore, so just use udelay instead.

Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
 drivers/power/reset/vexpress-poweroff.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Pawel Moll Feb. 12, 2014, 11:56 a.m. | #1
On Tue, 2014-02-11 at 20:59 +0000, Arnd Bergmann wrote:
> On Tuesday 11 February 2014, Pawel Moll wrote:
> > At this stage of system shutdown procedure the jiffies may
> > not be updated anymore, so just use udelay instead.
> 
> comment doesn't match code: s/udelay/mdelay/
> 
> > +                       mdelay(1000);
> >         }

Uh, right. Well spotted. Will fix.

Pawel

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Patch

diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c
index 37e7799..195235c 100644
--- a/drivers/power/reset/vexpress-poweroff.c
+++ b/drivers/power/reset/vexpress-poweroff.c
@@ -11,7 +11,7 @@ 
  * Copyright (C) 2012 ARM Limited
  */
 
-#include <linux/jiffies.h>
+#include <linux/delay.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
@@ -26,13 +26,9 @@  static void vexpress_reset_do(struct device *dev, const char *what)
 	struct regmap *reg = dev_get_drvdata(dev);
 
 	if (reg) {
-		unsigned long timeout;
-
 		err = regmap_write(reg, 0, 0);
-
-		timeout = jiffies + HZ;
-		while (time_before(jiffies, timeout))
-			cpu_relax();
+		if (!err)
+			mdelay(1000);
 	}
 
 	dev_emerg(dev, "Unable to %s (%d)\n", what, err);