Re: [rtc-linux] Re: [PATCH 2/2] rtc: Add boot_timesource sysfsattribute

From: Mark Brown
Date: Sat Sep 05 2009 - 21:35:38 EST


On Fri, Sep 04, 2009 at 06:09:28PM +0100, Matthew Garrett wrote:

> +hctosys: 1 if the RTC provided the system time at boot via the
> + CONFIG_RTC_HCTOSYS kernel option, 0 otherwise

...

> +static ssize_t
> +rtc_sysfs_show_hctosys(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> +#ifdef CONFIG_RTC_HCTOSYS_DEVICE
> + if (strcmp(dev_name(&to_rtc_device(dev)->dev),
> + CONFIG_RTC_HCTOSYS_DEVICE) == 0)
> + return sprintf(buf, "1\n");
> + else
> +#endif

Strictly speaking this only reports if the RTC was configured to provide
the system time at boot, it does not check to see if it actually
succeeded in doing so. Obviously failures here are a relatively rare
occurrance but they can happen. I don't think it's worth changing the
code since it's unlikely userspace will be able to do any better than
the kernel did but it might be worth updating the documentation just in
case.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/