diff options
author | Julia Cartwright <julia@ni.com> | 2017-03-09 11:22:05 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-03-16 11:39:15 -0400 |
commit | 82e529c1c7befe82fc7fc258b956e973056c20bb (patch) | |
tree | 79ea0b8320deeed40687ecef7dca2c915aa2191b /drivers/pinctrl/sirf | |
parent | 229710fecdd805abb753c480778ea0de47cbb1e2 (diff) |
pinctrl: sirf: atlas7: make use of raw_spinlock variants
The sirf atlas7 pinctrl drivers currently implement an irq_chip for
handling interrupts; due to how irq_chip handling is done, it's
necessary for the irq_chip methods to be invoked from hardirq context,
even on a a real-time kernel. Because the spinlock_t type becomes a
"sleeping" spinlock w/ RT kernels, it is not suitable to be used with
irq_chips.
A quick audit of the operations under the lock reveal that they do only
minimal, bounded work, and are therefore safe to do under a raw spinlock.
Signed-off-by: Julia Cartwright <julia@ni.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/sirf')
-rw-r--r-- | drivers/pinctrl/sirf/pinctrl-atlas7.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/pinctrl/sirf/pinctrl-atlas7.c b/drivers/pinctrl/sirf/pinctrl-atlas7.c index 600d6427a978..1efa315a7dbe 100644 --- a/drivers/pinctrl/sirf/pinctrl-atlas7.c +++ b/drivers/pinctrl/sirf/pinctrl-atlas7.c | |||
@@ -352,7 +352,7 @@ struct atlas7_gpio_chip { | |||
352 | void __iomem *reg; | 352 | void __iomem *reg; |
353 | struct clk *clk; | 353 | struct clk *clk; |
354 | int nbank; | 354 | int nbank; |
355 | spinlock_t lock; | 355 | raw_spinlock_t lock; |
356 | struct gpio_chip chip; | 356 | struct gpio_chip chip; |
357 | struct atlas7_gpio_bank banks[0]; | 357 | struct atlas7_gpio_bank banks[0]; |
358 | }; | 358 | }; |
@@ -5650,13 +5650,13 @@ static void atlas7_gpio_irq_ack(struct irq_data *d) | |||
5650 | pin_in_bank = d->hwirq - bank->gpio_offset; | 5650 | pin_in_bank = d->hwirq - bank->gpio_offset; |
5651 | ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank); | 5651 | ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank); |
5652 | 5652 | ||
5653 | spin_lock_irqsave(&a7gc->lock, flags); | 5653 | raw_spin_lock_irqsave(&a7gc->lock, flags); |
5654 | 5654 | ||
5655 | val = readl(ctrl_reg); | 5655 | val = readl(ctrl_reg); |
5656 | /* clear interrupt status */ | 5656 | /* clear interrupt status */ |
5657 | writel(val, ctrl_reg); | 5657 | writel(val, ctrl_reg); |
5658 | 5658 | ||
5659 | spin_unlock_irqrestore(&a7gc->lock, flags); | 5659 | raw_spin_unlock_irqrestore(&a7gc->lock, flags); |
5660 | } | 5660 | } |
5661 | 5661 | ||
5662 | static void __atlas7_gpio_irq_mask(struct atlas7_gpio_chip *a7gc, int idx) | 5662 | static void __atlas7_gpio_irq_mask(struct atlas7_gpio_chip *a7gc, int idx) |
@@ -5681,11 +5681,11 @@ static void atlas7_gpio_irq_mask(struct irq_data *d) | |||
5681 | struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc); | 5681 | struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc); |
5682 | unsigned long flags; | 5682 | unsigned long flags; |
5683 | 5683 | ||
5684 | spin_lock_irqsave(&a7gc->lock, flags); | 5684 | raw_spin_lock_irqsave(&a7gc->lock, flags); |
5685 | 5685 | ||
5686 | __atlas7_gpio_irq_mask(a7gc, d->hwirq); | 5686 | __atlas7_gpio_irq_mask(a7gc, d->hwirq); |
5687 | 5687 | ||
5688 | spin_unlock_irqrestore(&a7gc->lock, flags); | 5688 | raw_spin_unlock_irqrestore(&a7gc->lock, flags); |
5689 | } | 5689 | } |
5690 | 5690 | ||
5691 | static void atlas7_gpio_irq_unmask(struct irq_data *d) | 5691 | static void atlas7_gpio_irq_unmask(struct irq_data *d) |
@@ -5701,14 +5701,14 @@ static void atlas7_gpio_irq_unmask(struct irq_data *d) | |||
5701 | pin_in_bank = d->hwirq - bank->gpio_offset; | 5701 | pin_in_bank = d->hwirq - bank->gpio_offset; |
5702 | ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank); | 5702 | ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank); |
5703 | 5703 | ||
5704 | spin_lock_irqsave(&a7gc->lock, flags); | 5704 | raw_spin_lock_irqsave(&a7gc->lock, flags); |
5705 | 5705 | ||
5706 | val = readl(ctrl_reg); | 5706 | val = readl(ctrl_reg); |
5707 | val &= ~ATLAS7_GPIO_CTL_INTR_STATUS_MASK; | 5707 | val &= ~ATLAS7_GPIO_CTL_INTR_STATUS_MASK; |
5708 | val |= ATLAS7_GPIO_CTL_INTR_EN_MASK; | 5708 | val |= ATLAS7_GPIO_CTL_INTR_EN_MASK; |
5709 | writel(val, ctrl_reg); | 5709 | writel(val, ctrl_reg); |
5710 | 5710 | ||
5711 | spin_unlock_irqrestore(&a7gc->lock, flags); | 5711 | raw_spin_unlock_irqrestore(&a7gc->lock, flags); |
5712 | } | 5712 | } |
5713 | 5713 | ||
5714 | static int atlas7_gpio_irq_type(struct irq_data *d, | 5714 | static int atlas7_gpio_irq_type(struct irq_data *d, |
@@ -5725,7 +5725,7 @@ static int atlas7_gpio_irq_type(struct irq_data *d, | |||
5725 | pin_in_bank = d->hwirq - bank->gpio_offset; | 5725 | pin_in_bank = d->hwirq - bank->gpio_offset; |
5726 | ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank); | 5726 | ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank); |
5727 | 5727 | ||
5728 | spin_lock_irqsave(&a7gc->lock, flags); | 5728 | raw_spin_lock_irqsave(&a7gc->lock, flags); |
5729 | 5729 | ||
5730 | val = readl(ctrl_reg); | 5730 | val = readl(ctrl_reg); |
5731 | val &= ~(ATLAS7_GPIO_CTL_INTR_STATUS_MASK | | 5731 | val &= ~(ATLAS7_GPIO_CTL_INTR_STATUS_MASK | |
@@ -5768,7 +5768,7 @@ static int atlas7_gpio_irq_type(struct irq_data *d, | |||
5768 | 5768 | ||
5769 | writel(val, ctrl_reg); | 5769 | writel(val, ctrl_reg); |
5770 | 5770 | ||
5771 | spin_unlock_irqrestore(&a7gc->lock, flags); | 5771 | raw_spin_unlock_irqrestore(&a7gc->lock, flags); |
5772 | 5772 | ||
5773 | return 0; | 5773 | return 0; |
5774 | } | 5774 | } |
@@ -5863,7 +5863,7 @@ static int atlas7_gpio_request(struct gpio_chip *chip, | |||
5863 | if (pinctrl_request_gpio(chip->base + gpio)) | 5863 | if (pinctrl_request_gpio(chip->base + gpio)) |
5864 | return -ENODEV; | 5864 | return -ENODEV; |
5865 | 5865 | ||
5866 | spin_lock_irqsave(&a7gc->lock, flags); | 5866 | raw_spin_lock_irqsave(&a7gc->lock, flags); |
5867 | 5867 | ||
5868 | /* | 5868 | /* |
5869 | * default status: | 5869 | * default status: |
@@ -5872,7 +5872,7 @@ static int atlas7_gpio_request(struct gpio_chip *chip, | |||
5872 | __atlas7_gpio_set_input(a7gc, gpio); | 5872 | __atlas7_gpio_set_input(a7gc, gpio); |
5873 | __atlas7_gpio_irq_mask(a7gc, gpio); | 5873 | __atlas7_gpio_irq_mask(a7gc, gpio); |
5874 | 5874 | ||
5875 | spin_unlock_irqrestore(&a7gc->lock, flags); | 5875 | raw_spin_unlock_irqrestore(&a7gc->lock, flags); |
5876 | 5876 | ||
5877 | return 0; | 5877 | return 0; |
5878 | } | 5878 | } |
@@ -5883,12 +5883,12 @@ static void atlas7_gpio_free(struct gpio_chip *chip, | |||
5883 | struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip); | 5883 | struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip); |
5884 | unsigned long flags; | 5884 | unsigned long flags; |
5885 | 5885 | ||
5886 | spin_lock_irqsave(&a7gc->lock, flags); | 5886 | raw_spin_lock_irqsave(&a7gc->lock, flags); |
5887 | 5887 | ||
5888 | __atlas7_gpio_irq_mask(a7gc, gpio); | 5888 | __atlas7_gpio_irq_mask(a7gc, gpio); |
5889 | __atlas7_gpio_set_input(a7gc, gpio); | 5889 | __atlas7_gpio_set_input(a7gc, gpio); |
5890 | 5890 | ||
5891 | spin_unlock_irqrestore(&a7gc->lock, flags); | 5891 | raw_spin_unlock_irqrestore(&a7gc->lock, flags); |
5892 | 5892 | ||
5893 | pinctrl_free_gpio(chip->base + gpio); | 5893 | pinctrl_free_gpio(chip->base + gpio); |
5894 | } | 5894 | } |
@@ -5899,11 +5899,11 @@ static int atlas7_gpio_direction_input(struct gpio_chip *chip, | |||
5899 | struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip); | 5899 | struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip); |
5900 | unsigned long flags; | 5900 | unsigned long flags; |
5901 | 5901 | ||
5902 | spin_lock_irqsave(&a7gc->lock, flags); | 5902 | raw_spin_lock_irqsave(&a7gc->lock, flags); |
5903 | 5903 | ||
5904 | __atlas7_gpio_set_input(a7gc, gpio); | 5904 | __atlas7_gpio_set_input(a7gc, gpio); |
5905 | 5905 | ||
5906 | spin_unlock_irqrestore(&a7gc->lock, flags); | 5906 | raw_spin_unlock_irqrestore(&a7gc->lock, flags); |
5907 | 5907 | ||
5908 | return 0; | 5908 | return 0; |
5909 | } | 5909 | } |
@@ -5936,11 +5936,11 @@ static int atlas7_gpio_direction_output(struct gpio_chip *chip, | |||
5936 | struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip); | 5936 | struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip); |
5937 | unsigned long flags; | 5937 | unsigned long flags; |
5938 | 5938 | ||
5939 | spin_lock_irqsave(&a7gc->lock, flags); | 5939 | raw_spin_lock_irqsave(&a7gc->lock, flags); |
5940 | 5940 | ||
5941 | __atlas7_gpio_set_output(a7gc, gpio, value); | 5941 | __atlas7_gpio_set_output(a7gc, gpio, value); |
5942 | 5942 | ||
5943 | spin_unlock_irqrestore(&a7gc->lock, flags); | 5943 | raw_spin_unlock_irqrestore(&a7gc->lock, flags); |
5944 | 5944 | ||
5945 | return 0; | 5945 | return 0; |
5946 | } | 5946 | } |
@@ -5956,11 +5956,11 @@ static int atlas7_gpio_get_value(struct gpio_chip *chip, | |||
5956 | bank = atlas7_gpio_to_bank(a7gc, gpio); | 5956 | bank = atlas7_gpio_to_bank(a7gc, gpio); |
5957 | pin_in_bank = gpio - bank->gpio_offset; | 5957 | pin_in_bank = gpio - bank->gpio_offset; |
5958 | 5958 | ||
5959 | spin_lock_irqsave(&a7gc->lock, flags); | 5959 | raw_spin_lock_irqsave(&a7gc->lock, flags); |
5960 | 5960 | ||
5961 | val = readl(ATLAS7_GPIO_CTRL(bank, pin_in_bank)); | 5961 | val = readl(ATLAS7_GPIO_CTRL(bank, pin_in_bank)); |
5962 | 5962 | ||
5963 | spin_unlock_irqrestore(&a7gc->lock, flags); | 5963 | raw_spin_unlock_irqrestore(&a7gc->lock, flags); |
5964 | 5964 | ||
5965 | return !!(val & ATLAS7_GPIO_CTL_DATAIN_MASK); | 5965 | return !!(val & ATLAS7_GPIO_CTL_DATAIN_MASK); |
5966 | } | 5966 | } |
@@ -5978,7 +5978,7 @@ static void atlas7_gpio_set_value(struct gpio_chip *chip, | |||
5978 | pin_in_bank = gpio - bank->gpio_offset; | 5978 | pin_in_bank = gpio - bank->gpio_offset; |
5979 | ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank); | 5979 | ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank); |
5980 | 5980 | ||
5981 | spin_lock_irqsave(&a7gc->lock, flags); | 5981 | raw_spin_lock_irqsave(&a7gc->lock, flags); |
5982 | 5982 | ||
5983 | ctrl = readl(ctrl_reg); | 5983 | ctrl = readl(ctrl_reg); |
5984 | if (value) | 5984 | if (value) |
@@ -5987,7 +5987,7 @@ static void atlas7_gpio_set_value(struct gpio_chip *chip, | |||
5987 | ctrl &= ~ATLAS7_GPIO_CTL_DATAOUT_MASK; | 5987 | ctrl &= ~ATLAS7_GPIO_CTL_DATAOUT_MASK; |
5988 | writel(ctrl, ctrl_reg); | 5988 | writel(ctrl, ctrl_reg); |
5989 | 5989 | ||
5990 | spin_unlock_irqrestore(&a7gc->lock, flags); | 5990 | raw_spin_unlock_irqrestore(&a7gc->lock, flags); |
5991 | } | 5991 | } |
5992 | 5992 | ||
5993 | static const struct of_device_id atlas7_gpio_ids[] = { | 5993 | static const struct of_device_id atlas7_gpio_ids[] = { |
@@ -6036,7 +6036,7 @@ static int atlas7_gpio_probe(struct platform_device *pdev) | |||
6036 | } | 6036 | } |
6037 | 6037 | ||
6038 | a7gc->nbank = nbank; | 6038 | a7gc->nbank = nbank; |
6039 | spin_lock_init(&a7gc->lock); | 6039 | raw_spin_lock_init(&a7gc->lock); |
6040 | 6040 | ||
6041 | /* Setup GPIO Chip */ | 6041 | /* Setup GPIO Chip */ |
6042 | chip = &a7gc->chip; | 6042 | chip = &a7gc->chip; |