From: Andrew Morton <akpm@linux-foundation.org>
To: Kevin Hilman <khilman@deeprootsystems.com>
Cc: rtc-linux@googlegroups.com,
Miguel Aguilar <miguel.aguilar@ridgerun.com>,
Paul Gortmaker <p_gortmaker@yahoo.com>,
Alessandro Zummo <a.zummo@towertech.it>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Samuel Ortiz <sameo@linux.intel.com>,
Kyle McMartin <kyle@mcmartin.ca>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RTC: DaVinci RTC driver
Date: Mon, 15 Mar 2010 14:20:24 -0700 [thread overview]
Message-ID: <20100315142024.afa998d9.akpm@linux-foundation.org> (raw)
In-Reply-To: <1268420914-6731-1-git-send-email-khilman@deeprootsystems.com>
On Fri, 12 Mar 2010 11:08:33 -0800
Kevin Hilman <khilman@deeprootsystems.com> wrote:
> +static int convertfromdays(u16 days, struct rtc_time *tm)
> +{
> + int tmp_days, year, mon;
> +
> + for (year = 2000;; year++) {
> + tmp_days = rtc_year_days(1, 12, year);
> + if (days >= tmp_days)
> + days -= tmp_days;
> + else {
> + for (mon = 0;; mon++) {
> + tmp_days = rtc_month_days(mon, year);
> + if (days >= tmp_days) {
> + days -= tmp_days;
> + } else {
> + tm->tm_year = year - 1900;
> + tm->tm_mon = mon;
> + tm->tm_mday = days + 1;
> + break;
> + }
> + }
> + break;
> + }
> + }
> + return 0;
> +}
> +
> +static int convert2days(u16 *days, struct rtc_time *tm)
> +{
> + int i;
> + *days = 0;
> +
> + /* epoch == 1900 */
> + if (tm->tm_year < 100 || tm->tm_year > 199)
> + return -EINVAL;
> +
> + for (i = 2000; i < 1900 + tm->tm_year; i++)
> + *days += rtc_year_days(1, 12, i);
> +
> + *days += rtc_year_days(tm->tm_mday, tm->tm_mon, 1900 + tm->tm_year);
> +
> + return 0;
> +}
I'm looking suspiciously at these (slow-looking) functions. Are they
really specific to this device, or could we be making better use of
library code, or adding functionality to library code?
next prev parent reply other threads:[~2010-03-15 21:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-12 19:08 [PATCH] RTC: DaVinci RTC driver Kevin Hilman
2010-03-12 19:24 ` Alessandro Zummo
2010-03-12 22:09 ` Kevin Hilman
2010-03-13 1:26 ` Alessandro Zummo
2010-03-15 21:20 ` Andrew Morton [this message]
2010-03-15 22:32 ` Alessandro Zummo
2010-03-15 22:33 ` [rtc-linux] " Alessandro Zummo
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=20100315142024.afa998d9.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=a.zummo@towertech.it \
--cc=geert@linux-m68k.org \
--cc=khilman@deeprootsystems.com \
--cc=kyle@mcmartin.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.aguilar@ridgerun.com \
--cc=p_gortmaker@yahoo.com \
--cc=rtc-linux@googlegroups.com \
--cc=sameo@linux.intel.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.