From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Joe Perches <joe@perches.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com
Subject: Re: [PATCH] rtc: add Abracon ABx80x driver
Date: Sun, 1 Mar 2015 00:09:35 +0100 [thread overview]
Message-ID: <20150228230935.GG4094@piout.net> (raw)
In-Reply-To: <1425158574.31561.1.camel@perches.com>
On 28/02/2015 at 13:22:54 -0800, Joe Perches wrote :
> My thought was that it might be better to
> use a local struct rtc_time r like
>
> r.tm_sec = bcd2bin(date[AB08XX_REG_SC] & 0x7F);
> r.tm_min = bcd2bin(date[AB08XX_REG_MN] & 0x7F);
> r.tm_hour = bcd2bin(date[AB08XX_REG_HR] & 0x3F);
> r.tm_wday = date[AB08XX_REG_WD] & 0x7;
> r.tm_mday = bcd2bin(date[AB08XX_REG_DA] & 0x3F);
> r.tm_mon = bcd2bin(date[AB08XX_REG_MO] & 0x1F) - 1;
> r.tm_year = bcd2bin(date[AB08XX_REG_YR]);
> if (r.tm_year < 70)
> r.tm_year += 100;
>
> err = rtc_valid_tm(&r);
> if (!err)
> *tm = r;
> else
> dev_err(&client->dev, "retrieved date/time is not valid\n");
>
> return err;
>
I'm sure this is not needed as userspace has to bail out if the ioctl
fails. I'll let that up to the rtc maintainers though.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
prev parent reply other threads:[~2015-02-28 23:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-28 19:14 [PATCH] rtc: add Abracon ABx80x driver Alexandre Belloni
2015-02-28 19:32 ` Joe Perches
2015-02-28 20:52 ` Alexandre Belloni
2015-02-28 21:22 ` Joe Perches
2015-02-28 23:09 ` Alexandre Belloni [this message]
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=20150228230935.GG4094@piout.net \
--to=alexandre.belloni@free-electrons.com \
--cc=a.zummo@towertech.it \
--cc=joe@perches.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.