power/reset: xgene: Use mdelay instead of jiffies based timeout
authorGuenter Roeck <linux@roeck-us.net>
Tue, 30 Sep 2014 17:48:31 +0000 (10:48 -0700)
committerSebastian Reichel <sre@kernel.org>
Mon, 17 Nov 2014 02:07:09 +0000 (03:07 +0100)
jiffies are not running at this stage of system shutdown, meaning an
error in the reset function would never be reported. Replace with mdelay().

Cc: Loc Ho <lho@apm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/power/reset/xgene-reboot.c

index 94f10ad..9da341d 100644 (file)
@@ -24,6 +24,7 @@
  * For system shutdown, this is board specify. If a board designer
  * implements GPIO shutdown, use the gpio-poweroff.c driver.
  */
+#include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/of_device.h>
 #include <linux/of_address.h>
@@ -43,15 +44,12 @@ static struct xgene_reboot_context *xgene_restart_ctx;
 static void xgene_restart(enum reboot_mode mode, const char *cmd)
 {
        struct xgene_reboot_context *ctx = xgene_restart_ctx;
-       unsigned long timeout;
 
        /* Issue the reboot */
        if (ctx)
                writel(ctx->mask, ctx->csr);
 
-       timeout = jiffies + HZ;
-       while (time_before(jiffies, timeout))
-               cpu_relax();
+       mdelay(1000);
 
        dev_emerg(ctx->dev, "Unable to restart system\n");
 }