Commit ce0b0989 authored by John Stultz's avatar John Stultz

x86: Fix vrtc_get_time/set_mmss to use new timespec interface

The patch "x86: Increase precision of x86_platform.get/set_wallclock"
changed the x86 platform set_wallclock/get_wallclock interfaces to
use nsec granular timespecs instead of a second granular interface.

However, that patch missed converting the vrtc code, so this patch
converts those functions to use timespecs.

Many thanks to the kbuild test robot for finding this!
Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent 5c83545f
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
extern unsigned char vrtc_cmos_read(unsigned char reg); extern unsigned char vrtc_cmos_read(unsigned char reg);
extern void vrtc_cmos_write(unsigned char val, unsigned char reg); extern void vrtc_cmos_write(unsigned char val, unsigned char reg);
extern unsigned long vrtc_get_time(void); extern void vrtc_get_time(struct timespec *now);
extern int vrtc_set_mmss(unsigned long nowtime); extern int vrtc_set_mmss(const struct timespec *now);
#endif #endif
...@@ -56,7 +56,7 @@ void vrtc_cmos_write(unsigned char val, unsigned char reg) ...@@ -56,7 +56,7 @@ void vrtc_cmos_write(unsigned char val, unsigned char reg)
} }
EXPORT_SYMBOL_GPL(vrtc_cmos_write); EXPORT_SYMBOL_GPL(vrtc_cmos_write);
unsigned long vrtc_get_time(void) void vrtc_get_time(struct timespec *now)
{ {
u8 sec, min, hour, mday, mon; u8 sec, min, hour, mday, mon;
unsigned long flags; unsigned long flags;
...@@ -82,17 +82,18 @@ unsigned long vrtc_get_time(void) ...@@ -82,17 +82,18 @@ unsigned long vrtc_get_time(void)
printk(KERN_INFO "vRTC: sec: %d min: %d hour: %d day: %d " printk(KERN_INFO "vRTC: sec: %d min: %d hour: %d day: %d "
"mon: %d year: %d\n", sec, min, hour, mday, mon, year); "mon: %d year: %d\n", sec, min, hour, mday, mon, year);
return mktime(year, mon, mday, hour, min, sec); now->tv_sec = mktime(year, mon, mday, hour, min, sec);
now->tv_nsec = 0;
} }
int vrtc_set_mmss(unsigned long nowtime) int vrtc_set_mmss(const struct timespec *now)
{ {
unsigned long flags; unsigned long flags;
struct rtc_time tm; struct rtc_time tm;
int year; int year;
int retval = 0; int retval = 0;
rtc_time_to_tm(nowtime, &tm); rtc_time_to_tm(now->tv_sec, &tm);
if (!rtc_valid_tm(&tm) && tm.tm_year >= 72) { if (!rtc_valid_tm(&tm) && tm.tm_year >= 72) {
/* /*
* tm.year is the number of years since 1900, and the * tm.year is the number of years since 1900, and the
...@@ -110,7 +111,7 @@ int vrtc_set_mmss(unsigned long nowtime) ...@@ -110,7 +111,7 @@ int vrtc_set_mmss(unsigned long nowtime)
} else { } else {
printk(KERN_ERR printk(KERN_ERR
"%s: Invalid vRTC value: write of %lx to vRTC failed\n", "%s: Invalid vRTC value: write of %lx to vRTC failed\n",
__FUNCTION__, nowtime); __FUNCTION__, now->tv_sec);
retval = -EINVAL; retval = -EINVAL;
} }
return retval; return retval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment