Re: [rtc-linux] [PATCH 2/2] MAX8997/8966 RTC Driver Initial Release

From: Mark Brown
Date: Sat Mar 05 2011 - 07:06:54 EST


On Fri, Mar 04, 2011 at 04:48:44PM +0900, MyungJoo Ham wrote:

> +static void tm_to_data(struct rtc_time *tm, u8 *data)
> +{
> + data[RTC_SEC] = bin2bcd(tm->tm_sec) & 0x7f;
> + data[RTC_MIN] = bin2bcd(tm->tm_min) & 0x7f;
> + data[RTC_HOUR] = bin2bcd(tm->tm_hour) & 0x3f;
> + data[RTC_WEEKDAY] = wday_kernel_to_8997(tm->tm_wday) & 0x7f;
> + data[RTC_MONTH] = bin2bcd(tm->tm_mon) & 0x1f;
> + data[RTC_YEAR] = bin2bcd((tm->tm_year > 100) ? (tm->tm_year - 100) : 0)
> + & 0x7f;
> + data[RTC_MONTHDAY] = bin2bcd(tm->tm_mday) & 0x3f;
> +
> + if (tm->tm_year < 100) /* Prior 2000 */
> + pr_warn("MAX8997 RTC cannot handle the year %d. "
> + "Assume it's 2000.\n", 1900 + tm->tm_year);

It seems like an attempt to set an unsupported year should return an
error rather than just displaying a warning (though the warning is
useful so the user can figure out what went wrong).

> +MODULE_DESCRIPTION("MAXIM 8997/8966 RTC Driver");
> +MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@xxxxxxxxxxx>");
> +MODULE_LICENSE("GPL");

A MODULE_ALIAS() would allow the driver to be automatically loaded when
built as a module.
--
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/