public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: pinctrl-adi2: Remove nested lock+irqsave that resue flags.
@ 2013-09-23  9:29 Sonic Zhang
  2013-09-23 12:38 ` Dan Carpenter
  2013-09-27 12:22 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Sonic Zhang @ 2013-09-23  9:29 UTC (permalink / raw)
  To: Linus Walleij, dan.carpenter; +Cc: LKML, adi-buildroot-devel, Sonic Zhang

From: Sonic Zhang <sonic.zhang@analog.com>

Also avoid use NULL pointer in error message.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
 drivers/pinctrl/pinctrl-adi2.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c
index 7a24e59..6940612 100644
--- a/drivers/pinctrl/pinctrl-adi2.c
+++ b/drivers/pinctrl/pinctrl-adi2.c
@@ -247,7 +247,7 @@ static void adi_gpio_ack_irq(struct irq_data *d)
 	unsigned pintbit = hwirq_to_pintbit(port, d->hwirq);
 
 	spin_lock_irqsave(&port->lock, flags);
-	spin_lock_irqsave(&port->pint->lock, flags);
+	spin_lock(&port->pint->lock);
 
 	if (irqd_get_trigger_type(d) == IRQ_TYPE_EDGE_BOTH) {
 		if (readl(&regs->invert_set) & pintbit)
@@ -258,7 +258,7 @@ static void adi_gpio_ack_irq(struct irq_data *d)
 
 	writel(pintbit, &regs->request);
 
-	spin_unlock_irqrestore(&port->pint->lock, flags);
+	spin_unlock(&port->pint->lock);
 	spin_unlock_irqrestore(&port->lock, flags);
 }
 
@@ -270,7 +270,7 @@ static void adi_gpio_mask_ack_irq(struct irq_data *d)
 	unsigned pintbit = hwirq_to_pintbit(port, d->hwirq);
 
 	spin_lock_irqsave(&port->lock, flags);
-	spin_lock_irqsave(&port->pint->lock, flags);
+	spin_lock(&port->pint->lock);
 
 	if (irqd_get_trigger_type(d) == IRQ_TYPE_EDGE_BOTH) {
 		if (readl(&regs->invert_set) & pintbit)
@@ -282,7 +282,7 @@ static void adi_gpio_mask_ack_irq(struct irq_data *d)
 	writel(pintbit, &regs->request);
 	writel(pintbit, &regs->mask_clear);
 
-	spin_unlock_irqrestore(&port->pint->lock, flags);
+	spin_unlock(&port->pint->lock);
 	spin_unlock_irqrestore(&port->lock, flags);
 }
 
@@ -293,11 +293,11 @@ static void adi_gpio_mask_irq(struct irq_data *d)
 	struct gpio_pint_regs *regs = port->pint->regs;
 
 	spin_lock_irqsave(&port->lock, flags);
-	spin_lock_irqsave(&port->pint->lock, flags);
+	spin_lock(&port->pint->lock);
 
 	writel(hwirq_to_pintbit(port, d->hwirq), &regs->mask_clear);
 
-	spin_unlock_irqrestore(&port->pint->lock, flags);
+	spin_unlock(&port->pint->lock);
 	spin_unlock_irqrestore(&port->lock, flags);
 }
 
@@ -308,11 +308,11 @@ static void adi_gpio_unmask_irq(struct irq_data *d)
 	struct gpio_pint_regs *regs = port->pint->regs;
 
 	spin_lock_irqsave(&port->lock, flags);
-	spin_lock_irqsave(&port->pint->lock, flags);
+	spin_lock(&port->pint->lock);
 
 	writel(hwirq_to_pintbit(port, d->hwirq), &regs->mask_set);
 
-	spin_unlock_irqrestore(&port->pint->lock, flags);
+	spin_unlock(&port->pint->lock);
 	spin_unlock_irqrestore(&port->lock, flags);
 }
 
@@ -323,12 +323,12 @@ static unsigned int adi_gpio_irq_startup(struct irq_data *d)
 	struct gpio_pint_regs *regs = port->pint->regs;
 
 	if (!port) {
-		dev_err(port->dev, "GPIO IRQ %d :Not exist\n", d->irq);
+		pr_err("GPIO IRQ %d :Not exist\n", d->irq);
 		return -ENODEV;
 	}
 
 	spin_lock_irqsave(&port->lock, flags);
-	spin_lock_irqsave(&port->pint->lock, flags);
+	spin_lock(&port->pint->lock);
 
 	port_setup(port, d->hwirq, true);
 	writew(BIT(d->hwirq), &port->regs->dir_clear);
@@ -336,7 +336,7 @@ static unsigned int adi_gpio_irq_startup(struct irq_data *d)
 
 	writel(hwirq_to_pintbit(port, d->hwirq), &regs->mask_set);
 
-	spin_unlock_irqrestore(&port->pint->lock, flags);
+	spin_unlock(&port->pint->lock);
 	spin_unlock_irqrestore(&port->lock, flags);
 
 	return 0;
@@ -349,11 +349,11 @@ static void adi_gpio_irq_shutdown(struct irq_data *d)
 	struct gpio_pint_regs *regs = port->pint->regs;
 
 	spin_lock_irqsave(&port->lock, flags);
-	spin_lock_irqsave(&port->pint->lock, flags);
+	spin_lock(&port->pint->lock);
 
 	writel(hwirq_to_pintbit(port, d->hwirq), &regs->mask_clear);
 
-	spin_unlock_irqrestore(&port->pint->lock, flags);
+	spin_unlock(&port->pint->lock);
 	spin_unlock_irqrestore(&port->lock, flags);
 }
 
@@ -368,14 +368,14 @@ static int adi_gpio_irq_type(struct irq_data *d, unsigned int type)
 	char buf[16];
 
 	if (!port) {
-		dev_err(port->dev, "GPIO IRQ %d :Not exist\n", irq);
+		pr_err("GPIO IRQ %d :Not exist\n", d->irq);
 		return -ENODEV;
 	}
 
 	pintmask = hwirq_to_pintbit(port, d->hwirq);
 
 	spin_lock_irqsave(&port->lock, flags);
-	spin_lock_irqsave(&port->pint->lock, flags);
+	spin_lock(&port->pint->lock);
 
 	/* In case of interrupt autodetect, set irq type to edge sensitive. */
 	if (type == IRQ_TYPE_PROBE)
@@ -416,7 +416,7 @@ static int adi_gpio_irq_type(struct irq_data *d, unsigned int type)
 	}
 
 out:
-	spin_unlock_irqrestore(&port->pint->lock, flags);
+	spin_unlock(&port->pint->lock);
 	spin_unlock_irqrestore(&port->lock, flags);
 
 	return ret;
-- 
1.8.2.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: pinctrl-adi2: Remove nested lock+irqsave that resue flags.
  2013-09-23  9:29 [PATCH] pinctrl: pinctrl-adi2: Remove nested lock+irqsave that resue flags Sonic Zhang
@ 2013-09-23 12:38 ` Dan Carpenter
  2013-09-27 12:22 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2013-09-23 12:38 UTC (permalink / raw)
  To: Sonic Zhang; +Cc: Linus Walleij, LKML, adi-buildroot-devel, Sonic Zhang

On Mon, Sep 23, 2013 at 05:29:48PM +0800, Sonic Zhang wrote:
> @@ -323,12 +323,12 @@ static unsigned int adi_gpio_irq_startup(struct irq_data *d)
>  	struct gpio_pint_regs *regs = port->pint->regs;
                                      ^^^^^^^^^^^^^^^^
Dereference.

>  
>  	if (!port) {
            ^^^^^
Too late to check here.

> -		dev_err(port->dev, "GPIO IRQ %d :Not exist\n", d->irq);
> +		pr_err("GPIO IRQ %d :Not exist\n", d->irq);
>  		return -ENODEV;
>  	}

regards,
dan carpenter
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: pinctrl-adi2: Remove nested lock+irqsave that resue flags.
  2013-09-23  9:29 [PATCH] pinctrl: pinctrl-adi2: Remove nested lock+irqsave that resue flags Sonic Zhang
  2013-09-23 12:38 ` Dan Carpenter
@ 2013-09-27 12:22 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2013-09-27 12:22 UTC (permalink / raw)
  To: Sonic Zhang; +Cc: Dan Carpenter, LKML, adi-buildroot-devel, Sonic Zhang

On Mon, Sep 23, 2013 at 11:29 AM, Sonic Zhang <sonic.adi@gmail.com> wrote:

> From: Sonic Zhang <sonic.zhang@analog.com>
>
> Also avoid use NULL pointer in error message.
>
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

Sonic are you respinning this with fixes to Dan's remarks?

You may need to rebase the patch on my devel branch as
Axel fixed one of the problems (if I get it right).

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-27 12:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-23  9:29 [PATCH] pinctrl: pinctrl-adi2: Remove nested lock+irqsave that resue flags Sonic Zhang
2013-09-23 12:38 ` Dan Carpenter
2013-09-27 12:22 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox