time: alarmtimer: print cause of failure if suspend failed
Laxman Dewangan [Wed, 20 Feb 2013 09:59:59 +0000 (14:59 +0530)]
Print/display the cause of error if suspend fails. This helps in
debugging the failure case.

(Cherrypicked commit
2a5cd5441333ffd1b8e72c2b0d70734b9ca5fdeb)

Reviewed-on: http://git-master/r/202454
Change-Id: I5fa1ea4a542d8ee8f8bdf106a97eefc2c5e3d8d3
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/215100

kernel/time/alarmtimer.c

index 1974cac..6b73d2e 100644 (file)
@@ -249,6 +249,8 @@ static int alarmtimer_suspend(struct device *dev)
 
        if (ktime_to_ns(min) < 2 * NSEC_PER_SEC) {
                __pm_wakeup_event(ws, 2 * MSEC_PER_SEC);
+               dev_err(dev, "RTC waketime %ll less than 2 sec\n",
+                       ktime_to_ns(min));
                return -EBUSY;
        }
 
@@ -260,8 +262,10 @@ static int alarmtimer_suspend(struct device *dev)
 
        /* Set alarm, if in the past reject suspend briefly to handle */
        ret = rtc_timer_start(rtc, &rtctimer, now, ktime_set(0, 0));
-       if (ret < 0)
+       if (ret < 0) {
+               dev_err(dev, "rtc_timer_start failed: %d\n", ret);
                __pm_wakeup_event(ws, MSEC_PER_SEC);
+       }
        return ret;
 }
 #else