[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20081026221431.7100bbf7.akpm@linux-foundation.org>
Date: Sun, 26 Oct 2008 22:14:31 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc: Alessandro Zummo <a.zummo@...ertech.it>,
linux-kernel@...r.kernel.org, rtc-linux@...glegroups.com
Subject: Re: [PATCH 2/2] rtc: rtc-wm8350: Add support for WM8350 RTC
On Mon, 20 Oct 2008 20:35:18 +0100 Mark Brown <broonie@...nsource.wolfsonmicro.com> wrote:
> +static int wm8350_rtc_stop_alarm(struct wm8350 *wm8350)
> +{
> + int retries = WM8350_SET_ALM_RETRIES;
> + u16 rtc_ctrl;
> + int ret;
> +
> + /* Set RTC_SET to stop the clock */
> + ret = wm8350_set_bits(wm8350, WM8350_RTC_TIME_CONTROL,
> + WM8350_RTC_ALMSET);
> + if (ret < 0)
> + return ret;
> +
> + /* Wait until confirmation of stopping */
> + do {
> + rtc_ctrl = wm8350_reg_read(wm8350, WM8350_RTC_TIME_CONTROL);
> + schedule_timeout_interruptible(msecs_to_jiffies(1));
If the calling process has signal_pending() (eg: someone typed ^C) then
schedule_timeout_interruptible() will return immediately.
> + } while (retries-- && !(rtc_ctrl & WM8350_RTC_ALMSTS));
> +
> + if (!(rtc_ctrl & WM8350_RTC_ALMSTS))
> + return -ETIMEDOUT;
And the driver will incorrectly return -ETIMEDOUT.
> + return 0;
> +}
> +
> +static int wm8350_rtc_start_alarm(struct wm8350 *wm8350)
> +{
> + int ret;
> + int retries = WM8350_SET_ALM_RETRIES;
> + u16 rtc_ctrl;
> +
> + ret = wm8350_clear_bits(wm8350, WM8350_RTC_TIME_CONTROL,
> + WM8350_RTC_ALMSET);
> + if (ret < 0)
> + return ret;
> +
> + /* Wait until confirmation */
> + do {
> + rtc_ctrl = wm8350_reg_read(wm8350, WM8350_RTC_TIME_CONTROL);
> + schedule_timeout_interruptible(msecs_to_jiffies(1));
> + } while (retries-- && rtc_ctrl & WM8350_RTC_ALMSTS);
> +
> + if (rtc_ctrl & WM8350_RTC_ALMSTS)
> + return -ETIMEDOUT;
ditto.
> + return 0;
> +}
I'll switch those to schedule_timeout_uninterruptible(), OK?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists