drivers: clock_control: fix IN_RANGE() use in stm32 clock drivers

IN_RANGE() macro from zephyr/sys/util.h returns a boolean value
so it should be treated as such and not compared to a decimal value.
Fix stm32 clock drivers accordingly and simplify places where the
value is compared to true.

No functional change.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
This commit is contained in:
Etienne Carriere 2025-03-19 18:54:42 +01:00 committed by Anas Nashif
parent 6c2d354d9c
commit dcf4855fa4
6 changed files with 15 additions and 15 deletions

View File

@ -255,7 +255,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
if (!IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Attempt to change a wrong periph clock bit */
return -ENOTSUP;
}
@ -278,7 +278,7 @@ static inline int stm32_clock_control_off(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
if (!IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Attempt to toggle a wrong periph clock bit */
return -ENOTSUP;
}
@ -498,7 +498,7 @@ static enum clock_control_status stm32_clock_control_get_status(const struct dev
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == true) {
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Gated clocks */
if ((sys_read32(DT_REG_ADDR(DT_NODELABEL(rcc)) + pclken->bus) & pclken->enr)
== pclken->enr) {

View File

@ -152,7 +152,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
if (!IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Attempt to toggle a wrong periph clock bit */
return -ENOTSUP;
}
@ -173,7 +173,7 @@ static inline int stm32_clock_control_off(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
if (!IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Attempt to toggle a wrong periph clock bit */
return -ENOTSUP;
}

View File

@ -390,7 +390,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
if (!IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Attempt to toggle a wrong periph clock bit */
return -ENOTSUP;
}
@ -416,7 +416,7 @@ static inline int stm32_clock_control_off(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
if (!IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Attempt to toggle a wrong periph clock bit */
return -ENOTSUP;
}

View File

@ -198,7 +198,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
if (!IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Attempt to toggle a wrong periph clock bit */
return -ENOTSUP;
}
@ -221,7 +221,7 @@ static inline int stm32_clock_control_off(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
if (!IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Attempt to toggle a wrong periph clock bit */
return -ENOTSUP;
}

View File

@ -158,7 +158,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
if (!IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Attempt to toggle a wrong periph clock bit */
return -ENOTSUP;
}
@ -179,7 +179,7 @@ static inline int stm32_clock_control_off(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
if (!IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Attempt to toggle a wrong periph clock bit */
return -ENOTSUP;
}
@ -373,7 +373,7 @@ static enum clock_control_status stm32_clock_control_get_status(const struct dev
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == true) {
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Gated clocks */
if ((sys_read32(DT_REG_ADDR(DT_NODELABEL(rcc)) + pclken->bus) & pclken->enr)
== pclken->enr) {

View File

@ -70,7 +70,7 @@ static inline int stm32_clock_control_on(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
if (!IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Attempt to toggle a wrong periph clock bit */
return -ENOTSUP;
}
@ -91,7 +91,7 @@ static inline int stm32_clock_control_off(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
if (!IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Attempt to toggle a wrong periph clock bit */
return -ENOTSUP;
}
@ -287,7 +287,7 @@ static enum clock_control_status stm32_clock_control_get_status(const struct dev
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == true) {
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX)) {
/* Gated clocks */
if ((sys_read32(DT_REG_ADDR(DT_NODELABEL(rcc)) + pclken->bus) & pclken->enr)
== pclken->enr) {