Messages in this thread | | | Date | Sun, 26 Oct 2008 22:14:31 -0700 | From | Andrew Morton <> | 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@opensource.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?
| |