From: Alessandro Zummo <alessandro.zummo@towertech.it>
To: rtc-linux@googlegroups.com
Cc: Kim.Heino@bluegiga.com, linux-kernel@vger.kernel.org
Subject: Re: [rtc-linux] [PATCH] add support for ST M41T94 SPI RTC
Date: Wed, 14 May 2008 15:08:20 +0200 [thread overview]
Message-ID: <20080514150820.7eb523c6@i1501.lan.towertech.it> (raw)
In-Reply-To: <482AD8D9.4090805@bluegiga.com>
On Wed, 14 May 2008 15:19:37 +0300
"Kim B. Heino" <Kim.Heino@bluegiga.com> wrote:
>
> This patch adds kernel driver for M41T94 RTC chip connected via SPI.
> I've tested it on two different AT91-based hardwares.
Hi Kim,
just a few comments:
> +
> +#include <linux/module.h>
> +#include <linux/version.h>
> +
> +#include <linux/kernel.h>
> +#include <linux/platform_device.h>
> +#include <linux/init.h>
> +#include <linux/rtc.h>
> +#include <linux/spi/spi.h>
> +#include <linux/bcd.h>
can you check that you really require
all of those #includes ?
> +struct m41t94 {
> + struct rtc_device *rtc;
> + u8 buf[8]; /* Burst read cmd + 7 registers */
> +};
why are you keeping the buffer here?
> +
> + tm->tm_sec = BCD2BIN(spi_w8r8(spi, M41T94_REG_SECONDS));
> + tm->tm_min = BCD2BIN(spi_w8r8(spi, M41T94_REG_MINUTES));
> + tm->tm_hour = BCD2BIN(spi_w8r8(spi, M41T94_REG_HOURS));
> + tm->tm_wday = BCD2BIN(spi_w8r8(spi, M41T94_REG_WDAY)) - 1;
> + tm->tm_mday = BCD2BIN(spi_w8r8(spi, M41T94_REG_DAY));
> + tm->tm_mon = BCD2BIN(spi_w8r8(spi, M41T94_REG_MONTH)) - 1;
> + /* assume 20YY not 19YY, and ignore century bit */
> + tm->tm_year = BCD2BIN(spi_w8r8(spi, M41T94_REG_YEAR)) + 100;
the choice is up to you, but I'd use the century bit if there
is one.
> +
> +MODULE_AUTHOR ("Kim B. Heino <Kim.Heino@bluegiga.com>");
> +MODULE_DESCRIPTION ("Driver for ST M41T94 SPI RTC");
> +MODULE_LICENSE ("GPL");
no spaces between MODULE_XXX and the ( please.
--
Best regards,
Alessandro Zummo,
Tower Technologies - Torino, Italy
http://www.towertech.it
next prev parent reply other threads:[~2008-05-14 13:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-14 12:19 Kim B. Heino
2008-05-14 13:08 ` Alessandro Zummo [this message]
2008-05-14 14:23 ` [rtc-linux] " Kim B. Heino
2008-05-14 16:37 ` Maciej W. Rozycki
2008-05-14 18:53 ` 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=20080514150820.7eb523c6@i1501.lan.towertech.it \
--to=alessandro.zummo@towertech.it \
--cc=Kim.Heino@bluegiga.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®