linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Venu Byravarasu <vbyravarasu@nvidia.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	"rtc-linux@googlegroups.com" <rtc-linux@googlegroups.com>
Cc: Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>,
	Alessandro Zummo <a.zummo@towertech.it>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Ivan Kuten <ivan.kuten@promwad.com>
Subject: RE: [rtc-linux] [PATCH] RTC: Add driver for NXP PCF8523 RTC chip
Date: Thu, 2 Feb 2012 08:53:31 +0530	[thread overview]
Message-ID: <D958900912E20642BCBC71664EFECE3E6DD0B98F99@BGMAIL02.nvidia.com> (raw)
In-Reply-To: <20120201155235.044d77dc.akpm@linux-foundation.org>

> > +/*
> > + * In the routines that deal directly with the pcf8523 hardware, we use
> > + * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch.

Do we really need to limit year w.r.t. epoch?
Instead why don't you define a macro for base year in your driver itself?
With this, the same driver may be usable forever, without any modifications 
except for this macro (which also need to change once in a century).
If you use year w.r.t. epoch, this driver definitely need modification before year 2070.

> > + */
> > +static int pcf8523_get_datetime(struct i2c_client *client, struct rtc_time
> *tm)
> > +{
> > +	struct pcf8523 *pcf8523 = i2c_get_clientdata(client);
> > +	unsigned char buf[14] = { PCF8523_REG_CTL1 };
> > +	/* the clock can give out invalid datetime, but we cannot return
> > +	 * -EINVAL otherwise hwclock will refuse to set the time on bootup.
> > +	 */

Somehow I feel to set the RTC to a known time, probably the BASE year, in such
error cases.
> 
> This comment seems to imply that the driver allows hwclock to set the
> time to something which we know is incorrect?  If so, wouldn't it be
> better to leave the time at something obviously wrong, such as 1 Jan
> 1970?
> 
> > +	if (rtc_valid_tm(tm) < 0)
> > +		dev_err(&client->dev, "retrieved date/time is not valid.\n");
> > +
> > +	return 0;
> > +}

  reply	other threads:[~2012-02-02  3:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-05 11:57 [PATCH] RTC: Add driver for NXP PCF8523 RTC chip Yauhen Kharuzhy
2012-02-01 23:52 ` [rtc-linux] " Andrew Morton
2012-02-02  3:23   ` Venu Byravarasu [this message]
2012-02-07 23:28 ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D958900912E20642BCBC71664EFECE3E6DD0B98F99@BGMAIL02.nvidia.com \
    --to=vbyravarasu@nvidia.com \
    --cc=a.zummo@towertech.it \
    --cc=akpm@linux-foundation.org \
    --cc=ivan.kuten@promwad.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=yauhen.kharuzhy@promwad.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).