diff --git a/arch/arm/src/stm32l4/stm32l4_exti.h b/arch/arm/src/stm32l4/stm32l4_exti.h index 4cfb52667b1..2f57229ea21 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti.h +++ b/arch/arm/src/stm32l4/stm32l4_exti.h @@ -72,22 +72,22 @@ extern "C" * Description: * Sets/clears GPIO based event and interrupt triggers. * - * Parameters: - * - pinset: gpio pin configuration - * - rising/falling edge: enables - * - event: generate event when set - * - func: when non-NULL, generate interrupt - * - arg: Argument passed to the interrupt callback + * Input Parameters: + * pinset - GPIO pin configuration + * risingedge - Enables interrupt on rising edges + * fallingedge - Enables interrupt on falling edges + * event - Generate event when set + * func - When non-NULL, generate interrupt + * arg - Argument passed to the interrupt callback * - * Returns: - * The previous value of the interrupt handler function pointer. This value may, - * for example, be used to restore the previous handler when multiple handlers are - * used. + * Returned Value: + * Zero (OK) is returned on success, otherwise a negated errno value is returned + * to indicate the nature of the failure. * ************************************************************************************/ -xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, - bool event, xcpt_t func, void *arg); +int stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, + bool event, xcpt_t func, void *arg); /**************************************************************************** * Name: stm32l4_exti_alarm diff --git a/arch/arm/src/stm32l4/stm32l4_exti_gpio.c b/arch/arm/src/stm32l4/stm32l4_exti_gpio.c index e0eeabe529f..4a23c936320 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_gpio.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_gpio.c @@ -61,8 +61,8 @@ struct gpio_callback_s { - xcpt_t callback; - void *arg; + xcpt_t callback; /* Callback entry point */ + void *arg; /* The argument that accompanies the callback */ }; /**************************************************************************** @@ -249,23 +249,25 @@ static int stm32l4_exti1510_isr(int irq, void *context, FAR void *arg) * Description: * Sets/clears GPIO based event and interrupt triggers. * - * Parameters: - * - pinset: GPIO pin configuration - * - risingedge: Enables interrupt on rising edges - * - fallingedge: Enables interrupt on falling edges - * - event: Generate event when set - * - func: When non-NULL, generate interrupt - * - arg: Argument passed to the interrupt callback + * Description: + * Sets/clears GPIO based event and interrupt triggers. * - * Returns: - * The previous value of the interrupt handler function pointer. This - * value may, for example, be used to restore the previous handler when - * multiple handlers are used. + * Input Parameters: + * pinset - GPIO pin configuration + * risingedge - Enables interrupt on rising edges + * fallingedge - Enables interrupt on falling edges + * event - Generate event when set + * func - When non-NULL, generate interrupt + * arg - Argument passed to the interrupt callback * - ****************************************************************************/ + * Returned Value: + * Zero (OK) is returned on success, otherwise a negated errno value is returned + * to indicate the nature of the failure. + * + ************************************************************************************/ -xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, - bool event, xcpt_t func, void *arg) +int stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, + bool event, xcpt_t func, void *arg) { struct gpio_callback_s *shared_cbs; uint32_t pin = pinset & GPIO_PIN_MASK; @@ -323,7 +325,6 @@ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = g_gpio_handlers[pin].callback; g_gpio_handlers[pin].callback = func; g_gpio_handlers[pin].arg = arg; @@ -385,5 +386,5 @@ xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, /* Return the old IRQ handler */ - return oldhandler; + return OK; } diff --git a/arch/arm/src/stm32l4/stm32l4_gpio.h b/arch/arm/src/stm32l4/stm32l4_gpio.h index 17ce32162fb..5d4f74d58dc 100644 --- a/arch/arm/src/stm32l4/stm32l4_gpio.h +++ b/arch/arm/src/stm32l4/stm32l4_gpio.h @@ -326,22 +326,22 @@ bool stm32l4_gpioread(uint32_t pinset); * Description: * Sets/clears GPIO based event and interrupt triggers. * - * Parameters: - * - pinset: gpio pin configuration - * - rising/falling edge: enables - * - event: generate event when set - * - func: when non-NULL, generate interrupt - * - arg: Argument passed to the interrupt callback + * Input Parameters: + * pinset - GPIO pin configuration + * risingedge - Enables interrupt on rising edges + * fallingedge - Enables interrupt on falling edges + * event - Generate event when set + * func - When non-NULL, generate interrupt + * arg - Argument passed to the interrupt callback * - * Returns: - * The previous value of the interrupt handler function pointer. This value may, - * for example, be used to restore the previous handler when multiple handlers are - * used. + * Returned Value: + * Zero (OK) is returned on success, otherwise a negated errno value is returned + * to indicate the nature of the failure. * ************************************************************************************/ -xcpt_t stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, - bool event, xcpt_t func, void *arg); +int stm32l4_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, + bool event, xcpt_t func, void *arg); /************************************************************************************ * Function: stm32l4_dumpgpio diff --git a/configs/stm32l476-mdk/src/stm32_buttons.c b/configs/stm32l476-mdk/src/stm32_buttons.c index 7dfc0469418..f87c9936ecc 100644 --- a/configs/stm32l476-mdk/src/stm32_buttons.c +++ b/configs/stm32l476-mdk/src/stm32_buttons.c @@ -152,15 +152,16 @@ uint8_t board_buttons(void) #ifdef CONFIG_ARCH_IRQBUTTONS xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { - xcpt_t oldhandler = NULL; + int ret = OK; if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32l4_gpiosetevent(g_buttons[id], true, true, true, - irqhandler, arg); + ret = stm32l4_gpiosetevent(g_buttons[id], true, true, true, + irqhandler, arg); } - return oldhandler; + UNUSED(ret); + return NULL; } #endif #endif /* CONFIG_ARCH_BUTTONS */ diff --git a/configs/stm32l476vg-disco/src/stm32_buttons.c b/configs/stm32l476vg-disco/src/stm32_buttons.c index 7fc0c09d8a9..8e8f43313f2 100644 --- a/configs/stm32l476vg-disco/src/stm32_buttons.c +++ b/configs/stm32l476vg-disco/src/stm32_buttons.c @@ -327,17 +327,17 @@ uint8_t board_buttons(void) #ifdef CONFIG_ARCH_IRQBUTTONS xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) { - xcpt_t oldhandler = NULL; + int ret = OK; /* The following should be atomic */ if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON) { - oldhandler = stm32l4_gpiosetevent(g_buttons[id], true, true, true, - irqhandler, arg); + ret = stm32l4_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg); } - return oldhandler; + UNUSED(ret); + return NULL; } #endif #endif /* CONFIG_ARCH_BUTTONS */ diff --git a/configs/stm32l476vg-disco/src/stm32_usb.c b/configs/stm32l476vg-disco/src/stm32_usb.c index 0b08a9264d2..0f51871e1ac 100644 --- a/configs/stm32l476vg-disco/src/stm32_usb.c +++ b/configs/stm32l476vg-disco/src/stm32_usb.c @@ -311,7 +311,8 @@ void stm32l4_usbhost_vbusdrive(int iface, bool enable) #ifdef CONFIG_USBHOST xcpt_t stm32l4_setup_overcurrent(xcpt_t handler) { - return stm32l4_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); + (void)stm32l4_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); + return NULL; } #endif