Re: [patch 2.6.19-rc6 6/6] rtc-omap driver

From: Andrew Morton
Date: Tue Nov 21 2006 - 20:19:59 EST


On Mon, 20 Nov 2006 10:28:48 -0800
David Brownell <david-b@xxxxxxxxxxx> wrote:

> This creates a new RTC-framework driver for the RTC/calendar module found
> in various OMAP1 chips. (OMAP2 and OMAP3 use external RTCs, like those in
> TI's multifunction PM companion chips.) It's been in the Linux-OMAP tree
> for several months now, and other trees before that, so it's quite stable.
> The most notable issue is that the OMAP IRQ code doesn't yet support the
> RTC IRQ as a wakeup event. Once that's fixed, a patch will be needed.
>
> ...
>
> +static int omap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
> +{
> + u8 reg;
> +
> + /* Much userspace code uses RTC_ALM_SET, thus "don't care" for
> + * day/month/year specifies alarms up to 24 hours in the future.
> + * So we need to handle that ... but let's ignore the "don't care"
> + * values for hours/minutes/seconds.
> + */
> + if (alm->time.tm_mday <= 0
> + && alm->time.tm_mon < 0
> + && alm->time.tm_year < 0) {
> + struct rtc_time tm;
> + unsigned long now, then;
> +
> + omap_rtc_read_time(dev, &tm);
> + rtc_tm_to_time(&tm, &now);
> +
> + alm->time.tm_mday = tm.tm_mday;
> + alm->time.tm_mon = tm.tm_mon;
> + alm->time.tm_year = tm.tm_year;
> + rtc_tm_to_time(&alm->time, &then);
> +
> + /* sometimes the alarm wraps into tomorrow */
> + if (then < now) {

This isn't wraparound-safe. If you have then=0xffffffff and now=0x00000001.

Perhaps that can't happen.

> +MODULE_AUTHOR("George G. Davis (and others)");

Maybe some additional signoffs would be appropirate?
-
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/