stm32_gpiosetevent: GPIO IRQ function should not return the xcpt_t oldhandler. This value is useful and potentially dangerous by itself after the change to assocaite a argument with the interrupt handler.

This commit is contained in:
Gregory Nutt 2017-03-02 18:20:38 -06:00
parent f4bad1a280
commit 454164a88c
13 changed files with 80 additions and 54 deletions

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/cloudctrl/src/stm32_usb.c * configs/cloudctrl/src/stm32_usb.c
* *
* Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* Darcy Gong <darcy.gong@gmail.com> * Darcy Gong <darcy.gong@gmail.com>
* *
@ -274,16 +274,18 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* *
* Input Parameter: * Input Parameter:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return NULL; return -ENOSYS;
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/mikroe_stm32f4/src/stm32_usb.c * configs/mikroe_stm32f4/src/stm32_usb.c
* *
* Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -273,16 +273,18 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* *
* Input Parameter: * Input Parameter:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, arg);
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs//nucleo-144/src/stm32_usb.c * configs//nucleo-144/src/stm32_usb.c
* *
* Copyright (C) 2016 Gregory Nutt. All rights reserved. * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org> * Authors: Gregory Nutt <gnutt@nuttx.org>
* David Sidrane <david_s5@nscdg.com> * David Sidrane <david_s5@nscdg.com>
* *
@ -295,16 +295,18 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* *
* Input Parameter: * Input Parameter:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, arg);
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm32f4discovery/src/stm32_usb.c * configs/stm32f4discovery/src/stm32_usb.c
* *
* Copyright (C) 2012-2013, 2015-2916 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013, 2015-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -302,16 +302,18 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* *
* Input Parameter: * Input Parameter:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, arg);
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/olimex-stm32-h407/src/stm32_usbdev.c * configs/olimex-stm32-h407/src/stm32_usbdev.c
* *
* Copyright (C) 2016 Gregory Nutt. All rights reserved. * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -280,16 +280,18 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* *
* Input Parameters: * Input Parameters:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned Value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return stm32_gpiosetevent(GPIO_OTGHS_OVER, true, true, true, handler, NULL); return stm32_gpiosetevent(GPIO_OTGHS_OVER, true, true, true, handler, arg);
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/olimex-stm32-p207/src/stm32_usb.c * configs/olimex-stm32-p207/src/stm32_usb.c
* *
* Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -238,16 +238,18 @@ int stm32_usbhost_initialize(void)
* *
* Input Parameter: * Input Parameter:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, arg);
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/olimex-stm32-p407/src/stm32_usb.c * configs/olimex-stm32-p407/src/stm32_usb.c
* *
* Copyright (C) 2016 Gregory Nutt. All rights reserved. * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -238,16 +238,18 @@ int stm32_usbhost_setup(void)
* *
* Input Parameter: * Input Parameter:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, arg);
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/shenzhou/src/stm32_usb.c * configs/shenzhou/src/stm32_usb.c
* *
* Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -273,16 +273,18 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* *
* Input Parameter: * Input Parameter:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return NULL; return -ENOSYS;
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm3220g-eval/src/stm32_usb.c * configs/stm3220g-eval/src/stm32_usb.c
* *
* Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -273,16 +273,18 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* *
* Input Parameter: * Input Parameter:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, arg);
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm3240g-eval/src/stm32_usbdev.c * configs/stm3240g-eval/src/stm32_usbdev.c
* *
* Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -273,16 +273,18 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* *
* Input Parameter: * Input Parameter:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, arg);
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm32f429i-disco/src/stm32_usbdev.c * configs/stm32f429i-disco/src/stm32_usbdev.c
* *
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -279,16 +279,18 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* *
* Input Parameters: * Input Parameters:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned Value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return stm32_gpiosetevent(GPIO_OTGHS_OVER, true, true, true, handler, NULL); return stm32_gpiosetevent(GPIO_OTGHS_OVER, true, true, true, handler, arg);
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm32f4discovery/src/stm32_usb.c * configs/stm32f4discovery/src/stm32_usb.c
* *
* Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2012-2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -302,16 +302,18 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* *
* Input Parameter: * Input Parameter:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, arg);
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm32f4discovery/src/stm32_usb.c * configs/stm32f4discovery/src/stm32_usb.c
* *
* Copyright (C) 2016 Gregory Nutt. All rights reserved. * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -305,16 +305,18 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
* *
* Input Parameter: * Input Parameter:
* handler - New overcurrent interrupt handler * handler - New overcurrent interrupt handler
* arg - The argument provided for the interrupt handler
* *
* Returned value: * Returned value:
* Old overcurrent interrupt handler * Zero (OK) is returned on success. Otherwise, a negated errno value is returned
* to indicate the nature of the failure.
* *
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_USBHOST #ifdef CONFIG_USBHOST
xcpt_t stm32_setup_overcurrent(xcpt_t handler) int stm32_setup_overcurrent(xcpt_t handler, void *arg)
{ {
return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, NULL); return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, arg);
} }
#endif #endif