Commit 049aaf9f authored by Grygorii Strashko's avatar Grygorii Strashko Committed by Linus Walleij

gpio: pcf857x: get rid of slock spinlock

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: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 65194cb1
...@@ -88,7 +88,6 @@ struct pcf857x { ...@@ -88,7 +88,6 @@ struct pcf857x {
struct gpio_chip chip; struct gpio_chip chip;
struct i2c_client *client; struct i2c_client *client;
struct mutex lock; /* protect 'out' */ struct mutex lock; /* protect 'out' */
spinlock_t slock; /* protect irq demux */
unsigned out; /* software latch */ unsigned out; /* software latch */
unsigned status; /* current status */ unsigned status; /* current status */
unsigned int irq_parent; unsigned int irq_parent;
...@@ -185,23 +184,21 @@ static void pcf857x_set(struct gpio_chip *chip, unsigned offset, int value) ...@@ -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) static irqreturn_t pcf857x_irq(int irq, void *data)
{ {
struct pcf857x *gpio = data; struct pcf857x *gpio = data;
unsigned long change, i, status, flags; unsigned long change, i, status;
status = gpio->read(gpio->client); status = gpio->read(gpio->client);
spin_lock_irqsave(&gpio->slock, flags);
/* /*
* call the interrupt handler iff gpio is used as * call the interrupt handler iff gpio is used as
* interrupt source, just to avoid bad irqs * interrupt source, just to avoid bad irqs
*/ */
mutex_lock(&gpio->lock);
change = (gpio->status ^ status) & gpio->irq_enabled; 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; 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; return IRQ_HANDLED;
} }
...@@ -293,7 +290,6 @@ static int pcf857x_probe(struct i2c_client *client, ...@@ -293,7 +290,6 @@ static int pcf857x_probe(struct i2c_client *client,
return -ENOMEM; return -ENOMEM;
mutex_init(&gpio->lock); mutex_init(&gpio->lock);
spin_lock_init(&gpio->slock);
gpio->chip.base = pdata ? pdata->gpio_base : -1; gpio->chip.base = pdata ? pdata->gpio_base : -1;
gpio->chip.can_sleep = true; gpio->chip.can_sleep = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment