linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philippe De Muyter <phdm@macqel.be>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH 2/2] rtc: add rtc-abx80x, a driver for the Abracon AB x80x i2c rtc
Date: Sun, 15 Mar 2015 16:10:17 +0100	[thread overview]
Message-ID: <20150315151017.GA31712@frolo.macqel> (raw)
In-Reply-To: <20150314180911.GC4560@piout.net>

On Sat, Mar 14, 2015 at 07:09:11PM +0100, Alexandre Belloni wrote:
> On 14/03/2015 at 13:44:41 +0100, Philippe De Muyter wrote :
> > > +	tm->tm_sec = bcd2bin(date[ABX8XX_REG_SC] & 0x7F);
> > > +	tm->tm_min = bcd2bin(date[ABX8XX_REG_MN] & 0x7F);
> > > +	tm->tm_hour = bcd2bin(date[ABX8XX_REG_HR] & 0x3F);
> > > +	tm->tm_wday = date[ABX8XX_REG_WD] & 0x7;
> > > +	tm->tm_mday = bcd2bin(date[ABX8XX_REG_DA] & 0x3F);
> > > +	tm->tm_mon = bcd2bin(date[ABX8XX_REG_MO] & 0x1F) - 1;
> > > +	tm->tm_year = bcd2bin(date[ABX8XX_REG_YR]);
> > > +	if (tm->tm_year < 70)
> > 
> > Is that still useful for a driver written in 2015 ?
> > 
> 
> I'd say that this is actually the only correct way to do it. Only dates
> before 01/01/1970 00:00 are considered invalid. So, unless adding a
> check like:
> 
> if (tm->tm_year < 100)
> 	return -EINVAL;
> 
> in abx80x_rtc_set_time, setting and then reading a date before 2000 will
> fail silently. I'm open to add that check.

You are right.  It is actually more a consistency problem between rtc
drivers and thus a question for the rtc-subsytem maintainer.

Philippe

-- 
Philippe De Muyter +32 2 6101532 Macq SA rue de l'Aeronef 2 B-1140 Bruxelles

  reply	other threads:[~2015-03-15 15:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-14 10:05 [PATCH 0/2] rtc: add Abracon ABx80x Alexandre Belloni
2015-03-14 10:05 ` [PATCH 1/2] Documentation: bindings: add abracon,abx80x Alexandre Belloni
2015-03-14 10:05 ` [PATCH 2/2] rtc: add rtc-abx80x, a driver for the Abracon AB x80x i2c rtc Alexandre Belloni
2015-03-14 12:44   ` Philippe De Muyter
2015-03-14 18:09     ` Alexandre Belloni
2015-03-15 15:10       ` Philippe De Muyter [this message]
2015-03-16 10:16     ` Paul Bolle

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=20150315151017.GA31712@frolo.macqel \
    --to=phdm@macqel.be \
    --cc=a.zummo@towertech.it \
    --cc=akpm@linux-foundation.org \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.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).