Subject: Re: [RFC/PATCH] Implement {read,update}_persistent_clock. v2

From: Milton Miller <[email-masked]>
Date: Tue, 11 Sep 2007 09:34:13 -0500

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