From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] arm/imx/gpio: add spinlock protection
Date: Tue, 6 Jul 2010 09:17:02 +0200 [thread overview]
Message-ID: <20100706071702.GI26079@pengutronix.de> (raw)
In-Reply-To: <20100706050033.GA28547@jasper.tkos.co.il>
On Tue, Jul 06, 2010 at 08:00:34AM +0300, Baruch Siach wrote:
> Hi Sascha,
>
> On Mon, Jul 05, 2010 at 09:52:18AM +0200, Sascha Hauer wrote:
> > On Sun, Jul 04, 2010 at 10:15:13AM +0300, Baruch Siach wrote:
> > > The GPIO and IRQ/GPIO registers need protection from concurrent access for
> > > operations that are not atomic.
> >
> > I don't think we need locking here. mxc_gpio_irq_handler is called with
> > desc->lock held (from the parent interrupt, not the chained interrupts).
> > Other functions like enable_irq/disable_irq which result in mask/unmask
> > operations run with interrupts disabled.
>
> What about the .set_type method?
Is only called with interrupts disabled.
>
> Adding David Brownell to CC.
>
> > Apart from this other architectures do not use locking here aswell.
>
> The Nomadic gpio driver does use a spinlock for mask/unmask operations.
>
> What about the _set_gpio_direction, and mxc_gpio_set? These functions may be
> called from a process context (e.g., via sysfs). A context switch between
> __raw_readl and __raw_writel will cause corruption.
The gpio_chip functions are protected by a single spinlock in
gpiolib. The gpio related registers and the irq related regsiters are
totally orthogonal, so we need no locking between these registers.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2010-07-06 7:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-04 7:15 [RFC PATCH] arm/imx/gpio: add spinlock protection Baruch Siach
2010-07-05 7:02 ` Uwe Kleine-König
2010-07-05 7:52 ` Sascha Hauer
2010-07-06 5:00 ` Baruch Siach
2010-07-06 7:17 ` Sascha Hauer [this message]
2010-07-06 7:40 ` Baruch Siach
2010-07-06 10:07 ` Sascha Hauer
2010-07-06 10:37 ` Baruch Siach
2010-07-06 11:03 ` [PATCH v2] " Baruch Siach
2010-07-21 5:10 ` Baruch Siach
2010-07-29 6:42 ` Uwe Kleine-König
2010-08-02 7:29 ` [PATCH] ARM: imx: Fix build failure when including <mach/gpio.h> without <linux/spinlock.h> Uwe Kleine-König
2010-08-02 7:46 ` Baruch Siach
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=20100706071702.GI26079@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).