lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 14 Jun 2013 12:20:56 -0700
From:	John Stultz <john.stultz@...aro.org>
To:	Alexander Holler <holler@...oftware.de>
CC:	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	rtc-linux@...glegroups.com, Thomas Gleixner <tglx@...utronix.de>,
	Alessandro Zummo <a.zummo@...ertech.it>
Subject: Re: [PATCH 8/9] RFC: rtc: hctosys: support rtc_read_timeval() for
 high precision clocks

On 06/14/2013 09:52 AM, Alexander Holler wrote:
> Some RTCs do provide a higher precision than seconds. Add support for them
> by trying rtc_read_timeval() before using rtc_read_time() to get the time
> in the hctosys mechanism.
>
>
[snip]
> +	rc = rtc_read_timeval(rtc, &tv);
> +	if (rc || (!tv.tv_sec && !tv.tv_usec)) {
> +		rc = rtc_read_time(rtc, &now);
> +		if (unlikely(rc)) {
> +			dev_err(rtc->dev.parent,
> +				"rtc core: error reading time from RTC: %d\n",
> +				rc);
> +			return;
> +		}
> +		rtc_tm_to_time(&now, &ts.tv_sec);
> +		ts.tv_nsec = NSEC_PER_SEC >> 1;
> +	} else {
> +		rtc_time_to_tm(tv.tv_sec, &now);
> +		ts.tv_sec = tv.tv_sec;
> +		ts.tv_nsec = tv.tv_usec*NSEC_PER_USEC;


Yea, this sort of fallback logic should be centralized in the RTC layer 
rather then in the individual users.

Might be easiest to modify the rtc_read_timeval() interface to try the 
ops->read_timeval() operation and do the fallback to rtc_read_time() 
internally.

thanks
-john

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ