mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 19:24:01 -04:00
staging: wilc1000: remove thread wrapper
The wilc_thread code is a very thin wrapper around kthread, so just remove it and use kthread directly. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
544c69dc83
commit
1999bd5251
@@ -27,7 +27,7 @@ ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += -DWILC_NORMAL_ALLOC
|
||||
|
||||
wilc1000-objs := wilc_wfi_netdevice.o wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
|
||||
wilc_memory.o wilc_msgqueue.o wilc_semaphore.o wilc_sleep.o wilc_strutils.o \
|
||||
wilc_thread.o wilc_time.o wilc_timer.o coreconfigurator.o host_interface.o \
|
||||
wilc_time.o wilc_timer.o coreconfigurator.o host_interface.o \
|
||||
fifo_buffer.o wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o
|
||||
|
||||
wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o
|
||||
|
||||
@@ -543,7 +543,7 @@ tstrWILC_WFIDrv *gWFiDrvHandle = WILC_NULL;
|
||||
WILC_Bool g_obtainingIP = WILC_FALSE;
|
||||
#endif
|
||||
WILC_Uint8 P2P_LISTEN_STATE;
|
||||
static WILC_ThreadHandle HostIFthreadHandler;
|
||||
static struct task_struct *HostIFthreadHandler;
|
||||
static WILC_MsgQueueHandle gMsgQHostIF;
|
||||
static WILC_SemaphoreHandle hSemHostIFthrdEnd;
|
||||
|
||||
@@ -4370,7 +4370,7 @@ static WILC_Sint32 Handle_DelAllRxBASessions(void *drvHandler, tstrHostIfBASessi
|
||||
* @date
|
||||
* @version 1.0
|
||||
*/
|
||||
static void hostIFthread(void *pvArg)
|
||||
static int hostIFthread(void *pvArg)
|
||||
{
|
||||
WILC_Uint32 u32Ret;
|
||||
tstrHostIFmsg strHostIFmsg;
|
||||
@@ -4591,10 +4591,7 @@ static void hostIFthread(void *pvArg)
|
||||
|
||||
PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n");
|
||||
WILC_SemaphoreRelease(&hSemHostIFthrdEnd, WILC_NULL);
|
||||
return;
|
||||
/* do_exit(error); */
|
||||
/* PRINT_D(HOSTINF_DBG,"do_exit error code %d\n",error); */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void TimerCB_Scan(void *pvArg)
|
||||
@@ -6683,9 +6680,10 @@ WILC_Sint32 host_int_init(WILC_WFIDrvHandle *phWFIDrv)
|
||||
goto _fail_;
|
||||
}
|
||||
msgQ_created = 1;
|
||||
s32Error = WILC_ThreadCreate(&HostIFthreadHandler, hostIFthread, WILC_NULL, WILC_NULL);
|
||||
if (s32Error < 0) {
|
||||
HostIFthreadHandler = kthread_run(hostIFthread, NULL, "WILC_kthread");
|
||||
if (IS_ERR(HostIFthreadHandler)) {
|
||||
PRINT_ER("Failed to creat Thread\n");
|
||||
s32Error = WILC_FAIL;
|
||||
goto _fail_mq_;
|
||||
}
|
||||
s32Error = WILC_TimerCreate(&(g_hPeriodicRSSI), GetPeriodicRSSI, WILC_NULL);
|
||||
@@ -6788,7 +6786,7 @@ WILC_Sint32 host_int_init(WILC_WFIDrvHandle *phWFIDrv)
|
||||
_fail_timer_1:
|
||||
WILC_TimerDestroy(&(pstrWFIDrv->hScanTimer), WILC_NULL);
|
||||
_fail_thread_:
|
||||
WILC_ThreadDestroy(&HostIFthreadHandler, WILC_NULL);
|
||||
kthread_stop(HostIFthreadHandler);
|
||||
_fail_mq_:
|
||||
WILC_MsgQueueDestroy(&gMsgQHostIF, WILC_NULL);
|
||||
_fail_:
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
|
||||
/* OS features supported */
|
||||
|
||||
#define CONFIG_WILC_THREAD_FEATURE 1
|
||||
/* #define CONFIG_WILC_THREAD_SUSPEND_CONTROL 1 */
|
||||
/* #define CONFIG_WILC_THREAD_STRICT_PRIORITY 1 */
|
||||
#define CONFIG_WILC_SEMAPHORE_FEATURE 1
|
||||
/* #define CONFIG_WILC_SEMAPHORE_TIMEOUT 1 */
|
||||
#define CONFIG_WILC_SLEEP_FEATURE 1
|
||||
|
||||
@@ -54,11 +54,6 @@ typedef WILC_Uint16 WILC_WideChar;
|
||||
/* Error reporting and handling support */
|
||||
#include "wilc_errorsupport.h"
|
||||
|
||||
/* Thread support */
|
||||
#ifdef CONFIG_WILC_THREAD_FEATURE
|
||||
#include "wilc_thread.h"
|
||||
#endif
|
||||
|
||||
/* Semaphore support */
|
||||
#ifdef CONFIG_WILC_SEMAPHORE_FEATURE
|
||||
#include "wilc_semaphore.h"
|
||||
|
||||
@@ -15,18 +15,6 @@
|
||||
* Feature support checks
|
||||
*******************************************************************/
|
||||
|
||||
/* CONFIG_WILC_THREAD_FEATURE is implemented */
|
||||
|
||||
/* remove the following block when implementing its feature */
|
||||
#ifdef CONFIG_WILC_THREAD_SUSPEND_CONTROL
|
||||
#error This feature is not supported by this OS
|
||||
#endif
|
||||
|
||||
/* remove the following block when implementing its feature */
|
||||
#ifdef CONFIG_WILC_THREAD_STRICT_PRIORITY
|
||||
#error This feature is not supported by this OS
|
||||
#endif
|
||||
|
||||
/* CONFIG_WILC_SEMAPHORE_FEATURE is implemented */
|
||||
|
||||
/* remove the following block when implementing its feature
|
||||
@@ -140,8 +128,6 @@
|
||||
* OS specific types
|
||||
*******************************************************************/
|
||||
|
||||
typedef struct task_struct *WILC_ThreadHandle;
|
||||
|
||||
typedef void *WILC_MemoryPoolHandle;
|
||||
typedef struct semaphore WILC_SemaphoreHandle;
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
|
||||
#include "wilc_oswrapper.h"
|
||||
|
||||
#ifdef CONFIG_WILC_THREAD_FEATURE
|
||||
|
||||
|
||||
|
||||
WILC_ErrNo WILC_ThreadCreate(WILC_ThreadHandle *pHandle, tpfWILC_ThreadFunction pfEntry,
|
||||
void *pvArg, tstrWILC_ThreadAttrs *pstrAttrs)
|
||||
{
|
||||
|
||||
|
||||
*pHandle = kthread_run((int (*)(void *))pfEntry, pvArg, "WILC_kthread");
|
||||
|
||||
|
||||
if (IS_ERR(*pHandle)) {
|
||||
return WILC_FAIL;
|
||||
} else {
|
||||
return WILC_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WILC_ErrNo WILC_ThreadDestroy(WILC_ThreadHandle *pHandle,
|
||||
tstrWILC_ThreadAttrs *pstrAttrs)
|
||||
{
|
||||
WILC_ErrNo s32RetStatus = WILC_SUCCESS;
|
||||
|
||||
kthread_stop(*pHandle);
|
||||
return s32RetStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,153 +0,0 @@
|
||||
#ifndef __WILC_THREAD_H__
|
||||
#define __WILC_THREAD_H__
|
||||
|
||||
/*!
|
||||
* @file wilc_thread.h
|
||||
* @brief Thread OS Wrapper functionality
|
||||
* @author syounan
|
||||
* @sa wilc_oswrapper.h top level OS wrapper file
|
||||
* @date 10 Aug 2010
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_WILC_THREAD_FEATURE
|
||||
#error the feature WILC_OS_FEATURE_THREAD must be supported to include this file
|
||||
#endif
|
||||
|
||||
typedef void (*tpfWILC_ThreadFunction)(void *);
|
||||
|
||||
typedef enum {
|
||||
#ifdef CONFIG_WILC_THREAD_STRICT_PRIORITY
|
||||
WILC_OS_THREAD_PIORITY_0 = 0,
|
||||
WILC_OS_THREAD_PIORITY_1 = 1,
|
||||
WILC_OS_THREAD_PIORITY_2 = 2,
|
||||
WILC_OS_THREAD_PIORITY_3 = 3,
|
||||
WILC_OS_THREAD_PIORITY_4 = 4,
|
||||
#endif
|
||||
|
||||
WILC_OS_THREAD_PIORITY_HIGH = 0,
|
||||
WILC_OS_THREAD_PIORITY_NORMAL = 2,
|
||||
WILC_OS_THREAD_PIORITY_LOW = 4
|
||||
} tenuWILC_ThreadPiority;
|
||||
|
||||
/*!
|
||||
* @struct WILC_ThreadAttrs
|
||||
* @brief Thread API options
|
||||
* @author syounan
|
||||
* @date 10 Aug 2010
|
||||
* @version 1.0
|
||||
*/
|
||||
typedef struct {
|
||||
/*!<
|
||||
* stack size for use with WILC_ThreadCreate, default is WILC_OS_THREAD_DEFAULT_STACK
|
||||
*/
|
||||
WILC_Uint32 u32StackSize;
|
||||
|
||||
/*!<
|
||||
* piority for the thread, if WILC_OS_FEATURE_THREAD_STRICT_PIORITY is defined
|
||||
* this value is strictly observed and can take a larger resolution
|
||||
*/
|
||||
tenuWILC_ThreadPiority enuPiority;
|
||||
|
||||
#ifdef CONFIG_WILC_THREAD_SUSPEND_CONTROL
|
||||
/*!
|
||||
* if true the thread will be created suspended
|
||||
*/
|
||||
WILC_Bool bStartSuspended;
|
||||
#endif
|
||||
|
||||
} tstrWILC_ThreadAttrs;
|
||||
|
||||
#define WILC_OS_THREAD_DEFAULT_STACK (10 * 1024)
|
||||
|
||||
/*!
|
||||
* @brief Fills the WILC_ThreadAttrs with default parameters
|
||||
* @param[out] pstrAttrs structure to be filled
|
||||
* @sa WILC_ThreadAttrs
|
||||
* @author syounan
|
||||
* @date 10 Aug 2010
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
static void WILC_ThreadFillDefault(tstrWILC_ThreadAttrs *pstrAttrs)
|
||||
{
|
||||
pstrAttrs->u32StackSize = WILC_OS_THREAD_DEFAULT_STACK;
|
||||
pstrAttrs->enuPiority = WILC_OS_THREAD_PIORITY_NORMAL;
|
||||
|
||||
#ifdef CONFIG_WILC_THREAD_SUSPEND_CONTROL
|
||||
pstrAttrs->bStartSuspended = WILC_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Creates a new thread
|
||||
* @details if the feature WILC_OS_FEATURE_THREAD_SUSPEND_CONTROL is
|
||||
* defined and tstrWILC_ThreadAttrs.bStartSuspended is set to true
|
||||
* the new thread will be created in suspended state, otherwise
|
||||
* it will start executing immeadiately
|
||||
* if the feature WILC_OS_FEATURE_THREAD_STRICT_PIORITY is defined
|
||||
* piorities are strictly observed, otherwise the underlaying OS
|
||||
* may not observe piorities
|
||||
* @param[out] pHandle handle to the newly created thread object
|
||||
* @param[in] pfEntry pointer to the entry point of the new thread
|
||||
* @param[in] pstrAttrs Optional attributes, NULL for default
|
||||
* @return Error code indicating sucess/failure
|
||||
* @sa WILC_ThreadAttrs
|
||||
* @author syounan
|
||||
* @date 10 Aug 2010
|
||||
* @version 1.0
|
||||
*/
|
||||
WILC_ErrNo WILC_ThreadCreate(WILC_ThreadHandle *pHandle, tpfWILC_ThreadFunction pfEntry,
|
||||
void *pvArg, tstrWILC_ThreadAttrs *pstrAttrs);
|
||||
|
||||
/*!
|
||||
* @brief Destroys the Thread object
|
||||
* @details This function is used for clean up and freeing any used resources
|
||||
* This function will block until the destroyed thread exits cleanely,
|
||||
* so, the thread code thould handle an exit case before this calling
|
||||
* this function
|
||||
* @param[in] pHandle handle to the thread object
|
||||
* @param[in] pstrAttrs Optional attributes, NULL for default
|
||||
* @return Error code indicating sucess/failure
|
||||
* @sa WILC_ThreadAttrs
|
||||
* @author syounan
|
||||
* @date 10 Aug 2010
|
||||
* @version 1.0
|
||||
*/
|
||||
WILC_ErrNo WILC_ThreadDestroy(WILC_ThreadHandle *pHandle,
|
||||
tstrWILC_ThreadAttrs *pstrAttrs);
|
||||
|
||||
#ifdef CONFIG_WILC_THREAD_SUSPEND_CONTROL
|
||||
|
||||
/*!
|
||||
* @brief Suspends an executing Thread object
|
||||
* @param[in] pHandle handle to the thread object
|
||||
* @param[in] pstrAttrs Optional attributes, NULL for default
|
||||
* @return Error code indicating sucess/failure
|
||||
* @sa WILC_ThreadAttrs
|
||||
* @note Optional part, WILC_OS_FEATURE_THREAD_SUSPEND_CONTROL must be enabled
|
||||
* @author syounan
|
||||
* @date 10 Aug 2010
|
||||
* @version 1.0
|
||||
*/
|
||||
WILC_ErrNo WILC_ThreadSuspend(WILC_ThreadHandle *pHandle,
|
||||
tstrWILC_ThreadAttrs *pstrAttrs);
|
||||
|
||||
/*!
|
||||
* @brief Resumes a suspened Thread object
|
||||
* @param[in] pHandle handle to the thread object
|
||||
* @param[in] pstrAttrs Optional attributes, NULL for default
|
||||
* @return Error code indicating sucess/failure
|
||||
* @sa WILC_ThreadAttrs
|
||||
* @note Optional part, WILC_OS_FEATURE_THREAD_SUSPEND_CONTROL must be enabled
|
||||
* @author syounan
|
||||
* @date 10 Aug 2010
|
||||
* @version 1.0
|
||||
*/
|
||||
WILC_ErrNo WILC_ThreadResume(WILC_ThreadHandle *pHandle,
|
||||
tstrWILC_ThreadAttrs *pstrAttrs);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user