LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com
Subject: Re: [PATCH 2/2] rtc: rtc-wm8350: Add support for WM8350 RTC
Date: Sun, 26 Oct 2008 22:14:31 -0700	[thread overview]
Message-ID: <20081026221431.7100bbf7.akpm@linux-foundation.org> (raw)
In-Reply-To: <1224531318-10349-2-git-send-email-broonie@opensource.wolfsonmicro.com>

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?

  reply	other threads:[~2008-10-27  5:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-20 19:33 [PATCH 0/2] RTC updates Mark Brown
2008-10-20 19:35 ` [PATCH 1/2] rtc: Fix handling of missing tm_year data when reading alarms Mark Brown
2008-10-20 19:35   ` [PATCH 2/2] rtc: rtc-wm8350: Add support for WM8350 RTC Mark Brown
2008-10-27  5:14     ` Andrew Morton [this message]
2008-10-27 10:08       ` Mark Brown
2008-10-27 15:38 [PATCH 1/2] rtc: Fix handling of missing tm_year data when reading alarms Mark Brown
2008-10-27 15:38 ` [PATCH 2/2] rtc: rtc-wm8350: Add support for WM8350 RTC Mark Brown
2008-10-28  6:22   ` Andrew Morton
2008-10-28 10:02     ` Mark Brown
2008-10-27 17:26 [rtc-linux] " Alessandro Zummo
2008-10-27 17:40 ` Mark Brown
2008-10-28  6:24   ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081026221431.7100bbf7.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=a.zummo@towertech.it \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --subject='Re: [PATCH 2/2] rtc: rtc-wm8350: Add support for WM8350 RTC' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).