All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Vincent Pelletier <plr.vincent@gmail.com>
Cc: linux-leds@vger.kernel.org
Subject: Re: leds-gpio on x86
Date: Tue, 18 Aug 2015 12:02:16 +0300	[thread overview]
Message-ID: <20150818090216.GG1552@lahna.fi.intel.com> (raw)
In-Reply-To: <20150818093226.3db0b553@x2>

On Tue, Aug 18, 2015 at 09:32:26AM +0200, Vincent Pelletier wrote:
> On Mon, 17 Aug 2015 23:08:23 +0200, Vincent Pelletier
> <plr.vincent@gmail.com> wrote:
> > How can I debug this further ?
> 
> I made a bit of progress: disabling all but one cpu (...which, in this
> case, just means disabling the second core) makes the error messages go
> away, and blinking works fine.
> 
> There is a lock taken in __request_region, and released around
> schedule() when muxed. I guess this means region request is just pushed
> into a queue when resource is busy, then scheduler is told to let
> whatever else available run.
> I have no idea if the lock should be taken before or after
> remove_wait_queue after schedule call.

For each GPIO operation the f7188x driver calls
superio_enter()/superio_exit().

However, I don't think that is enough to prevent multiple threads
accessing a GPIO at the same time.

One option is to add mutex to the private structure and then do
something like this in each callback:

static int f7188x_gpio_get(...)
{
	mutex_lock(&sio->lock);
	
	/* request the resource and touch the hardware */

	mutex_unlock(&sio->lock);

	...
}

It is a bit weird that it needs to acquire/release the ioport region each
time.

  reply	other threads:[~2015-08-18  9:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 20:09 leds-gpio on x86 Vincent Pelletier
2015-08-06 16:59 ` Mika Westerberg
2015-08-06 17:17   ` Vincent Pelletier
2015-08-06 17:35     ` Mika Westerberg
2015-08-06 18:18       ` Vincent Pelletier
2015-08-07 10:57         ` Mika Westerberg
2015-08-08 12:06           ` Vincent Pelletier
2015-08-11 12:00             ` Mika Westerberg
2015-08-11 17:42               ` Vincent Pelletier
2015-08-12 12:53                 ` Mika Westerberg
2015-08-15 10:36                   ` Vincent Pelletier
2015-08-17 21:08                     ` Vincent Pelletier
2015-08-18  7:32                       ` Vincent Pelletier
2015-08-18  9:02                         ` Mika Westerberg [this message]
2015-08-18 11:38                           ` Vincent Pelletier
2015-08-18 22:56                             ` Vincent Pelletier

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=20150818090216.GG1552@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=plr.vincent@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.