qcacmn: Move qdf_status_to/from_os_return()
QDF_STATUS is defined in qdf_status, but related APIs qdf_status_to_os_return() and qdf_status_from_os_return() are defined in qdf_util. Create a new file, qdf_status.c, and move these functions there instead. Change-Id: Iaa2efa5f662be014a61a8490c3fab411ec0f2054 CRs-Fixed: 2395178
This commit is contained in:
@@ -48,6 +48,7 @@ linux/src/qdf_module.o \
|
|||||||
linux/src/qdf_net_if.o \
|
linux/src/qdf_net_if.o \
|
||||||
linux/src/qdf_nbuf.o \
|
linux/src/qdf_nbuf.o \
|
||||||
linux/src/qdf_perf.o \
|
linux/src/qdf_perf.o \
|
||||||
|
linux/src/qdf_status.o \
|
||||||
linux/src/qdf_threads.o \
|
linux/src/qdf_threads.o \
|
||||||
linux/src/qdf_trace.o \
|
linux/src/qdf_trace.o \
|
||||||
linux/src/qdf_vfs.o \
|
linux/src/qdf_vfs.o \
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
|
* Copyright (c) 2014-2019 The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for
|
* Permission to use, copy, modify, and/or distribute this software for
|
||||||
* any purpose with or without fee is hereby granted, provided that the
|
* any purpose with or without fee is hereby granted, provided that the
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* Basic status codes/definitions used by QDF
|
* Basic status codes/definitions used by QDF
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(__QDF_STATUS_H)
|
#ifndef __QDF_STATUS_H
|
||||||
#define __QDF_STATUS_H
|
#define __QDF_STATUS_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -139,4 +139,21 @@ typedef enum {
|
|||||||
#define QDF_IS_STATUS_SUCCESS(status) (QDF_STATUS_SUCCESS == (status))
|
#define QDF_IS_STATUS_SUCCESS(status) (QDF_STATUS_SUCCESS == (status))
|
||||||
#define QDF_IS_STATUS_ERROR(status) (QDF_STATUS_SUCCESS != (status))
|
#define QDF_IS_STATUS_ERROR(status) (QDF_STATUS_SUCCESS != (status))
|
||||||
|
|
||||||
#endif /* if !defined __QDF_STATUS_H */
|
/**
|
||||||
|
* qdf_status_to_os_return() - map a QDF_STATUS into an OS specific return code
|
||||||
|
* @status: QDF_STATUS to map
|
||||||
|
*
|
||||||
|
* Return: an OS specific error code
|
||||||
|
*/
|
||||||
|
int qdf_status_to_os_return(QDF_STATUS status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qdf_status_from_os_return() - map an OS specific return code to a QDF_STATUS
|
||||||
|
* @rc: the input return code to map
|
||||||
|
*
|
||||||
|
* Return: QDF_STATUS
|
||||||
|
*/
|
||||||
|
QDF_STATUS qdf_status_from_os_return(int rc);
|
||||||
|
|
||||||
|
#endif /* __QDF_STATUS_H */
|
||||||
|
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
#ifdef TSOSEG_DEBUG
|
#ifdef TSOSEG_DEBUG
|
||||||
#include <qdf_atomic.h>
|
#include <qdf_atomic.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "qdf_status.h"
|
||||||
|
|
||||||
/* Preprocessor definitions and constants */
|
/* Preprocessor definitions and constants */
|
||||||
#define QDF_MAX_SGLIST 4
|
#define QDF_MAX_SGLIST 4
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
|
* Copyright (c) 2014-2019 The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for
|
* Permission to use, copy, modify, and/or distribute this software for
|
||||||
* any purpose with or without fee is hereby granted, provided that the
|
* any purpose with or without fee is hereby granted, provided that the
|
||||||
@@ -122,28 +122,6 @@ typedef __qdf_wait_queue_head_t qdf_wait_queue_head_t;
|
|||||||
#define qdf_ewma_tx_lag_read(tx_lag) \
|
#define qdf_ewma_tx_lag_read(tx_lag) \
|
||||||
__qdf_ewma_tx_lag_read(tx_lag)
|
__qdf_ewma_tx_lag_read(tx_lag)
|
||||||
|
|
||||||
/**
|
|
||||||
* qdf_status_to_os_return - returns the status to OS.
|
|
||||||
* @status: enum QDF_STATUS
|
|
||||||
*
|
|
||||||
* returns: int status success/failure
|
|
||||||
*/
|
|
||||||
static inline int qdf_status_to_os_return(QDF_STATUS status)
|
|
||||||
{
|
|
||||||
return __qdf_status_to_os_return(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* qdf_status_from_os_return() - map OS specific return code to a QDF_STATUS
|
|
||||||
* @rc: the input return code to map
|
|
||||||
*
|
|
||||||
* Return: QDF_STATUS
|
|
||||||
*/
|
|
||||||
static inline QDF_STATUS qdf_status_from_os_return(int rc)
|
|
||||||
{
|
|
||||||
return __qdf_status_from_os_return(rc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qdf_set_bit() - set bit in address
|
* qdf_set_bit() - set bit in address
|
||||||
* @nr: bit number to be set
|
* @nr: bit number to be set
|
||||||
|
@@ -24,8 +24,6 @@
|
|||||||
#if !defined(__I_QDF_TYPES_H)
|
#if !defined(__I_QDF_TYPES_H)
|
||||||
#define __I_QDF_TYPES_H
|
#define __I_QDF_TYPES_H
|
||||||
|
|
||||||
#include <qdf_status.h>
|
|
||||||
|
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
#define __iomem
|
#define __iomem
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
|
* Copyright (c) 2014-2019 The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for
|
* Permission to use, copy, modify, and/or distribute this software for
|
||||||
* any purpose with or without fee is hereby granted, provided that the
|
* any purpose with or without fee is hereby granted, provided that the
|
||||||
@@ -35,7 +35,6 @@
|
|||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
|
|
||||||
#include <qdf_types.h>
|
#include <qdf_types.h>
|
||||||
#include <qdf_status.h>
|
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 3, 8)
|
#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 3, 8)
|
||||||
@@ -63,10 +62,8 @@ typedef wait_queue_head_t __qdf_wait_queue_head_t;
|
|||||||
#define __qdf_wait_queue_interruptible(wait_queue, condition) \
|
#define __qdf_wait_queue_interruptible(wait_queue, condition) \
|
||||||
wait_event_interruptible(wait_queue, condition)
|
wait_event_interruptible(wait_queue, condition)
|
||||||
|
|
||||||
#define __qdf_wait_queue_timeout( \
|
#define __qdf_wait_queue_timeout(wait_queue, condition, timeout) \
|
||||||
wait_queue, condition, timeout) \
|
wait_event_timeout(wait_queue, condition, timeout)
|
||||||
wait_event_timeout(wait_queue, condition,\
|
|
||||||
timeout)
|
|
||||||
|
|
||||||
|
|
||||||
#define __qdf_init_waitqueue_head(_q) init_waitqueue_head(_q)
|
#define __qdf_init_waitqueue_head(_q) init_waitqueue_head(_q)
|
||||||
@@ -75,127 +72,11 @@ typedef wait_queue_head_t __qdf_wait_queue_head_t;
|
|||||||
|
|
||||||
#define __qdf_wake_up(_q) wake_up(_q)
|
#define __qdf_wake_up(_q) wake_up(_q)
|
||||||
|
|
||||||
|
|
||||||
#define __qdf_wake_up_completion(_q) wake_up_completion(_q)
|
#define __qdf_wake_up_completion(_q) wake_up_completion(_q)
|
||||||
|
|
||||||
#define __qdf_unlikely(_expr) unlikely(_expr)
|
#define __qdf_unlikely(_expr) unlikely(_expr)
|
||||||
#define __qdf_likely(_expr) likely(_expr)
|
#define __qdf_likely(_expr) likely(_expr)
|
||||||
|
|
||||||
/**
|
|
||||||
* __qdf_status_to_os_return() - translates qdf_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 QDF_STATUS.
|
|
||||||
* defaults to -1 (EPERM)
|
|
||||||
*/
|
|
||||||
static inline int __qdf_status_to_os_return(QDF_STATUS status)
|
|
||||||
{
|
|
||||||
switch (status) {
|
|
||||||
case QDF_STATUS_SUCCESS:
|
|
||||||
return 0;
|
|
||||||
case QDF_STATUS_E_RESOURCES:
|
|
||||||
return -EBUSY;
|
|
||||||
case QDF_STATUS_E_NOMEM:
|
|
||||||
return -ENOMEM;
|
|
||||||
case QDF_STATUS_E_AGAIN:
|
|
||||||
return -EAGAIN;
|
|
||||||
case QDF_STATUS_E_INVAL:
|
|
||||||
return -EINVAL;
|
|
||||||
case QDF_STATUS_E_FAULT:
|
|
||||||
return -EFAULT;
|
|
||||||
case QDF_STATUS_E_ALREADY:
|
|
||||||
return -EALREADY;
|
|
||||||
case QDF_STATUS_E_BADMSG:
|
|
||||||
return -EBADMSG;
|
|
||||||
case QDF_STATUS_E_BUSY:
|
|
||||||
return -EBUSY;
|
|
||||||
case QDF_STATUS_E_CANCELED:
|
|
||||||
return -ECANCELED;
|
|
||||||
case QDF_STATUS_E_ABORTED:
|
|
||||||
return -ECONNABORTED;
|
|
||||||
case QDF_STATUS_E_PERM:
|
|
||||||
return -EPERM;
|
|
||||||
case QDF_STATUS_E_EXISTS:
|
|
||||||
return -EEXIST;
|
|
||||||
case QDF_STATUS_E_NOENT:
|
|
||||||
return -ENOENT;
|
|
||||||
case QDF_STATUS_E_E2BIG:
|
|
||||||
return -E2BIG;
|
|
||||||
case QDF_STATUS_E_NOSPC:
|
|
||||||
return -ENOSPC;
|
|
||||||
case QDF_STATUS_E_ADDRNOTAVAIL:
|
|
||||||
return -EADDRNOTAVAIL;
|
|
||||||
case QDF_STATUS_E_ENXIO:
|
|
||||||
return -ENXIO;
|
|
||||||
case QDF_STATUS_E_NETDOWN:
|
|
||||||
return -ENETDOWN;
|
|
||||||
case QDF_STATUS_E_IO:
|
|
||||||
return -EIO;
|
|
||||||
case QDF_STATUS_E_NETRESET:
|
|
||||||
return -ENETRESET;
|
|
||||||
case QDF_STATUS_E_PENDING:
|
|
||||||
return -EINPROGRESS;
|
|
||||||
case QDF_STATUS_E_TIMEOUT:
|
|
||||||
return -ETIMEDOUT;
|
|
||||||
default:
|
|
||||||
return -EPERM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline QDF_STATUS __qdf_status_from_os_return(int rc)
|
|
||||||
{
|
|
||||||
switch (rc) {
|
|
||||||
case 0:
|
|
||||||
return QDF_STATUS_SUCCESS;
|
|
||||||
case -ENOMEM:
|
|
||||||
return QDF_STATUS_E_NOMEM;
|
|
||||||
case -EAGAIN:
|
|
||||||
return QDF_STATUS_E_AGAIN;
|
|
||||||
case -EINVAL:
|
|
||||||
return QDF_STATUS_E_INVAL;
|
|
||||||
case -EFAULT:
|
|
||||||
return QDF_STATUS_E_FAULT;
|
|
||||||
case -EALREADY:
|
|
||||||
return QDF_STATUS_E_ALREADY;
|
|
||||||
case -EBADMSG:
|
|
||||||
return QDF_STATUS_E_BADMSG;
|
|
||||||
case -EBUSY:
|
|
||||||
return QDF_STATUS_E_BUSY;
|
|
||||||
case -ECANCELED:
|
|
||||||
return QDF_STATUS_E_CANCELED;
|
|
||||||
case -ECONNABORTED:
|
|
||||||
return QDF_STATUS_E_ABORTED;
|
|
||||||
case -EPERM:
|
|
||||||
return QDF_STATUS_E_PERM;
|
|
||||||
case -EEXIST:
|
|
||||||
return QDF_STATUS_E_EXISTS;
|
|
||||||
case -ENOENT:
|
|
||||||
return QDF_STATUS_E_NOENT;
|
|
||||||
case -E2BIG:
|
|
||||||
return QDF_STATUS_E_E2BIG;
|
|
||||||
case -ENOSPC:
|
|
||||||
return QDF_STATUS_E_NOSPC;
|
|
||||||
case -EADDRNOTAVAIL:
|
|
||||||
return QDF_STATUS_E_ADDRNOTAVAIL;
|
|
||||||
case -ENXIO:
|
|
||||||
return QDF_STATUS_E_ENXIO;
|
|
||||||
case -ENETDOWN:
|
|
||||||
return QDF_STATUS_E_NETDOWN;
|
|
||||||
case -EIO:
|
|
||||||
return QDF_STATUS_E_IO;
|
|
||||||
case -ENETRESET:
|
|
||||||
return QDF_STATUS_E_NETRESET;
|
|
||||||
case -EINPROGRESS:
|
|
||||||
return QDF_STATUS_E_PENDING;
|
|
||||||
case -ETIMEDOUT:
|
|
||||||
return QDF_STATUS_E_TIMEOUT;
|
|
||||||
default:
|
|
||||||
return QDF_STATUS_E_PERM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __qdf_set_bit() - set bit in address
|
* __qdf_set_bit() - set bit in address
|
||||||
* @nr: bit number to be set
|
* @nr: bit number to be set
|
||||||
|
130
qdf/linux/src/qdf_status.c
Normal file
130
qdf/linux/src/qdf_status.c
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014-2019 The Linux Foundation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for
|
||||||
|
* any purpose with or without fee is hereby granted, provided that the
|
||||||
|
* above copyright notice and this permission notice appear in all
|
||||||
|
* copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||||
|
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||||
|
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||||
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "linux/errno.h"
|
||||||
|
#include "qdf_module.h"
|
||||||
|
#include "qdf_status.h"
|
||||||
|
|
||||||
|
int qdf_status_to_os_return(QDF_STATUS status)
|
||||||
|
{
|
||||||
|
switch (status) {
|
||||||
|
case QDF_STATUS_SUCCESS:
|
||||||
|
return 0;
|
||||||
|
case QDF_STATUS_E_RESOURCES:
|
||||||
|
return -EBUSY;
|
||||||
|
case QDF_STATUS_E_NOMEM:
|
||||||
|
return -ENOMEM;
|
||||||
|
case QDF_STATUS_E_AGAIN:
|
||||||
|
return -EAGAIN;
|
||||||
|
case QDF_STATUS_E_INVAL:
|
||||||
|
return -EINVAL;
|
||||||
|
case QDF_STATUS_E_FAULT:
|
||||||
|
return -EFAULT;
|
||||||
|
case QDF_STATUS_E_ALREADY:
|
||||||
|
return -EALREADY;
|
||||||
|
case QDF_STATUS_E_BADMSG:
|
||||||
|
return -EBADMSG;
|
||||||
|
case QDF_STATUS_E_BUSY:
|
||||||
|
return -EBUSY;
|
||||||
|
case QDF_STATUS_E_CANCELED:
|
||||||
|
return -ECANCELED;
|
||||||
|
case QDF_STATUS_E_ABORTED:
|
||||||
|
return -ECONNABORTED;
|
||||||
|
case QDF_STATUS_E_PERM:
|
||||||
|
return -EPERM;
|
||||||
|
case QDF_STATUS_E_EXISTS:
|
||||||
|
return -EEXIST;
|
||||||
|
case QDF_STATUS_E_NOENT:
|
||||||
|
return -ENOENT;
|
||||||
|
case QDF_STATUS_E_E2BIG:
|
||||||
|
return -E2BIG;
|
||||||
|
case QDF_STATUS_E_NOSPC:
|
||||||
|
return -ENOSPC;
|
||||||
|
case QDF_STATUS_E_ADDRNOTAVAIL:
|
||||||
|
return -EADDRNOTAVAIL;
|
||||||
|
case QDF_STATUS_E_ENXIO:
|
||||||
|
return -ENXIO;
|
||||||
|
case QDF_STATUS_E_NETDOWN:
|
||||||
|
return -ENETDOWN;
|
||||||
|
case QDF_STATUS_E_IO:
|
||||||
|
return -EIO;
|
||||||
|
case QDF_STATUS_E_NETRESET:
|
||||||
|
return -ENETRESET;
|
||||||
|
case QDF_STATUS_E_PENDING:
|
||||||
|
return -EINPROGRESS;
|
||||||
|
case QDF_STATUS_E_TIMEOUT:
|
||||||
|
return -ETIMEDOUT;
|
||||||
|
default:
|
||||||
|
return -EPERM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qdf_export_symbol(qdf_status_to_os_return);
|
||||||
|
|
||||||
|
QDF_STATUS qdf_status_from_os_return(int rc)
|
||||||
|
{
|
||||||
|
switch (rc) {
|
||||||
|
case 0:
|
||||||
|
return QDF_STATUS_SUCCESS;
|
||||||
|
case -ENOMEM:
|
||||||
|
return QDF_STATUS_E_NOMEM;
|
||||||
|
case -EAGAIN:
|
||||||
|
return QDF_STATUS_E_AGAIN;
|
||||||
|
case -EINVAL:
|
||||||
|
return QDF_STATUS_E_INVAL;
|
||||||
|
case -EFAULT:
|
||||||
|
return QDF_STATUS_E_FAULT;
|
||||||
|
case -EALREADY:
|
||||||
|
return QDF_STATUS_E_ALREADY;
|
||||||
|
case -EBADMSG:
|
||||||
|
return QDF_STATUS_E_BADMSG;
|
||||||
|
case -EBUSY:
|
||||||
|
return QDF_STATUS_E_BUSY;
|
||||||
|
case -ECANCELED:
|
||||||
|
return QDF_STATUS_E_CANCELED;
|
||||||
|
case -ECONNABORTED:
|
||||||
|
return QDF_STATUS_E_ABORTED;
|
||||||
|
case -EPERM:
|
||||||
|
return QDF_STATUS_E_PERM;
|
||||||
|
case -EEXIST:
|
||||||
|
return QDF_STATUS_E_EXISTS;
|
||||||
|
case -ENOENT:
|
||||||
|
return QDF_STATUS_E_NOENT;
|
||||||
|
case -E2BIG:
|
||||||
|
return QDF_STATUS_E_E2BIG;
|
||||||
|
case -ENOSPC:
|
||||||
|
return QDF_STATUS_E_NOSPC;
|
||||||
|
case -EADDRNOTAVAIL:
|
||||||
|
return QDF_STATUS_E_ADDRNOTAVAIL;
|
||||||
|
case -ENXIO:
|
||||||
|
return QDF_STATUS_E_ENXIO;
|
||||||
|
case -ENETDOWN:
|
||||||
|
return QDF_STATUS_E_NETDOWN;
|
||||||
|
case -EIO:
|
||||||
|
return QDF_STATUS_E_IO;
|
||||||
|
case -ENETRESET:
|
||||||
|
return QDF_STATUS_E_NETRESET;
|
||||||
|
case -EINPROGRESS:
|
||||||
|
return QDF_STATUS_E_PENDING;
|
||||||
|
case -ETIMEDOUT:
|
||||||
|
return QDF_STATUS_E_TIMEOUT;
|
||||||
|
default:
|
||||||
|
return QDF_STATUS_E_PERM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qdf_export_symbol(qdf_status_from_os_return);
|
||||||
|
|
Reference in New Issue
Block a user