[RFC/PATCH] Implement {read,update}_persistent_clock. v2
Milton Miller
miltonm at bga.com
Wed Sep 12 00:34:13 EST 2007
On Tue Sep 11 18:17:46 EST 2007, Tony Breeds wrote:
> +unsigned long read_persistent_clock(void)
> {
> struct rtc_time tm;
> + static int first = 1;
> +
> + if (first) {
> + first = 0;
> + if (ppc_md.time_init)
> + timezone_offset = ppc_md.time_init();
> + }
>
> - if (ppc_md.get_boot_time)
> - return ppc_md.get_boot_time();
> + /* get_boot_time() isn't guaranteed to be safe to call late */
> + /* FIXME: is the a better check available here? */
> + if (system_state != SYSTEM_RUNNING && ppc_md.get_boot_time)
> + return ppc_md.get_boot_time() -timezone_offset;
> if (!ppc_md.get_rtc_time)
> return 0;
> ppc_md.get_rtc_time(&tm);
>
Previously we called ppc_md.get_boot_time at most once. How about
moving the check for it into the if (first) block?
Have you tested with a platform that doesn't implement get_rtc_time?
milton
More information about the Linuxppc-dev
mailing list