]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pinctrl: stm32: Drop useless spinlock save and restore
authorAntonio Borneo <antonio.borneo@foss.st.com>
Thu, 23 Oct 2025 13:26:55 +0000 (15:26 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 28 Oct 2025 09:43:01 +0000 (10:43 +0100)
There is no need to acquire a spinlock to only read a register for
debugfs reporting.
Drop such useless spinlock save and restore.

Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/stm32/pinctrl-stm32.c

index 66f9783fce8629ddc7fec5fa5a13299bf5f5a786..7175328d0df0cf84a73d04889dc00c57abfb0139 100644 (file)
@@ -920,9 +920,6 @@ static void stm32_pmx_get_mode(struct stm32_gpio_bank *bank, int pin, u32 *mode,
        u32 val;
        int alt_shift = (pin % 8) * 4;
        int alt_offset = STM32_GPIO_AFRL + (pin / 8) * 4;
-       unsigned long flags;
-
-       spin_lock_irqsave(&bank->lock, flags);
 
        val = readl_relaxed(bank->base + alt_offset);
        val &= GENMASK(alt_shift + 3, alt_shift);
@@ -931,8 +928,6 @@ static void stm32_pmx_get_mode(struct stm32_gpio_bank *bank, int pin, u32 *mode,
        val = readl_relaxed(bank->base + STM32_GPIO_MODER);
        val &= GENMASK(pin * 2 + 1, pin * 2);
        *mode = val >> (pin * 2);
-
-       spin_unlock_irqrestore(&bank->lock, flags);
 }
 
 static int stm32_pmx_set_mux(struct pinctrl_dev *pctldev,
@@ -1050,16 +1045,11 @@ unlock:
 static u32 stm32_pconf_get_driving(struct stm32_gpio_bank *bank,
        unsigned int offset)
 {
-       unsigned long flags;
        u32 val;
 
-       spin_lock_irqsave(&bank->lock, flags);
-
        val = readl_relaxed(bank->base + STM32_GPIO_TYPER);
        val &= BIT(offset);
 
-       spin_unlock_irqrestore(&bank->lock, flags);
-
        return (val >> offset);
 }
 
@@ -1101,16 +1091,11 @@ unlock:
 static u32 stm32_pconf_get_speed(struct stm32_gpio_bank *bank,
        unsigned int offset)
 {
-       unsigned long flags;
        u32 val;
 
-       spin_lock_irqsave(&bank->lock, flags);
-
        val = readl_relaxed(bank->base + STM32_GPIO_SPEEDR);
        val &= GENMASK(offset * 2 + 1, offset * 2);
 
-       spin_unlock_irqrestore(&bank->lock, flags);
-
        return (val >> (offset * 2));
 }
 
@@ -1152,27 +1137,19 @@ unlock:
 static u32 stm32_pconf_get_bias(struct stm32_gpio_bank *bank,
        unsigned int offset)
 {
-       unsigned long flags;
        u32 val;
 
-       spin_lock_irqsave(&bank->lock, flags);
-
        val = readl_relaxed(bank->base + STM32_GPIO_PUPDR);
        val &= GENMASK(offset * 2 + 1, offset * 2);
 
-       spin_unlock_irqrestore(&bank->lock, flags);
-
        return (val >> (offset * 2));
 }
 
 static bool stm32_pconf_get(struct stm32_gpio_bank *bank,
        unsigned int offset, bool dir)
 {
-       unsigned long flags;
        u32 val;
 
-       spin_lock_irqsave(&bank->lock, flags);
-
        if (dir)
                val = !!(readl_relaxed(bank->base + STM32_GPIO_IDR) &
                         BIT(offset));
@@ -1180,8 +1157,6 @@ static bool stm32_pconf_get(struct stm32_gpio_bank *bank,
                val = !!(readl_relaxed(bank->base + STM32_GPIO_ODR) &
                         BIT(offset));
 
-       spin_unlock_irqrestore(&bank->lock, flags);
-
        return val;
 }