staging: wilc1000 dead code removal
PATCH 1/1 staging: wilc1000 dead code removal
Subject: [PATCH] staging: wilc1000 dead code removal
After finding some build errors in wilc1000, I played some more with the driver and eliminated a lot of unused code. This is all code meant for OS abstraction. Since we know we are running Linux, and which version we use, it can all be removed.
Some minor changes are included that are necessary to remove other code.
drivers/staging/wilc1000/Makefile +3 -10
@@ -10,11 +10,10 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \ -DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \ -DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\" -ccflags-y += -I$(src)/ -DEXPORT_SYMTAB -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 \ +ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 \ -DPLL_WORKAROUND -DCONNECT_DIRECT -DAGING_ALG \ -DWILC_PARSE_SCAN_IN_HOST -DDISABLE_PWRSAVE_AND_SCAN_DURING_IP \ - -DWILC_PLATFORM=WILC_LINUXKERNEL -Wno-unused-function -DUSE_WIRELESS \ - -DWILC_DEBUGFS + -Wno-unused-function -DUSE_WIRELESS -DWILC_DEBUGFS #ccflags-y += -DTCP_ACK_FILTER ccflags-$(CONFIG_WILC1000_PREALLOCATE_DURING_SYSTEM_BOOT) += -DMEMORY_STATIC \
@@ -28,14 +27,8 @@ 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 wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o - -WILC1000_SRC_VERSION = 10.0 -PATCHLEVEL = 2 -WILC1000_FW_VERSION = 0 - -ccflags-y += -D__DRIVER_VERSION__=\"$(WILC1000_SRC_VERSION).$(PATCHLEVEL)\"
drivers/staging/wilc1000/coreconfigurator.c +0 -2
@@ -2123,7 +2123,6 @@ WILC_Sint32 CoreConfiguratorDeInit(void)#ifndef SIMULATION -#if WILC_PLATFORM !=WILC_WIN32 /*Using the global handle of the driver*/ extern wilc_wlan_oup_t *gpstrWlanOps;/**
@@ -2198,4 +2197,3 @@ WILC_Sint32 SendConfigPkt(WILC_Uint8 u8Mode, tstrWID *pstrWIDs, return ret; }#endif -#endif
drivers/staging/wilc1000/host_interface.c +7 -9
@@ -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_:
drivers/staging/wilc1000/linux_wlan.c +2 -88
134 lines not on this page · raw message
drivers/staging/wilc1000/wilc_errorsupport.h +0 -17
@@ -64,21 +64,4 @@ typedef WILC_Sint32 WILC_ErrNo; ERRORHANDLER: \ if (WILC_IS_ERR(__status__)) \ -#ifdef CONFIG_WILC_ASSERTION_SUPPORT - -/** -* @brief prints a diagnostic message and aborts the program -* @param[in] pcExpression The expression that triggered the assertion -* @param[in] pcFileName The name of the current source file. -* @param[in] u32LineNumber The line number in the current source file. -* @warning DO NOT CALL DIRECTLY. USE EQUIVALENT MACRO FUNCTION INSTEAD. -*/ -void WILC_assert_INTERNAL (WILC_Char *pcExpression,WILC_Char *pcFileName,WILC_Uint32 u32LineNumber); - -#define WILC_assert (__expression__) (void)(!!(__expression__) || (WILC_assert_INTERNAL((# __expression__), __WILC_FILE__, __WILC_LINE__), 0)) - -#else -#define WILC_assert (__expression__) ((void)0) -#endif -#endif
drivers/staging/wilc1000/wilc_event.h deleted +0 -0
drivers/staging/wilc1000/wilc_memory.c +0 -5
@@ -1,9 +1,6 @@#include "wilc_oswrapper.h" -#ifdef CONFIG_WILC_MEMORY_FEATURE - -/*! * @author syounan * @date 18 Aug 2010
@@ -59,5 +56,3 @@ void WILC_MemoryFree(void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, {kfree (pvBlock); } - -#endif
drivers/staging/wilc1000/wilc_memory.h +0 -93
120 lines not on this page · raw message
drivers/staging/wilc1000/wilc_msgqueue.c +0 -9
@@ -1,8 +1,6 @@#include "wilc_oswrapper.h" #include <linux/spinlock.h> -#ifdef CONFIG_WILC_MSG_QUEUE_FEATURE -/*! * @author syounan
@@ -154,11 +152,6 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,spin_unlock_irqrestore (&pHandle->strCriticalSection, flags);WILC_SemaphoreFillDefault (&strSemAttrs); -#ifdef CONFIG_WILC_MSG_QUEUE_TIMEOUT -if (pstrAttrs !=WILC_NULL ) { - strSemAttrs.u32TimeOut = pstrAttrs->u32Timeout; - } -#endif s32RetStatus =WILC_SemaphoreAcquire (&(pHandle->hSem), &strSemAttrs);if (s32RetStatus ==WILC_TIMEOUT ) {/* timed out, just exit without consumeing the message */
@@ -207,5 +200,3 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,return s32RetStatus; } - -#endif
drivers/staging/wilc1000/wilc_msgqueue.h +0 -30
@@ -10,10 +10,6 @@* @version 1.0 */ -#ifndef CONFIG_WILC_MSG_QUEUE_FEATURE -#error the feature CONFIG_WILC_MSG_QUEUE_FEATURE must be supported to include this file -#endif -/*! * @struct tstrWILC_MsgQueueAttrs * @brief Message Queue API options
@@ -22,38 +18,12 @@* @version 1.0 */ typedef struct { -#ifdef CONFIG_WILC_MSG_QUEUE_IPC_NAME -WILC_Char *pcName; -#endif - -#ifdef CONFIG_WILC_MSG_QUEUE_TIMEOUT -WILC_Uint32 u32Timeout; -#endif -/* a dummy member to avoid compiler errors*/ WILC_Uint8 dummy; }tstrWILC_MsgQueueAttrs ;/*! -* @brief Fills the MsgQueueAttrs with default parameters -* @param[out] pstrAttrs structure to be filled -* @sa WILC_TimerAttrs -* @author syounan -* @date 30 Aug 2010 -* @version 1.0 -*/ -static void WILC_MsgQueueFillDefault (tstrWILC_MsgQueueAttrs *pstrAttrs) -{ -#ifdef CONFIG_WILC_MSG_QUEUE_IPC_NAME - pstrAttrs->pcName =WILC_NULL ; -#endif - -#ifdef CONFIG_WILC_MSG_QUEUE_TIMEOUT - pstrAttrs->u32Timeout =WILC_OS_INFINITY ; -#endif -} -/*! * @brief Creates a new Message queue * @details Creates a new Message queue, if the feature * CONFIG_WILC_MSG_QUEUE_IPC_NAME is enabled and pstrAttrs->pcName
drivers/staging/wilc1000/wilc_osconfig.h +0 -46
52 lines not on this page · raw message
drivers/staging/wilc1000/wilc_oswrapper.h +0 -58
87 lines not on this page · raw message
drivers/staging/wilc1000/wilc_platform.h +0 -129
145 lines not on this page · raw message
drivers/staging/wilc1000/wilc_semaphore.c +0 -14
@@ -1,7 +1,5 @@#include "wilc_oswrapper.h" -#ifdef CONFIG_WILC_SEMAPHORE_FEATURE -WILC_ErrNo WILC_SemaphoreCreate (WILC_SemaphoreHandle *pHandle,tstrWILC_SemaphoreAttrs *pstrAttrs)
@@ -33,19 +31,9 @@ WILC_ErrNo WILC_SemaphoreAcquire(WILC_SemaphoreHandle *pHandle, {WILC_ErrNo s32RetStatus =WILC_SUCCESS ; -#ifndef CONFIG_WILC_SEMAPHORE_TIMEOUT while (down_interruptible (pHandle)) ; -#else -if (pstrAttrs ==WILC_NULL ) { -down (pHandle); - }else { - - s32RetStatus =down_timeout (pHandle,msecs_to_jiffies (pstrAttrs->u32TimeOut)); - } -#endif -if (s32RetStatus ==0 ) {return WILC_SUCCESS ; }else if (s32RetStatus == -ETIME ) {
@@ -66,5 +54,3 @@ WILC_ErrNo WILC_SemaphoreRelease(WILC_SemaphoreHandle *pHandle,return WILC_SUCCESS ; } - -#endif
drivers/staging/wilc1000/wilc_semaphore.h +1 -17
@@ -10,11 +10,6 @@* @version 1.0 */ - -#ifndef CONFIG_WILC_SEMAPHORE_FEATURE -#error the feature WILC_OS_FEATURE_SEMAPHORE must be supported to include this file -#endif -/*! * @struct WILC_SemaphoreAttrs * @brief Semaphore API options
@@ -28,14 +23,6 @@ typedef struct {*/ WILC_Uint32 u32InitCount; -#ifdef CONFIG_WILC_SEMAPHORE_TIMEOUT -/*!< -* Timeout for use with WILC_SemaphoreAcquire, 0 to return immediately and -* WILC_OS_INFINITY to wait forever. default is WILC_OS_INFINITY -*/ -WILC_Uint32 u32TimeOut; -#endif - } tstrWILC_SemaphoreAttrs;
@@ -47,12 +34,9 @@ typedef struct {* @date 10 Aug 2010 * @version 1.0 */ -static void WILC_SemaphoreFillDefault (tstrWILC_SemaphoreAttrs *pstrAttrs) +static inline void WILC_SemaphoreFillDefault (tstrWILC_SemaphoreAttrs *pstrAttrs) { pstrAttrs->u32InitCount =1 ; -#ifdef CONFIG_WILC_SEMAPHORE_TIMEOUT - pstrAttrs->u32TimeOut =WILC_OS_INFINITY ; -#endif }/*! * @brief Creates a new Semaphore object
drivers/staging/wilc1000/wilc_sleep.c +0 -18
@@ -1,8 +1,6 @@#include "wilc_oswrapper.h" -#ifdef CONFIG_WILC_SLEEP_FEATURE -/* * @author mdaftedar * @date 10 Aug 2010
@@ -12,25 +10,9 @@ void WILC_Sleep(WILC_Uint32 u32TimeMilliSec) {if (u32TimeMilliSec <=4000000 ) {WILC_Uint32 u32Temp = u32TimeMilliSec *1000 ; -#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,35 )usleep_range (u32Temp, u32Temp); -#else -udelay (u32Temp); -#endif }else {msleep (u32TimeMilliSec); } } -#endif - -/* #ifdef CONFIG_WILC_SLEEP_HI_RES */ -void WILC_SleepMicrosec (WILC_Uint32 u32TimeMicoSec) -{ -#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,35 ) -usleep_range (u32TimeMicoSec, u32TimeMicoSec); -#else -udelay (u32TimeMicoSec); -#endif -} -/* #endif */
drivers/staging/wilc1000/wilc_sleep.h +1 -29
@@ -2,19 +2,6 @@#define __WILC_SLEEP_H__/*! -* @file wilc_sleep.h -* @brief Sleep OS Wrapper functionality -* @author syounan -* @sa wilc_oswrapper.h top level OS wrapper file -* @date 10 Aug 2010 -* @version 1.0 -*/ - -#ifndef CONFIG_WILC_SLEEP_FEATURE -#error the feature WILC_OS_FEATURE_SLEEP must be supported to include this file -#endif - -/*! * @brief forces the current thread to sleep until the given time has elapsed * @param[in] u32TimeMilliSec Time to sleep in Milli seconds * @sa WILC_SleepMicrosec
@@ -24,22 +11,7 @@* @note This function offers a relatively innacurate and low resolution * sleep, for accurate high resolution sleep use u32TimeMicoSec */ +/* TODO: remove and open-code in callers */ void WILC_Sleep (WILC_Uint32 u32TimeMilliSec); -#ifdef CONFIG_WILC_SLEEP_HI_RES -/*! -* @brief forces the current thread to sleep until the given time has elapsed -* @param[in] u32TimeMicoSec Time to sleep in Micro seconds -* @sa WILC_Sleep -* @author syounan -* @date 10 Aug 2010 -* @version 1.0 -* @note This function offers an acurare high resolution sleep, depends on -* the feature WILC_OS_FEATURE_SLEEP_HI_RES and may not be supported -* on all Operating Systems -*/ -void WILC_SleepMicrosec (WILC_Uint32 u32TimeMicoSec); -#endif - -#endif
drivers/staging/wilc1000/wilc_strutils.c +0 -351
378 lines not on this page · raw message
drivers/staging/wilc1000/wilc_strutils.h +1 -283
318 lines not on this page · raw message
drivers/staging/wilc1000/wilc_thread.c deleted +0 -0
drivers/staging/wilc1000/wilc_thread.h deleted +0 -0
drivers/staging/wilc1000/wilc_time.c deleted +0 -0
drivers/staging/wilc1000/wilc_time.h deleted +0 -0
drivers/staging/wilc1000/wilc_timer.c +0 -6
@@ -1,10 +1,6 @@#include "wilc_oswrapper.h" -#ifdef CONFIG_WILC_TIMER_FEATURE - - -WILC_ErrNo WILC_TimerCreate (WILC_TimerHandle *pHandle,tpfWILC_TimerFunction pfCallback,tstrWILC_TimerAttrs *pstrAttrs) {
@@ -47,5 +43,3 @@ WILC_ErrNo WILC_TimerStop(WILC_TimerHandle *pHandle,return s32RetStatus; } - -#endif
drivers/staging/wilc1000/wilc_timer.h +0 -27
@@ -10,10 +10,6 @@* @version 1.0 */ -#ifndef CONFIG_WILC_TIMER_FEATURE -#error the feature CONFIG_WILC_TIMER_FEATURE must be supported to include this file -#endif -typedef void (*tpfWILC_TimerFunction )(void *);/*!
@@ -24,34 +20,11 @@ typedef void (*tpfWILC_TimerFunction)(void *);* @version 1.0 */ typedef struct { -/*!< if set to WILC_TRUE the callback function will be called -* periodically. */ -#ifdef CONFIG_WILC_TIMER_PERIODIC -WILC_Bool bPeriodicTimer; -#endif -/* a dummy member to avoid compiler errors*/ WILC_Uint8 dummy; }tstrWILC_TimerAttrs ;/*! -* @brief Fills the WILC_TimerAttrs with default parameters -* @param[out] pstrAttrs structure to be filled -* @sa WILC_TimerAttrs -* @author syounan -* @date 16 Aug 2010 -* @version 1.0 -*/ - -static void WILC_TimerFillDefault (tstrWILC_TimerAttrs *pstrAttrs) -{ -#ifdef CONFIG_WILC_TIMER_PERIODIC - pstrAttrs->bPeriodicTimer =WILC_FALSE ; -#endif -} - - -/*! * @brief Creates a new timer * @details Timers are a useful utility to execute some callback function * in the future.
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +3 -483
984 lines not on this page · raw message
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +1 -6
@@ -68,7 +68,6 @@#define nl80211_SCAN_RESULT_EXPIRE (3 * HZ)#define SCAN_RESULT_EXPIRE (40 * HZ) -#if LINUX_VERSION_CODE >KERNEL_VERSION (2 ,6 ,30 )static const u32 cipher_suites[] = {WLAN_CIPHER_SUITE_WEP40 ,WLAN_CIPHER_SUITE_WEP104 ,
@@ -76,11 +75,7 @@ static const u32 cipher_suites[] = {WLAN_CIPHER_SUITE_CCMP , WLAN_CIPHER_SUITE_AES_CMAC, }; -#endif - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)static const struct ieee80211_txrx_stypes wilc_wfi_cfg80211_mgmt_types[NL80211_IFTYPE_MAX ] = { [NL80211_IFTYPE_STATION ] = {
@@ -110,7 +105,7 @@ static const struct ieee80211_txrx_stypes BIT(IEEE80211_STYPE_DEAUTH >> 4) } }; -#endif +/* Time to stay on the channel */ #define WILC_WFI_DWELL_PASSIVE 100#define WILC_WFI_DWELL_ACTIVE 40
drivers/staging/wilc1000/wilc_wfi_netdevice.h +0 -8
@@ -49,12 +49,7 @@#include <asm/checksum.h> #include "host_interface.h" #include "wilc_wlan.h" -#if LINUX_VERSION_CODE <=KERNEL_VERSION (2 ,6 ,30 ) -#include <net/wireless.h> -#else #include <linux/wireless.h> /* tony, 2013-06-12 */ -#endif -#define FLOW_CONTROL_LOWER_THRESHOLD 128#define FLOW_CONTROL_UPPER_THRESHOLD 256
@@ -163,9 +158,6 @@ struct WILC_WFI_priv {tstrHostIFpmkidAttr pmkid_list;struct WILC_WFI_stats netstats;WILC_Uint8 WILC_WFI_wep_default; -#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,31 ) -#define WLAN_KEY_LEN_WEP104 13 -#endif WILC_Uint8 WILC_WFI_wep_key[4 ][WLAN_KEY_LEN_WEP104 ];WILC_Uint8 WILC_WFI_wep_key_len[4 ];struct net_device *real_ndev;/* The real interface that the monitor is on */
Greg KH
maintainerQuoted 9 lines · Arnd Bergmann
Subject: [PATCH] staging: wilc1000 dead code removal
After finding some build errors in wilc1000, I played some more with the driver and eliminated a lot of unused code. This is all code meant for OS abstraction. Since we know we are running Linux, and which version we use, it can all be removed.
Some minor changes are included that are necessary to remove other code.
That's a lot of things all in one patch, I can't really review this. Any chance you can break it out into logical pieces that I can review?
thanks,
greg k-h