lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1379928588-12627-1-git-send-email-sonic.adi@gmail.com>
Date:	Mon, 23 Sep 2013 17:29:48 +0800
From:	Sonic Zhang <sonic.adi@...il.com>
To:	Linus Walleij <linus.walleij@...aro.org>,
	<dan.carpenter@...cle.com>
CC:	LKML <linux-kernel@...r.kernel.org>,
	<adi-buildroot-devel@...ts.sourceforge.net>,
	Sonic Zhang <sonic.zhang@...log.com>
Subject: [PATCH] pinctrl: pinctrl-adi2: Remove nested lock+irqsave that resue flags.

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

Also avoid use NULL pointer in error message.

Signed-off-by: Sonic Zhang <sonic.zhang@...log.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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ