lkml.org 
[lkml]   [2015]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 03/16] staging: wilc1000: remove thread wrapper
Date
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>
---
drivers/staging/wilc1000/Makefile | 2 +-
drivers/staging/wilc1000/host_interface.c | 16 ++--
drivers/staging/wilc1000/wilc_osconfig.h | 3 -
drivers/staging/wilc1000/wilc_oswrapper.h | 5 -
drivers/staging/wilc1000/wilc_platform.h | 14 ---
drivers/staging/wilc1000/wilc_thread.c | 35 -------
drivers/staging/wilc1000/wilc_thread.h | 153 ------------------------------
7 files changed, 8 insertions(+), 220 deletions(-)
delete mode 100644 drivers/staging/wilc1000/wilc_thread.c
delete mode 100644 drivers/staging/wilc1000/wilc_thread.h

diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile
index 4aa0d84ba8da..4aa5f6764df4 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -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
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index fcbadd1885de..7c764a2ba573 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -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 @@ _fail_timer_2:
_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_:
diff --git a/drivers/staging/wilc1000/wilc_osconfig.h b/drivers/staging/wilc1000/wilc_osconfig.h
index 2e3700e2c1ad..aa98ea5b423f 100644
--- a/drivers/staging/wilc1000/wilc_osconfig.h
+++ b/drivers/staging/wilc1000/wilc_osconfig.h
@@ -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
diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h
index df288c8be626..03a1ecf90625 100644
--- a/drivers/staging/wilc1000/wilc_oswrapper.h
+++ b/drivers/staging/wilc1000/wilc_oswrapper.h
@@ -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"
diff --git a/drivers/staging/wilc1000/wilc_platform.h b/drivers/staging/wilc1000/wilc_platform.h
index 31d5034cb7fa..87e4eedcc914 100644
--- a/drivers/staging/wilc1000/wilc_platform.h
+++ b/drivers/staging/wilc1000/wilc_platform.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;

diff --git a/drivers/staging/wilc1000/wilc_thread.c b/drivers/staging/wilc1000/wilc_thread.c
deleted file mode 100644
index 5eb04e839309..000000000000
--- a/drivers/staging/wilc1000/wilc_thread.c
+++ /dev/null
@@ -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
diff --git a/drivers/staging/wilc1000/wilc_thread.h b/drivers/staging/wilc1000/wilc_thread.h
deleted file mode 100644
index c862cd544dd4..000000000000
--- a/drivers/staging/wilc1000/wilc_thread.h
+++ /dev/null
@@ -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
--
2.1.0.rc2


\
 
 \ /
  Last update: 2015-05-29 23:01    [W:0.090 / U:5.220 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site