From: Samuel Ortiz <sameo@linux.intel.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.34] mfd: Clean up after WM83xx AUXADC interrupt if it arrives late
Date: Fri, 2 Apr 2010 15:51:52 +0200 [thread overview]
Message-ID: <20100402135152.GH8010@sortiz.org> (raw)
In-Reply-To: <1270210119-16746-1-git-send-email-broonie@opensource.wolfsonmicro.com>
Hi Mark,
On Fri, Apr 02, 2010 at 01:08:39PM +0100, Mark Brown wrote:
> In certain circumstances, especially under heavy load, the AUXADC
> completion interrupt may be detected after we've timed out waiting for
> it. That conversion would still succeed but the next conversion will
> see the completion that was signalled by the interrupt for the previous
> conversion and therefore not wait for the AUXADC conversion to run,
> causing it to report failure.
>
> Provide a simple, non-invasive cleanup by using try_wait_for_completion()
> to ensure that the completion is not signalled before we wait. Since
> the AUXADC is run within a mutex we know there can only have been at
> most one AUXADC interrupt outstanding. A more involved change should
> follow for the next merge window.
Patch applied to my for-linus branch, thanks.
Cheers,
Samuel.
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
> drivers/mfd/wm831x-core.c | 3 +++
> drivers/mfd/wm8350-core.c | 4 ++++
> 2 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
> index a3d5728..f2ab025 100644
> --- a/drivers/mfd/wm831x-core.c
> +++ b/drivers/mfd/wm831x-core.c
> @@ -349,6 +349,9 @@ int wm831x_auxadc_read(struct wm831x *wm831x, enum wm831x_auxadc input)
> goto disable;
> }
>
> + /* If an interrupt arrived late clean up after it */
> + try_wait_for_completion(&wm831x->auxadc_done);
> +
> /* Ignore the result to allow us to soldier on without IRQ hookup */
> wait_for_completion_timeout(&wm831x->auxadc_done, msecs_to_jiffies(5));
>
> diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
> index e400a3b..b580748 100644
> --- a/drivers/mfd/wm8350-core.c
> +++ b/drivers/mfd/wm8350-core.c
> @@ -363,6 +363,10 @@ int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, int vref)
> reg |= 1 << channel | WM8350_AUXADC_POLL;
> wm8350_reg_write(wm8350, WM8350_DIGITISER_CONTROL_1, reg);
>
> + /* If a late IRQ left the completion signalled then consume
> + * the completion. */
> + try_wait_for_completion(&wm8350->auxadc_done);
> +
> /* We ignore the result of the completion and just check for a
> * conversion result, allowing us to soldier on if the IRQ
> * infrastructure is not set up for the chip. */
> --
> 1.7.0.3
>
--
Intel Open Source Technology Centre
http://oss.intel.com/
prev parent reply other threads:[~2010-04-02 13:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-02 12:08 [PATCH 2.6.34] mfd: Clean up after WM83xx AUXADC interrupt if it arrives late Mark Brown
2010-04-02 13:51 ` Samuel Ortiz [this message]
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=20100402135152.GH8010@sortiz.org \
--to=sameo@linux.intel.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox