* [PATCH] gpio: pcf857x: get rid of slock spinlock
@ 2015-06-25 15:18 Grygorii Strashko
2015-07-16 8:45 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Grygorii Strashko @ 2015-06-25 15:18 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot
Cc: Sekhar Nori, linux-gpio, linux-kernel, Grygorii Strashko,
Geert Uytterhoeven
The spinlock 'slock' is used now to protect pcf857x_irq() from itself
which is unnecessary (especially after switching to use threaded
IRQs). Hence, remove it and use mutex to protect device data in IRQ
handler.
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
drivers/gpio/gpio-pcf857x.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
index 404f3c6..1d4d9bc 100644
--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -88,7 +88,6 @@ struct pcf857x {
struct gpio_chip chip;
struct i2c_client *client;
struct mutex lock; /* protect 'out' */
- spinlock_t slock; /* protect irq demux */
unsigned out; /* software latch */
unsigned status; /* current status */
unsigned int irq_parent;
@@ -185,23 +184,21 @@ static void pcf857x_set(struct gpio_chip *chip, unsigned offset, int value)
static irqreturn_t pcf857x_irq(int irq, void *data)
{
struct pcf857x *gpio = data;
- unsigned long change, i, status, flags;
+ unsigned long change, i, status;
status = gpio->read(gpio->client);
- spin_lock_irqsave(&gpio->slock, flags);
-
/*
* call the interrupt handler iff gpio is used as
* interrupt source, just to avoid bad irqs
*/
-
+ mutex_lock(&gpio->lock);
change = (gpio->status ^ status) & gpio->irq_enabled;
- for_each_set_bit(i, &change, gpio->chip.ngpio)
- handle_nested_irq(irq_find_mapping(gpio->chip.irqdomain, i));
gpio->status = status;
+ mutex_unlock(&gpio->lock);
- spin_unlock_irqrestore(&gpio->slock, flags);
+ for_each_set_bit(i, &change, gpio->chip.ngpio)
+ handle_nested_irq(irq_find_mapping(gpio->chip.irqdomain, i));
return IRQ_HANDLED;
}
@@ -293,7 +290,6 @@ static int pcf857x_probe(struct i2c_client *client,
return -ENOMEM;
mutex_init(&gpio->lock);
- spin_lock_init(&gpio->slock);
gpio->chip.base = pdata ? pdata->gpio_base : -1;
gpio->chip.can_sleep = true;
--
2.4.4
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] gpio: pcf857x: get rid of slock spinlock
2015-06-25 15:18 [PATCH] gpio: pcf857x: get rid of slock spinlock Grygorii Strashko
@ 2015-07-16 8:45 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2015-07-16 8:45 UTC (permalink / raw)
To: Grygorii Strashko
Cc: Alexandre Courbot, Sekhar Nori, linux-gpio, linux-kernel,
Geert Uytterhoeven
On Thu, Jun 25, 2015 at 5:18 PM, Grygorii Strashko
<grygorii.strashko@ti.com> wrote:
> The spinlock 'slock' is used now to protect pcf857x_irq() from itself
> which is unnecessary (especially after switching to use threaded
> IRQs). Hence, remove it and use mutex to protect device data in IRQ
> handler.
>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
No comments, so patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-16 8:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-25 15:18 [PATCH] gpio: pcf857x: get rid of slock spinlock Grygorii Strashko
2015-07-16 8:45 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®