From: Julia Lawall Date: Mon, 28 Apr 2008 09:11:59 +0000 (-0700) Subject: drivers/char/rtc.c: use time_before, time_before_eq, etc X-Git-Tag: v2.6.26-rc1~1012 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=dca03a51549bc645685fb8a77efa64df531666c3;p=linux-2.6-omap-h63xx.git drivers/char/rtc.c: use time_before, time_before_eq, etc The functions time_before, time_before_eq, time_after, and time_after_eq are more robust for comparing jiffies against other values. A simplified version of the semantic patch making this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @ change_compare_np @ expression E; @@ ( - jiffies <= E + time_before_eq(jiffies,E) | - jiffies >= E + time_after_eq(jiffies,E) | - jiffies < E + time_before(jiffies,E) | - jiffies > E + time_after(jiffies,E) ) @ include depends on change_compare_np @ @@ #include @ no_include depends on !include && change_compare_np @ @@ #include + #include // Signed-off-by: Julia Lawall Cc: Ingo Molnar Cc: Thomas Gleixner Cc: Alessandro Zummo Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 5c3142b6f1f..e2ec2ee4cf7 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c @@ -88,6 +88,7 @@ #ifdef CONFIG_SPARC32 #include +#include #include static unsigned long rtc_port; @@ -1316,7 +1317,8 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) * Once the read clears, read the RTC time (again via ioctl). Easy. */ - while (rtc_is_updating() != 0 && jiffies - uip_watchdog < 2*HZ/100) + while (rtc_is_updating() != 0 && + time_before(jiffies, uip_watchdog + 2*HZ/100)) cpu_relax(); /*