From: Alan Cox on
On Fri, 07 May 2010 11:51:06 -0700
Joe Perches <joe(a)perches.com> wrote:

> On Fri, 2010-05-07 at 10:41 -0700, Jacob Pan wrote:
> > + printk(KERN_INFO "vRTC: sec: %d min: %d hour: %d day: %d "
> > + "mon: %d year: %d\n", sec, min, hour, mday, mon, year);
> > +
>
> Even though many of the rtc drivers print this way, it seems
> a very backwards way of presenting time to me.

Consistency is really more important here IMHO - lots of drivers have set
an existing policy.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Joe Perches on
On Fri, 2010-05-07 at 10:41 -0700, Jacob Pan wrote:
> + printk(KERN_INFO "vRTC: sec: %d min: %d hour: %d day: %d "
> + "mon: %d year: %d\n", sec, min, hour, mday, mon, year);
> +

Even though many of the rtc drivers print this way, it seems
a very backwards way of presenting time to me.

I think "yyyy-mm-dd hh:mm:ss" is a better representation, more
compact and readable.

Also KERN_INFO may not be good, maybe KERN_DEBUG or pr_debug?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Joe Perches on
On Fri, 2010-05-07 at 20:02 +0100, Alan Cox wrote:
> On Fri, 07 May 2010 11:51:06 -0700
> Joe Perches <joe(a)perches.com> wrote:
> > On Fri, 2010-05-07 at 10:41 -0700, Jacob Pan wrote:
> > > + printk(KERN_INFO "vRTC: sec: %d min: %d hour: %d day: %d "
> > > + "mon: %d year: %d\n", sec, min, hour, mday, mon, year);
> > Even though many of the rtc drivers print this way, it seems
> > a very backwards way of presenting time to me.
> Consistency is really more important here IMHO - lots of drivers have set
> an existing policy.

(added Alessandro Zummo to cc's)

look at drivers/rtc.

All of them seem to use a templated copy/paste dev_dbg,
which seems to point to a use for a possible common rtc_util.c
or some such where this could be standardized.

Is there somewhere else this style is used?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: H. Peter Anvin on
On 05/07/2010 12:06 PM, Joe Perches wrote:
> On Fri, 2010-05-07 at 20:02 +0100, Alan Cox wrote:
>> On Fri, 07 May 2010 11:51:06 -0700
>> Joe Perches <joe(a)perches.com> wrote:
>>> On Fri, 2010-05-07 at 10:41 -0700, Jacob Pan wrote:
>>>> + printk(KERN_INFO "vRTC: sec: %d min: %d hour: %d day: %d "
>>>> + "mon: %d year: %d\n", sec, min, hour, mday, mon, year);
>>> Even though many of the rtc drivers print this way, it seems
>>> a very backwards way of presenting time to me.
>> Consistency is really more important here IMHO - lots of drivers have set
>> an existing policy.
>
> (added Alessandro Zummo to cc's)
>
> look at drivers/rtc.
>
> All of them seem to use a templated copy/paste dev_dbg,
> which seems to point to a use for a possible common rtc_util.c
> or some such where this could be standardized.
>
> Is there somewhere else this style is used?
>

Probably the right thing to do is to (a) move all this printing to
common code; (b) change to ISO 8601 format.

-hpa

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Feng Tang on
On Sat, 8 May 2010 03:56:09 +0800
"H. Peter Anvin" <hpa(a)zytor.com> wrote:


> >
>
> Probably the right thing to do is to (a) move all this printing to
> common code; (b) change to ISO 8601 format.
>
> -hpa
>

Thank you all for the comments. please review this follow-on patch.

- Feng
--
diff --git a/arch/x86/kernel/vrtc.c b/arch/x86/kernel/vrtc.c
index fa1eb63..0fbd74d 100644
--- a/arch/x86/kernel/vrtc.c
+++ b/arch/x86/kernel/vrtc.c
@@ -74,8 +74,8 @@ unsigned long vrtc_get_time(void)
/* vRTC YEAR reg contains the offset to 1960 */
year += 1960;

- printk(KERN_INFO "vRTC: sec: %d min: %d hour: %d day: %d "
- "mon: %d year: %d\n", sec, min, hour, mday, mon, year);
+ pr_debug("vrtc time: %4d-%02d-%02d %02d:%02d:%02d\n",
+ year, mon, mday, hour, min, sec);

return mktime(year, mon, mday, hour, min, sec);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/