lkml.org 
[lkml]   [2008]   [May]   [14]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateWed, 14 May 2008 15:08:20 +0200
FromAlessandro Zummo <>
SubjectRe: [rtc-linux] [PATCH] add support for ST M41T94 SPI RTC
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



\
 
 \ /
  Last update: 2008-05-14 15:11    [from the cache]
©2003-2008