From: Quanyang Wang <quanyang.w...@windriver.com> The irq functions "siul2_gpio_irq_unmask" and "siul2_gpio_irq_mask" use spin_lock in preempt-rt kernel, it will cause the error that calling a sleeping function in an atomic context.
Use raw spinlock to fix this issue. Signed-off-by: Quanyang Wang <quanyang.w...@windriver.com> --- drivers/gpio/gpio-siul2-s32cc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpio-siul2-s32cc.c b/drivers/gpio/gpio-siul2-s32cc.c index d93704af3eefa..3011ff5ab662b 100644 --- a/drivers/gpio/gpio-siul2-s32cc.c +++ b/drivers/gpio/gpio-siul2-s32cc.c @@ -156,7 +156,7 @@ struct siul2_gpio_dev { struct irq_chip irq; /* Mutual access to SIUL2 registers. */ - spinlock_t lock; + raw_spinlock_t lock; }; /* We will use the following variable names: @@ -208,14 +208,14 @@ static inline void gpio_set_direction(struct siul2_gpio_dev *dev, int gpio, { unsigned long flags; - spin_lock_irqsave(&dev->lock, flags); + raw_spin_lock_irqsave(&dev->lock, flags); if (dir == IN) bitmap_clear(dev->pin_dir_bitmap, gpio, 1); else bitmap_set(dev->pin_dir_bitmap, gpio, 1); - spin_unlock_irqrestore(&dev->lock, flags); + raw_spin_unlock_irqrestore(&dev->lock, flags); } static inline enum gpio_dir gpio_get_direction(struct siul2_gpio_dev *dev, @@ -490,9 +490,9 @@ static void siul2_gpio_irq_unmask(struct irq_data *data) /* Enable Interrupt */ regmap_update_bits(gpio_dev->irqmap, SIUL2_DIRER0, mask, mask); - spin_lock_irqsave(&gpio_dev->lock, flags); + raw_spin_lock_irqsave(&gpio_dev->lock, flags); bitmap_set(&gpio_dev->eirqs_bitmap, platdata->irqs[index].eirq, 1); - spin_unlock_irqrestore(&gpio_dev->lock, flags); + raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); /* Set IMCR */ regmap_write(gpio_dev->eirqimcrsmap, @@ -534,9 +534,9 @@ static void siul2_gpio_irq_mask(struct irq_data *data) /* Clean status flag */ regmap_update_bits(gpio_dev->irqmap, SIUL2_DISR0, mask, mask); - spin_lock_irqsave(&gpio_dev->lock, flags); + raw_spin_lock_irqsave(&gpio_dev->lock, flags); bitmap_clear(&gpio_dev->eirqs_bitmap, platdata->irqs[index].eirq, 1); - spin_unlock_irqrestore(&gpio_dev->lock, flags); + raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); regmap_write(gpio_dev->eirqimcrsmap, SIUL2_EIRQ_REG(platdata->irqs[index].eirq), @@ -1154,7 +1154,7 @@ static int siul2_gpio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, gpio_dev); - spin_lock_init(&gpio_dev->lock); + raw_spin_lock_init(&gpio_dev->lock); for (i = 0; i < ARRAY_SIZE(gpio_dev->siul2); ++i) { err = siul2_get_gpio_pinspec(pdev, &pinspec, i); -- 2.36.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12358): https://lists.yoctoproject.org/g/linux-yocto/message/12358 Mute This Topic: https://lists.yoctoproject.org/mt/98152528/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-