drivers: pinmux: stm32: remove runtime PM get/put guards
The PM runtime API (get/put) provides an inline implementation when not built-in. Such implementation always returns 1, so it is safe to not guard PM runtime calls and check for < 0. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
53f17da351
commit
392b20f2a5
2 changed files with 5 additions and 17 deletions
|
@ -146,7 +146,7 @@ static int stm32_pins_remap(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt)
|
|||
static int stm32_pin_configure(uint32_t pin, uint32_t func, uint32_t altf)
|
||||
{
|
||||
const struct device *port_device;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
if (STM32_PORT(pin) >= gpio_ports_cnt) {
|
||||
return -EINVAL;
|
||||
|
@ -158,20 +158,14 @@ static int stm32_pin_configure(uint32_t pin, uint32_t func, uint32_t altf)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE_RUNTIME
|
||||
ret = pm_device_runtime_get(port_device);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
gpio_stm32_configure(port_device, STM32_PIN(pin), func, altf);
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE_RUNTIME
|
||||
ret = pm_device_runtime_put(port_device);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
return pm_device_runtime_put(port_device);
|
||||
}
|
||||
|
||||
int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
|
||||
|
|
|
@ -92,7 +92,7 @@ SYS_INIT(stm32_pinmux_init_remap, PRE_KERNEL_1,
|
|||
static int stm32_pin_configure(uint32_t pin, uint32_t func, uint32_t altf)
|
||||
{
|
||||
const struct device *port_device;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
if (STM32_PORT(pin) >= STM32_PORTS_MAX) {
|
||||
return -EINVAL;
|
||||
|
@ -104,20 +104,14 @@ static int stm32_pin_configure(uint32_t pin, uint32_t func, uint32_t altf)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE_RUNTIME
|
||||
ret = pm_device_runtime_get(port_device);
|
||||
if (ret != 0) {
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
gpio_stm32_configure(port_device, STM32_PIN(pin), func, altf);
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE_RUNTIME
|
||||
ret = pm_device_runtime_put(port_device);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
return pm_device_runtime_put(port_device);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue