mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
pinctrl: stm32: Drop useless spinlock save and restore
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>
This commit is contained in:
parent
bbd3fc3412
commit
701a6aa4a3
|
|
@ -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 @@ static int stm32_pconf_set_driving(struct stm32_gpio_bank *bank,
|
|||
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 @@ static int stm32_pconf_set_speed(struct stm32_gpio_bank *bank,
|
|||
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 @@ static int stm32_pconf_set_bias(struct stm32_gpio_bank *bank,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user