summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/intel
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-11-18 20:04:54 +0200
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-12-13 16:48:47 +0200
commitb2e05d63c295529879aabeb8781f947e1e2dca7b (patch)
tree22be0516bd025f3bf4a8d77326b352ed93340c10 /drivers/pinctrl/intel
parenteb83479e18999e34b3b800f54aa31137f7f41c33 (diff)
downloadlinux-b2e05d63c295529879aabeb8781f947e1e2dca7b.tar.gz
linux-b2e05d63c295529879aabeb8781f947e1e2dca7b.tar.bz2
linux-b2e05d63c295529879aabeb8781f947e1e2dca7b.zip
pinctrl: lynxpoint: Use raw_spinlock for locking
The Intel Lynxpoint pinctrl driver implements irqchip callbacks which are called with desc->lock raw_spinlock held. In mainline this is fine because spinlock resolves to raw_spinlock. However, running the same code in -rt we will get a BUG() asserted. This is because in -rt spinlocks are preemptible so taking the driver private spinlock in irqchip callbacks causes might_sleep() to trigger. In order to keep -rt happy but at the same time make sure that register accesses get serialized, convert the driver to use raw_spinlock instead. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/pinctrl/intel')
-rw-r--r--drivers/pinctrl/intel/pinctrl-lynxpoint.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
index 490ce7bae25e..c30fd86846a7 100644
--- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c
+++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
@@ -47,7 +47,7 @@
struct lp_gpio {
struct gpio_chip chip;
struct platform_device *pdev;
- spinlock_t lock;
+ raw_spinlock_t lock;
unsigned long reg_base;
};
@@ -144,7 +144,7 @@ static int lp_irq_type(struct irq_data *d, unsigned type)
if (hwirq >= lg->chip.ngpio)
return -EINVAL;
- spin_lock_irqsave(&lg->lock, flags);
+ raw_spin_lock_irqsave(&lg->lock, flags);
value = inl(reg);
/* set both TRIG_SEL and INV bits to 0 for rising edge */
@@ -170,7 +170,7 @@ static int lp_irq_type(struct irq_data *d, unsigned type)
else if (type & IRQ_TYPE_LEVEL_MASK)
irq_set_handler_locked(d, handle_level_irq);
- spin_unlock_irqrestore(&lg->lock, flags);
+ raw_spin_unlock_irqrestore(&lg->lock, flags);
return 0;
}
@@ -187,14 +187,14 @@ static void lp_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
unsigned long reg = lp_gpio_reg(chip, offset, LP_CONFIG1);
unsigned long flags;
- spin_lock_irqsave(&lg->lock, flags);
+ raw_spin_lock_irqsave(&lg->lock, flags);
if (value)
outl(inl(reg) | OUT_LVL_BIT, reg);
else
outl(inl(reg) & ~OUT_LVL_BIT, reg);
- spin_unlock_irqrestore(&lg->lock, flags);
+ raw_spin_unlock_irqrestore(&lg->lock, flags);
}
static int lp_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
@@ -203,9 +203,9 @@ static int lp_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
unsigned long reg = lp_gpio_reg(chip, offset, LP_CONFIG1);
unsigned long flags;
- spin_lock_irqsave(&lg->lock, flags);
+ raw_spin_lock_irqsave(&lg->lock, flags);
outl(inl(reg) | DIR_BIT, reg);
- spin_unlock_irqrestore(&lg->lock, flags);
+ raw_spin_unlock_irqrestore(&lg->lock, flags);
return 0;
}
@@ -219,9 +219,9 @@ static int lp_gpio_direction_output(struct gpio_chip *chip,
lp_gpio_set(chip, offset, value);
- spin_lock_irqsave(&lg->lock, flags);
+ raw_spin_lock_irqsave(&lg->lock, flags);
outl(inl(reg) & ~DIR_BIT, reg);
- spin_unlock_irqrestore(&lg->lock, flags);
+ raw_spin_unlock_irqrestore(&lg->lock, flags);
return 0;
}
@@ -272,9 +272,9 @@ static void lp_irq_enable(struct irq_data *d)
unsigned long reg = lp_gpio_reg(&lg->chip, hwirq, LP_INT_ENABLE);
unsigned long flags;
- spin_lock_irqsave(&lg->lock, flags);
+ raw_spin_lock_irqsave(&lg->lock, flags);
outl(inl(reg) | BIT(hwirq % 32), reg);
- spin_unlock_irqrestore(&lg->lock, flags);
+ raw_spin_unlock_irqrestore(&lg->lock, flags);
}
static void lp_irq_disable(struct irq_data *d)
@@ -285,9 +285,9 @@ static void lp_irq_disable(struct irq_data *d)
unsigned long reg = lp_gpio_reg(&lg->chip, hwirq, LP_INT_ENABLE);
unsigned long flags;
- spin_lock_irqsave(&lg->lock, flags);
+ raw_spin_lock_irqsave(&lg->lock, flags);
outl(inl(reg) & ~BIT(hwirq % 32), reg);
- spin_unlock_irqrestore(&lg->lock, flags);
+ raw_spin_unlock_irqrestore(&lg->lock, flags);
}
static struct irq_chip lp_irqchip = {
@@ -351,7 +351,7 @@ static int lp_gpio_probe(struct platform_device *pdev)
return -EBUSY;
}
- spin_lock_init(&lg->lock);
+ raw_spin_lock_init(&lg->lock);
gc = &lg->chip;
gc->label = dev_name(dev);