From 89058172f1b96bb2ef97b5416675b83d11af75a7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 2 Mar 2017 08:56:31 -0600 Subject: [PATCH] STM32/F7/L4: EXOT PVD function no longer returns the xcpt_t oldhandler. There value is useless and dangerous after the recent changes to interrupt argument passing. --- arch/arm/src/stm32/stm32_exti_pwr.c | 16 ++++++---------- arch/arm/src/stm32/stm32_exti_pwr.h | 9 ++++----- arch/arm/src/stm32f7/stm32_exti_pwr.c | 14 +++++--------- arch/arm/src/stm32f7/stm32_exti_pwr.h | 9 ++++----- arch/arm/src/stm32l4/stm32l4_exti_pwr.c | 12 ++++-------- arch/arm/src/stm32l4/stm32l4_exti_pwr.h | 9 ++++----- 6 files changed, 27 insertions(+), 42 deletions(-) diff --git a/arch/arm/src/stm32/stm32_exti_pwr.c b/arch/arm/src/stm32/stm32_exti_pwr.c index 81cad7b500..0fcb2f7803 100644 --- a/arch/arm/src/stm32/stm32_exti_pwr.c +++ b/arch/arm/src/stm32/stm32_exti_pwr.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/stm32/stm32_exti_pwr.c * - * Copyright (C) 2009, 2011-2012, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011-2012, 2015, 2017 Gregory Nutt. All rights reserved. * Copyright (C) 2015 Haltian Ltd. All rights reserved. * Authors: Gregory Nutt * Dmitry Nikolaev @@ -115,20 +115,16 @@ static int stm32_exti_pvd_isr(int irq, void *context, FAR void *arg) * - 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. + * Zero (OK) returned on success; a negated errno value is returned on + * failure. * ****************************************************************************/ -xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, - xcpt_t func, void *arg) +int stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, + xcpt_t func, void *arg) { - xcpt_t oldhandler; - /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = g_pvd_callback; g_pvd_callback = func; g_callback_arg = arg; @@ -164,5 +160,5 @@ xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, /* Return the old IRQ handler */ - return oldhandler; + return OK; } diff --git a/arch/arm/src/stm32/stm32_exti_pwr.h b/arch/arm/src/stm32/stm32_exti_pwr.h index 26be9bb0ef..c4841dffeb 100644 --- a/arch/arm/src/stm32/stm32_exti_pwr.h +++ b/arch/arm/src/stm32/stm32_exti_pwr.h @@ -60,13 +60,12 @@ * - 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. + * Zero (OK) returned on success; a negated errno value is returned on + * failure. * ****************************************************************************/ -xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, - xcpt_t func, void *arg); +int stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, + xcpt_t func, void *arg); #endif /* STM32_EXTI_PWR_H_ */ diff --git a/arch/arm/src/stm32f7/stm32_exti_pwr.c b/arch/arm/src/stm32f7/stm32_exti_pwr.c index 54239c777a..e3418e0069 100644 --- a/arch/arm/src/stm32f7/stm32_exti_pwr.c +++ b/arch/arm/src/stm32f7/stm32_exti_pwr.c @@ -123,20 +123,16 @@ static int stm32_exti_pvd_isr(int irq, void *context, void *arg) * - func: when non-NULL, generate interrupt * * 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. + * Zero (OK) returned on success; a negated errno value is returned on + * failure. * ****************************************************************************/ -xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, - xcpt_t func, void *arg) +int stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, + xcpt_t func, void *arg); { - xcpt_t oldhandler; - /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = g_pvd_callback; g_pvd_callback = func; g_callback_arg = arg; @@ -172,5 +168,5 @@ xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, /* Return the old IRQ handler */ - return oldhandler; + return OK; } diff --git a/arch/arm/src/stm32f7/stm32_exti_pwr.h b/arch/arm/src/stm32f7/stm32_exti_pwr.h index 521e7a7b2a..67e22d05ff 100644 --- a/arch/arm/src/stm32f7/stm32_exti_pwr.h +++ b/arch/arm/src/stm32f7/stm32_exti_pwr.h @@ -61,13 +61,12 @@ * - 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. + * Zero (OK) returned on success; a negated errno value is returned on + * failure. * ****************************************************************************/ -xcpt_t stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, - xcpt_t func, void *arg); +int stm32_exti_pvd(bool risingedge, bool fallingedge, bool event, + xcpt_t func, void *arg); #endif /* __ARCH_ARM_SRC_STM32F7_STM32_EXTI_PWR_H */ diff --git a/arch/arm/src/stm32l4/stm32l4_exti_pwr.c b/arch/arm/src/stm32l4/stm32l4_exti_pwr.c index 62c1dcfa57..144e08a3f7 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_pwr.c +++ b/arch/arm/src/stm32l4/stm32l4_exti_pwr.c @@ -114,20 +114,16 @@ static int stm32l4_exti_pvd_isr(int irq, void *context, FAR void *arg) * - func: when non-NULL, generate interrupt * * 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. + * Zero (OK) returned on success; a negated errno value is returned on + * failure. * ****************************************************************************/ -xcpt_t stm32l4_exti_pvd(bool risingedge, bool fallingedge, bool event, +int stm32l4_exti_pvd(bool risingedge, bool fallingedge, bool event, xcpt_t func, void *arg) { - xcpt_t oldhandler; - /* Get the previous GPIO IRQ handler; Save the new IRQ handler. */ - oldhandler = g_pvd_callback; g_pvd_callback = func; g_callback_arg = arg; @@ -163,5 +159,5 @@ xcpt_t stm32l4_exti_pvd(bool risingedge, bool fallingedge, bool event, /* Return the old IRQ handler */ - return oldhandler; + return OK; } diff --git a/arch/arm/src/stm32l4/stm32l4_exti_pwr.h b/arch/arm/src/stm32l4/stm32l4_exti_pwr.h index 109da43458..27e584779b 100644 --- a/arch/arm/src/stm32l4/stm32l4_exti_pwr.h +++ b/arch/arm/src/stm32l4/stm32l4_exti_pwr.h @@ -60,13 +60,12 @@ * - 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. + * Zero (OK) returned on success; a negated errno value is returned on + * failure. * ****************************************************************************/ -xcpt_t stm32l4_exti_pvd(bool risingedge, bool fallingedge, bool event, - xcpt_t func, void *arg); +int stm32l4_exti_pvd(bool risingedge, bool fallingedge, bool event, + xcpt_t func, void *arg); #endif /* STM32L4_EXTI_PWR_H_ */