diff mbox series

[for,next,v1,2/2] gpio: grgpio: Replace spin_lock_irqsave with spin_lock in grgpio_irq_handler()

Message ID 1612774677-56758-3-git-send-email-luojiaxing@huawei.com
State New
Headers show
Series gpio: few clean up patches to replace spin_lock_irqsave with spin_lock | expand

Commit Message

luojiaxing Feb. 8, 2021, 8:57 a.m. UTC
There is no need to use API with _irqsave in grgpio_irq_handler(),
because it already be in a irq-disabled context.

Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
---
 drivers/gpio/gpio-grgpio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Andy Shevchenko Feb. 10, 2021, 10:52 a.m. UTC | #1
On Mon, Feb 8, 2021 at 10:58 AM Luo Jiaxing <luojiaxing@huawei.com> wrote:
>
> There is no need to use API with _irqsave in grgpio_irq_handler(),
> because it already be in a irq-disabled context.

It seems you haven't read the code. The handler here is shared. And
lock there is about something else that we discussed in the cover
letter.
Moreover, the driver is quite outdated and code inside is horrible
according to the modern APIs / standards.

I would rather remove the driver completely.
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c
index f954359..fa5aa31 100644
--- a/drivers/gpio/gpio-grgpio.c
+++ b/drivers/gpio/gpio-grgpio.c
@@ -195,11 +195,10 @@  static irqreturn_t grgpio_irq_handler(int irq, void *dev)
 {
 	struct grgpio_priv *priv = dev;
 	int ngpio = priv->gc.ngpio;
-	unsigned long flags;
 	int i;
 	int match = 0;
 
-	spin_lock_irqsave(&priv->gc.bgpio_lock, flags);
+	spin_lock(&priv->gc.bgpio_lock);
 
 	/*
 	 * For each gpio line, call its interrupt handler if it its underlying
@@ -215,7 +214,7 @@  static irqreturn_t grgpio_irq_handler(int irq, void *dev)
 		}
 	}
 
-	spin_unlock_irqrestore(&priv->gc.bgpio_lock, flags);
+	spin_unlock(&priv->gc.bgpio_lock);
 
 	if (!match)
 		dev_warn(priv->dev, "No gpio line matched irq %d\n", irq);