staging: wilc1000: remove thread wrapper
authorArnd Bergmann <arnd@arndb.de>
Fri, 29 May 2015 20:52:14 +0000 (22:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 May 2015 23:56:57 +0000 (08:56 +0900)
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>
drivers/staging/wilc1000/Makefile
drivers/staging/wilc1000/host_interface.c
drivers/staging/wilc1000/wilc_osconfig.h
drivers/staging/wilc1000/wilc_oswrapper.h
drivers/staging/wilc1000/wilc_platform.h
drivers/staging/wilc1000/wilc_thread.c [deleted file]
drivers/staging/wilc1000/wilc_thread.h [deleted file]

index 4aa0d84ba8dae9d128442ab6454a230a03c9f7e2..4aa5f6764df45fd32b3f0916e0c696cb1064f029 100644 (file)
@@ -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
index fcbadd1885de60b8fd761878cd7fba4db8242060..7c764a2ba5732b55fa5becb6c08fa407dbd7107c 100644 (file)
@@ -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_:
index 2e3700e2c1add49d7b0a21c8e8fc8b7188809551..aa98ea5b423f85ece0a29aa3681a95c214ee638c 100644 (file)
@@ -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
index df288c8be626ab40267a3133a2019579e7ca3d52..03a1ecf90625b49f087c67204b783e0a1c10cce1 100644 (file)
@@ -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"
index 31d5034cb7fa564c4189175060604d99990b1ab1..87e4eedcc914af89c0bc0d938649676467f45c98 100644 (file)
  *      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
  *      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 (file)
index 5eb04e8..0000000
+++ /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 (file)
index c862cd5..0000000
+++ /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