public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: "Juha Yrjölä" <juha.yrjola@solidboot.com>
To: Jani Nikula <ext-jani.1.nikula@nokia.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH] ARM: OMAP: Add support for dynamic GPIO switch update
Date: Mon, 15 Dec 2008 15:40:10 +0200	[thread overview]
Message-ID: <20081215134010.GA10709@mail.solidboot.com> (raw)
In-Reply-To: <1229342896-7363-1-git-send-email-ext-jani.1.nikula@nokia.com>

On Mon, Dec 15, 2008 at 02:08:16PM +0200, Jani Nikula wrote:

> Add new function omap_update_gpio_switch() to support dynamically
> changing the GPIO switch notify callback functions and debounce
> timeouts.

Why do they need to be changed? GPIO switches related to the board schematics,
which do not hopefully change dynamically.

> +	spin_lock_irqsave(&sw->lock, flags);
>  	if (state)
>  		timeout = sw->debounce_rising;
>  	else
>  		timeout = sw->debounce_falling;
> +	spin_unlock_irqrestore(&sw->lock, flags);

What's the point of this? The above read can be consider an atomic operation.

> +	spin_lock_irqsave(&sw->lock, flags);
> +	notify = sw->notify;
> +	notify_data = sw->notify_data;
> +	spin_unlock_irqrestore(&sw->lock, flags);
> +
> +	if (notify != NULL)
> +		notify(notify_data, state);

What if omap_update_gpio_switch() is called just before the check for
notify != NULL from another (hypothetical =)) CPU? Then you end up with the
function completing, but still having the old notify callback called with
old notify_data.

Cheers,
Juha

  parent reply	other threads:[~2008-12-15 14:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15 12:08 [PATCH] ARM: OMAP: Add support for dynamic GPIO switch update Jani Nikula
2008-12-15 12:14 ` Trilok Soni
2008-12-15 13:31   ` Felipe Balbi
2008-12-15 13:22 ` Felipe Balbi
2008-12-15 13:44   ` Jani Nikula
2008-12-15 13:56     ` Felipe Balbi
2008-12-15 13:40 ` Juha Yrjölä [this message]
2008-12-15 14:52   ` Jani Nikula
2008-12-15 15:29     ` Juha Yrjölä
2008-12-15 15:58       ` Jani Nikula
2008-12-16  6:05         ` Trilok Soni
2008-12-18 11:42           ` GPIO switch framework (was: Re: [PATCH] ARM: OMAP: Add support for dynamic GPIO switch update) Jani Nikula
2008-12-18 13:00             ` Trilok Soni
2008-12-18 13:40               ` Jani Nikula
2008-12-19  8:47                 ` Trilok Soni
2008-12-19  8:51                   ` Brian Swetland
2008-12-21 20:26             ` David Brownell

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=20081215134010.GA10709@mail.solidboot.com \
    --to=juha.yrjola@solidboot.com \
    --cc=ext-jani.1.nikula@nokia.com \
    --cc=linux-omap@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