public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] pinctrl: exynos: Add spinlocks to irq_mask and irq_unmask
@ 2013-06-12 17:33 Doug Anderson
  2013-06-12 17:33 ` [PATCH 2/3] pinctrl: exynos: reorder xyz_irq_unmask() so future patch can ack Doug Anderson
                   ` (5 more replies)
  0 siblings, 6 replies; 25+ messages in thread
From: Doug Anderson @ 2013-06-12 17:33 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Kukjin Kim, Tomasz Figa, Olof Johansson, Simon Glass,
	Luigi Semenzato, ilho215.lee, eunki_kim, Doug Anderson,
	linux-kernel

The patch:
  1984695 pinctrl: samsung: Protect bank registers with a spinlock

...added spinlocks to protect many accesses.  However, the irq_mask
and irq_unmask functions still do an unprotected read/modify/write.
Add the spinlock there.

Signed-off-by: Doug Anderson <dianders@chromium.org>
---
 drivers/pinctrl/pinctrl-exynos.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c
index 2d76f66..c29a28e 100644
--- a/drivers/pinctrl/pinctrl-exynos.c
+++ b/drivers/pinctrl/pinctrl-exynos.c
@@ -56,10 +56,15 @@ static void exynos_gpio_irq_unmask(struct irq_data *irqd)
 	struct samsung_pinctrl_drv_data *d = bank->drvdata;
 	unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset;
 	unsigned long mask;
+	unsigned long flags;
+
+	spin_lock_irqsave(&bank->slock, flags);
 
 	mask = readl(d->virt_base + reg_mask);
 	mask &= ~(1 << irqd->hwirq);
 	writel(mask, d->virt_base + reg_mask);
+
+	spin_unlock_irqrestore(&bank->slock, flags);
 }
 
 static void exynos_gpio_irq_mask(struct irq_data *irqd)
@@ -68,10 +73,15 @@ static void exynos_gpio_irq_mask(struct irq_data *irqd)
 	struct samsung_pinctrl_drv_data *d = bank->drvdata;
 	unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset;
 	unsigned long mask;
+	unsigned long flags;
+
+	spin_lock_irqsave(&bank->slock, flags);
 
 	mask = readl(d->virt_base + reg_mask);
 	mask |= 1 << irqd->hwirq;
 	writel(mask, d->virt_base + reg_mask);
+
+	spin_unlock_irqrestore(&bank->slock, flags);
 }
 
 static void exynos_gpio_irq_ack(struct irq_data *irqd)
@@ -264,10 +274,15 @@ static void exynos_wkup_irq_unmask(struct irq_data *irqd)
 	struct samsung_pinctrl_drv_data *d = b->drvdata;
 	unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset;
 	unsigned long mask;
+	unsigned long flags;
+
+	spin_lock_irqsave(&b->slock, flags);
 
 	mask = readl(d->virt_base + reg_mask);
 	mask &= ~(1 << irqd->hwirq);
 	writel(mask, d->virt_base + reg_mask);
+
+	spin_unlock_irqrestore(&b->slock, flags);
 }
 
 static void exynos_wkup_irq_mask(struct irq_data *irqd)
@@ -276,10 +291,15 @@ static void exynos_wkup_irq_mask(struct irq_data *irqd)
 	struct samsung_pinctrl_drv_data *d = b->drvdata;
 	unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset;
 	unsigned long mask;
+	unsigned long flags;
+
+	spin_lock_irqsave(&b->slock, flags);
 
 	mask = readl(d->virt_base + reg_mask);
 	mask |= 1 << irqd->hwirq;
 	writel(mask, d->virt_base + reg_mask);
+
+	spin_unlock_irqrestore(&b->slock, flags);
 }
 
 static void exynos_wkup_irq_ack(struct irq_data *irqd)
-- 
1.8.3


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

end of thread, other threads:[~2013-06-17 16:56 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-12 17:33 [PATCH 1/3] pinctrl: exynos: Add spinlocks to irq_mask and irq_unmask Doug Anderson
2013-06-12 17:33 ` [PATCH 2/3] pinctrl: exynos: reorder xyz_irq_unmask() so future patch can ack Doug Anderson
2013-06-13 11:14   ` Tomasz Figa
2013-06-13 12:01   ` Kukjin Kim
2013-06-13 12:32   ` Linus Walleij
2013-06-13 16:43     ` Doug Anderson
2013-06-12 17:33 ` [PATCH 3/3] pinctrl: exynos: ack level-triggered interrupts before unmasking Doug Anderson
2013-06-13 10:54   ` Tomasz Figa
2013-06-13 16:34     ` Doug Anderson
2013-06-13 16:40       ` Tomasz Figa
2013-06-13 12:04   ` Kukjin Kim
2013-06-13 16:38     ` Doug Anderson
2013-06-13 16:42       ` Tomasz Figa
2013-06-13 16:50         ` Doug Anderson
2013-06-13 23:13           ` Kukjin Kim
2013-06-14  0:00             ` Doug Anderson
2013-06-14  0:18               ` Kukjin Kim
2013-06-13 12:34   ` Linus Walleij
2013-06-13 11:03 ` [PATCH 1/3] pinctrl: exynos: Add spinlocks to irq_mask and irq_unmask Tomasz Figa
2013-06-13 12:00 ` Kukjin Kim
2013-06-13 12:29 ` Linus Walleij
2013-06-13 16:38 ` [PATCH v2 3/3] pinctrl: exynos: ack level-triggered interrupts before unmasking Doug Anderson
2013-06-13 16:44   ` Tomasz Figa
2013-06-13 18:20   ` Linus Walleij
2013-06-17 16:56     ` Linus Walleij

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