diff options
| author | Krishna Kumaar Natarajan <kknatara@qca.qualcomm.com> | 2016-02-19 14:46:46 -0800 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2016-03-07 16:31:33 +0530 |
| commit | a02855aae9b1ce83a11dcd3dfa75ee3a5dc20002 (patch) | |
| tree | 009233666792fcf7ac2d236b49ae3f4508b81101 | |
| parent | e6384482e358799fa77e05a25f24b81e0eb9b4b3 (diff) | |
qcacld-2.0: Introduce vos_status_to_os_return
Need to convert important VOS_STATUS errors to OS specific errors
Change-Id: I612e77b229c8c9d5d2c2b7273a73402b2d2ba063
CRs-Fixed: 830599
| -rw-r--r-- | CORE/VOSS/inc/vos_utils.h | 1 | ||||
| -rw-r--r-- | CORE/VOSS/src/vos_utils.c | 38 |
2 files changed, 39 insertions, 0 deletions
diff --git a/CORE/VOSS/inc/vos_utils.h b/CORE/VOSS/inc/vos_utils.h index 7538d22d38f4..53e9731a8b7c 100644 --- a/CORE/VOSS/inc/vos_utils.h +++ b/CORE/VOSS/inc/vos_utils.h @@ -199,5 +199,6 @@ void vos_tdls_tx_rx_mgmt_event(uint8_t event_id, uint8_t tx_rx, #endif /* FEATURE_WLAN_DIAG_SUPPORT */ unsigned long vos_rounddown_pow_of_two(unsigned long n); +int vos_status_to_os_return(VOS_STATUS status); #endif // #if !defined __VOSS_UTILS_H diff --git a/CORE/VOSS/src/vos_utils.c b/CORE/VOSS/src/vos_utils.c index 58b28e1e3038..d178b8b709e0 100644 --- a/CORE/VOSS/src/vos_utils.c +++ b/CORE/VOSS/src/vos_utils.c @@ -72,6 +72,7 @@ #ifdef CONFIG_CNSS #include <linux/qcomwlan_secif.h> #endif +#include <errno.h> #include "ieee80211_common.h" /*---------------------------------------------------------------------------- @@ -1277,3 +1278,40 @@ unsigned long vos_rounddown_pow_of_two(unsigned long n) return __rounddown_pow_of_two(n); } + +/** + * vos_status_to_os_return(): translates vos_status types to linux return types + * @status: status to translate + * + * Translates error types that linux may want to handle specially. + * + * return: 0 or the linux error code that most closely matches the VOS_STATUS. + * defaults to -1 (EPERM) + */ +int vos_status_to_os_return(VOS_STATUS status) +{ + switch (status) { + case VOS_STATUS_SUCCESS: + return 0; + case VOS_STATUS_E_FAULT: + return -EFAULT; + case VOS_STATUS_E_TIMEOUT: + case VOS_STATUS_E_BUSY: + return -EBUSY; + case VOS_STATUS_E_AGAIN: + return -EAGAIN; + case VOS_STATUS_E_NOSUPPORT: + return -ENOSYS; + case VOS_STATUS_E_ALREADY: + return -EALREADY; + case VOS_STATUS_E_NOMEM: + return -ENOMEM; + case VOS_STATUS_E_FAILURE: + case VOS_STATUS_E_INVAL: + return -EINVAL; + default: + VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, + FL("Unhandled VOS_STATUS:%d"), status); + return -EPERM; + } +} |
