Re: [rtc-linux] [PATCH] add support for ST M41T94 SPI RTC
From: Alessandro Zummo
Date: Wed May 14 2008 - 09:08:33 EST
On Wed, 14 May 2008 15:19:37 +0300
"Kim B. Heino" <Kim.Heino@xxxxxxxxxxxx> 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@xxxxxxxxxxxx>");
> +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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/