Skip to contentSkip to conversation

wilc1000: dead code removal and other cleanup

PATCH In review Arnd Bergmann 3 participants 16 messages Jun 1, 2015 – Jun 2, 2015 Staging

lore
Share & tools
lore
#0 lore raw

v3 cover wilc1000: dead code removal and other cleanup

Hi Greg,

Next try, I've rebased on top of your staging-testing branch and fixed the two build errors.

While I had done my normal build testing on the driver (a few hundred randconfig builds), I don't normally do 'make clean', so the stale Makefile entry ended up picking the old object files and succeeding with that.

Arnd

Arnd Bergmann (12):
staging: wilc1000: remove time wrapper
staging: wilc1000: remove unused string functions
staging: wilc1000: simplify msgqueue code
staging: wilc1000: remove unused memory handling code
staging: wilc1000: simplify semaphore wrapper
staging: wilc1000: clean up sleep wrapper
staging: wilc1000: clean up timer feature
staging: wilc1000: remove unused OS abstraction features
staging: wilc1000: remove EXPORT_SYMTAB
staging: wilc1000: remove semaphore wrapper
staging: wilc1000: fix const cast warnings
staging: wilc1000: fix compiler warnings

 drivers/staging/wilc1000/Makefile                 |   6 +-
 drivers/staging/wilc1000/coreconfigurator.c       |  29 +-
 drivers/staging/wilc1000/fifo_buffer.c            | 108 +++----
 drivers/staging/wilc1000/fifo_buffer.h            |   2 +-
 drivers/staging/wilc1000/host_interface.c         | 203 ++++++-------
 drivers/staging/wilc1000/host_interface.h         |  40 +--
 drivers/staging/wilc1000/linux_mon.c              |   2 +-
 drivers/staging/wilc1000/linux_wlan.c             |   8 +-
 drivers/staging/wilc1000/linux_wlan_spi.c         |   3 -
 drivers/staging/wilc1000/wilc_errorsupport.h      |  17 --
 drivers/staging/wilc1000/wilc_event.h             | 123 --------
 drivers/staging/wilc1000/wilc_memory.c            |   7 +-
 drivers/staging/wilc1000/wilc_memory.h            |  95 +-----
 drivers/staging/wilc1000/wilc_msgqueue.c          |  41 +--
 drivers/staging/wilc1000/wilc_msgqueue.h          |  30 --
 drivers/staging/wilc1000/wilc_osconfig.h          |  28 --
 drivers/staging/wilc1000/wilc_oswrapper.h         |  42 ---
 drivers/staging/wilc1000/wilc_platform.h          | 117 +-------
 drivers/staging/wilc1000/wilc_semaphore.c         |  70 -----
 drivers/staging/wilc1000/wilc_semaphore.h         | 115 -------
 drivers/staging/wilc1000/wilc_sleep.c             |  10 -
 drivers/staging/wilc1000/wilc_sleep.h             |  30 +-
 drivers/staging/wilc1000/wilc_spi.c               |   4 +-
 drivers/staging/wilc1000/wilc_strutils.c          | 351 ----------------------
 drivers/staging/wilc1000/wilc_strutils.h          | 282 -----------------
 drivers/staging/wilc1000/wilc_time.c              | 163 ----------
 drivers/staging/wilc1000/wilc_time.h              | 205 -------------
 drivers/staging/wilc1000/wilc_timer.c             |   6 -
 drivers/staging/wilc1000/wilc_timer.h             |  27 --
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  47 +--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |   2 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |   4 +-
 drivers/staging/wilc1000/wilc_wlan.c              |   6 +-
 33 files changed, 213 insertions(+), 2010 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_event.h
 delete mode 100644 drivers/staging/wilc1000/wilc_semaphore.c
 delete mode 100644 drivers/staging/wilc1000/wilc_semaphore.h
 delete mode 100644 drivers/staging/wilc1000/wilc_time.c
 delete mode 100644 drivers/staging/wilc1000/wilc_time.h
Signature · 1 line
2.1.0.rc2
#1 lore raw

PATCH v2 1/12 staging: wilc1000: remove time wrapper

The abstraction for time in this driver is completely unused, so remove it.

---
 drivers/staging/wilc1000/Makefile         |   2 +-
 drivers/staging/wilc1000/wilc_osconfig.h  |   1 -
 drivers/staging/wilc1000/wilc_oswrapper.h |   5 -
 drivers/staging/wilc1000/wilc_platform.h  |  12 --
 drivers/staging/wilc1000/wilc_time.c      | 163 ------------------------
 drivers/staging/wilc1000/wilc_time.h      | 205 ------------------------------
 6 files changed, 1 insertion(+), 387 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_time.c
 delete mode 100644 drivers/staging/wilc1000/wilc_time.h
drivers/staging/wilc1000/Makefile +1 -1
index 13e3ed8ef31e..44551ee3c697 100644
@@ -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_time.o wilc_timer.o coreconfigurator.o host_interface.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
drivers/staging/wilc1000/wilc_osconfig.h +0 -1
index aa98ea5b423f..f3d3108de876 100644
@@ -27,7 +27,6 @@
 /* #define CONFIG_WILC_FILE_OPERATIONS_FEATURE */
 /* #define CONFIG_WILC_FILE_OPERATIONS_STRING_API */
 /* #define CONFIG_WILC_FILE_OPERATIONS_PATH_API */
-#define CONFIG_WILC_TIME_FEATURE
 /* #define CONFIG_WILC_EVENT_FEATURE */
 /* #define CONFIG_WILC_EVENT_TIMEOUT */
 /* #define CONFIG_WILC_SOCKET_FEATURE */
drivers/staging/wilc1000/wilc_oswrapper.h +0 -5
index 03a1ecf90625..728ce7cac85a 100644
@@ -89,11 +89,6 @@ typedef WILC_Uint16 WILC_WideChar;
 #include "wilc_fileops.h"
 #endif
 
-/* Time operations */
-#ifdef CONFIG_WILC_TIME_FEATURE
-#include "wilc_time.h"
-#endif
-
 /* Event support */
 #ifdef CONFIG_WILC_EVENT_FEATURE
 #include "wilc_event.h"
drivers/staging/wilc1000/wilc_platform.h +0 -12
index 87e4eedcc914..35d9f8a917ce 100644
@@ -73,18 +73,6 @@
 #error This feature is not supported by this OS
 #endif
 
-/* CONFIG_WILC_TIME_FEATURE is implemented */
-
-/* remove the following block when implementing its feature */
-#ifdef CONFIG_WILC_TIME_UTC_SINCE_1970
-#error This feature is not supported by this OS
-#endif
-
-/* remove the following block when implementing its feature */
-#ifdef CONFIG_WILC_TIME_CALENDER
-#error This feature is not supported by this OS
-#endif
-
 /* remove the following block when implementing its feature */
 #ifdef CONFIG_WILC_EVENT_FEATURE
 #error This feature is not supported by this OS
drivers/staging/wilc1000/wilc_time.c deleted +0 -163

163 lines not on this page · raw message

drivers/staging/wilc1000/wilc_time.h deleted +0 -205

205 lines not on this page · raw message

Signature · 1 line
2.1.0.rc2
#2 lore raw

PATCH v2 2/12 staging: wilc1000: remove unused string functions

In reply to Arnd Bergmann

The driver provides wrappers for a lot of string operations. Some of them are unused, while others should be replaced with normal kernel functions.

This replaces the unused ones for now, and leaves the other ones for a later cleanup.

---
 drivers/staging/wilc1000/wilc_osconfig.h  |   2 -
 drivers/staging/wilc1000/wilc_oswrapper.h |   2 -
 drivers/staging/wilc1000/wilc_platform.h  |   4 -
 drivers/staging/wilc1000/wilc_strutils.c  | 351 ------------------------------
 drivers/staging/wilc1000/wilc_strutils.h  | 282 ------------------------
 5 files changed, 641 deletions(-)
drivers/staging/wilc1000/wilc_osconfig.h +0 -2
index f3d3108de876..f18615e09400 100644
@@ -20,7 +20,6 @@
 /* #define CONFIG_WILC_MEMORY_POOLS 1 */
 /* #define CONFIG_WILC_MEMORY_DEBUG 1 */
 /* #define CONFIG_WILC_ASSERTION_SUPPORT 1 */
-#define CONFIG_WILC_STRING_UTILS 1
 #define CONFIG_WILC_MSG_QUEUE_FEATURE
 /* #define CONFIG_WILC_MSG_QUEUE_IPC_NAME */
 /* #define CONFIG_WILC_MSG_QUEUE_TIMEOUT */
@@ -32,5 +31,4 @@
 /* #define CONFIG_WILC_SOCKET_FEATURE */
 /* #define CONFIG_WILC_MATH_OPERATIONS_FEATURE */
 /* #define CONFIG_WILC_EXTENDED_FILE_OPERATIONS */
-/* #define CONFIG_WILC_EXTENDED_STRING_OPERATIONS */
 /* #define CONFIG_WILC_EXTENDED_TIME_OPERATIONS */
drivers/staging/wilc1000/wilc_oswrapper.h +0 -2
index 728ce7cac85a..c4e97ae03ae0 100644
@@ -75,9 +75,7 @@ typedef WILC_Uint16 WILC_WideChar;
 #endif
 
 /* String Utilities */
-#ifdef CONFIG_WILC_STRING_UTILS
 #include "wilc_strutils.h"
-#endif
 
 /* Message Queue */
 #ifdef CONFIG_WILC_MSG_QUEUE_FEATURE
drivers/staging/wilc1000/wilc_platform.h +0 -4
index 35d9f8a917ce..b20bbb839e5a 100644
@@ -50,8 +50,6 @@
 #error This feature is not supported by this OS
 #endif
 
-/* CONFIG_WILC_STRING_UTILS is implemented */
-
 /* CONFIG_WILC_MSG_QUEUE_FEATURE is implemented */
 
 /* remove the following block when implementing its feature */
@@ -87,8 +85,6 @@
 
 /* CONFIG_WILC_EXTENDED_FILE_OPERATIONS is implemented */
 
-/* CONFIG_WILC_EXTENDED_STRING_OPERATIONS is implemented */
-
 /* CONFIG_WILC_EXTENDED_TIME_OPERATIONS is implemented */
 
 /* remove the following block when implementing its feature */
drivers/staging/wilc1000/wilc_strutils.c +0 -351

378 lines not on this page · raw message

drivers/staging/wilc1000/wilc_strutils.h +0 -282

310 lines not on this page · raw message

Signature · 1 line
2.1.0.rc2
#3 lore raw

PATCH v2 3/12 staging: wilc1000: simplify msgqueue code

In reply to Arnd Bergmann

The driver contains an abstraction for message queues, with optional unused features, while the driver requires the main feature.

This makes the msgqueue code unconditional as it's required but removes the unused parts.

A later cleanup should remove the entire msgqueue code and replace it with some normal kernel API.

---
 drivers/staging/wilc1000/wilc_msgqueue.c  |  9 ---------
 drivers/staging/wilc1000/wilc_msgqueue.h  | 30 ------------------------------
 drivers/staging/wilc1000/wilc_osconfig.h  |  3 ---
 drivers/staging/wilc1000/wilc_oswrapper.h |  2 --
 drivers/staging/wilc1000/wilc_platform.h  | 12 ------------
 5 files changed, 56 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +0 -9
index c1d0dabed479..1113092398d1 100644
@@ -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
index a48be533aad9..84157368335d 100644
@@ -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 -3
index f18615e09400..d89864c7697c 100644
@@ -20,9 +20,6 @@
 /* #define CONFIG_WILC_MEMORY_POOLS 1 */
 /* #define CONFIG_WILC_MEMORY_DEBUG 1 */
 /* #define CONFIG_WILC_ASSERTION_SUPPORT 1 */
-#define CONFIG_WILC_MSG_QUEUE_FEATURE
-/* #define CONFIG_WILC_MSG_QUEUE_IPC_NAME */
-/* #define CONFIG_WILC_MSG_QUEUE_TIMEOUT */
 /* #define CONFIG_WILC_FILE_OPERATIONS_FEATURE */
 /* #define CONFIG_WILC_FILE_OPERATIONS_STRING_API */
 /* #define CONFIG_WILC_FILE_OPERATIONS_PATH_API */
drivers/staging/wilc1000/wilc_oswrapper.h +0 -2
index c4e97ae03ae0..8b4c3dced981 100644
@@ -78,9 +78,7 @@ typedef WILC_Uint16 WILC_WideChar;
 #include "wilc_strutils.h"
 
 /* Message Queue */
-#ifdef CONFIG_WILC_MSG_QUEUE_FEATURE
 #include "wilc_msgqueue.h"
-#endif
 
 /* File operations */
 #ifdef CONFIG_WILC_FILE_OPERATIONS_FEATURE
drivers/staging/wilc1000/wilc_platform.h +0 -12
index b20bbb839e5a..2f6484989565 100644
@@ -50,18 +50,6 @@
 #error This feature is not supported by this OS
 #endif
 
-/* CONFIG_WILC_MSG_QUEUE_FEATURE is implemented */
-
-/* remove the following block when implementing its feature */
-#ifdef CONFIG_WILC_MSG_QUEUE_IPC_NAME
-#error This feature is not supported by this OS
-#endif
-
-/* remove the following block when implementing its feature */
-/*#ifdef CONFIG_WILC_MSG_QUEUE_TIMEOUT
- * #error This feature is not supported by this OS
- #endif*/
-
 /* CONFIG_WILC_FILE_OPERATIONS_FEATURE is implemented */
 
 /* CONFIG_WILC_FILE_OPERATIONS_STRING_API is implemented */
Signature · 1 line
2.1.0.rc2
#4 lore raw

PATCH v2 4/12 staging: wilc1000: remove unused memory handling code

In reply to Arnd Bergmann

The driver contains its own abstraction for memory allocation, most of it unused. This removes the unused parts, but the rest should also be removed later.

---
 drivers/staging/wilc1000/wilc_memory.c    |  5 --
 drivers/staging/wilc1000/wilc_memory.h    | 93 -------------------------------
 drivers/staging/wilc1000/wilc_osconfig.h  |  3 -
 drivers/staging/wilc1000/wilc_oswrapper.h |  2 -
 drivers/staging/wilc1000/wilc_platform.h  | 13 -----
 5 files changed, 116 deletions(-)
drivers/staging/wilc1000/wilc_memory.c +0 -5
index cf0976b443b8..fbba38da19bc 100644
@@ -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_osconfig.h +0 -3
index d89864c7697c..eec93b351f14 100644
@@ -16,9 +16,6 @@
 #define CONFIG_WILC_SLEEP_HI_RES 1
 #define CONFIG_WILC_TIMER_FEATURE 1
 /* #define CONFIG_WILC_TIMER_PERIODIC 1 */
-#define CONFIG_WILC_MEMORY_FEATURE 1
-/* #define CONFIG_WILC_MEMORY_POOLS 1 */
-/* #define CONFIG_WILC_MEMORY_DEBUG 1 */
 /* #define CONFIG_WILC_ASSERTION_SUPPORT 1 */
 /* #define CONFIG_WILC_FILE_OPERATIONS_FEATURE */
 /* #define CONFIG_WILC_FILE_OPERATIONS_STRING_API */
drivers/staging/wilc1000/wilc_oswrapper.h +0 -2
index 8b4c3dced981..fd5dd3c6316e 100644
@@ -70,9 +70,7 @@ typedef WILC_Uint16 WILC_WideChar;
 #endif
 
 /* Memory support */
-#ifdef CONFIG_WILC_MEMORY_FEATURE
 #include "wilc_memory.h"
-#endif
 
 /* String Utilities */
 #include "wilc_strutils.h"
drivers/staging/wilc1000/wilc_platform.h +0 -13
index 2f6484989565..36e2e707354b 100644
@@ -33,18 +33,6 @@
 
 /* CONFIG_WILC_TIMER_PERIODIC is implemented */
 
-/* CONFIG_WILC_MEMORY_FEATURE is implemented */
-
-/* remove the following block when implementing its feature */
-#ifdef CONFIG_WILC_MEMORY_POOLS
-#error This feature is not supported by this OS
-#endif
-
-/* remove the following block when implementing its feature */
-#ifdef CONFIG_WILC_MEMORY_DEBUG
-#error This feature is not supported by this OS
-#endif
-
 /* remove the following block when implementing its feature */
 #ifdef CONFIG_WILC_ASSERTION_SUPPORT
 #error This feature is not supported by this OS
@@ -100,7 +88,6 @@
  *      OS specific types
  *******************************************************************/
 
-typedef void *WILC_MemoryPoolHandle;
 typedef struct semaphore WILC_SemaphoreHandle;
 
 typedef struct timer_list WILC_TimerHandle;
Signature · 1 line
2.1.0.rc2
#5 lore raw

PATCH v2 5/12 staging: wilc1000: simplify semaphore wrapper

In reply to Arnd Bergmann

The driver has its own API for semaphores. This should be replaced with mutexes and completions, but for the moment we can start by removing the obviously unused parts.

---
 drivers/staging/wilc1000/wilc_osconfig.h  |  1 -
 drivers/staging/wilc1000/wilc_oswrapper.h |  2 --
 drivers/staging/wilc1000/wilc_semaphore.c | 14 --------------
 drivers/staging/wilc1000/wilc_semaphore.h | 18 +-----------------
 4 files changed, 1 insertion(+), 34 deletions(-)
drivers/staging/wilc1000/wilc_osconfig.h +0 -1
index eec93b351f14..d0bf08f89906 100644
@@ -10,7 +10,6 @@
 
 /* OS features supported */
 
-#define CONFIG_WILC_SEMAPHORE_FEATURE 1
 /* #define CONFIG_WILC_SEMAPHORE_TIMEOUT 1 */
 #define CONFIG_WILC_SLEEP_FEATURE 1
 #define CONFIG_WILC_SLEEP_HI_RES 1
drivers/staging/wilc1000/wilc_oswrapper.h +0 -2
index fd5dd3c6316e..32fe48a6034b 100644
@@ -55,9 +55,7 @@ typedef WILC_Uint16 WILC_WideChar;
 #include "wilc_errorsupport.h"
 
 /* Semaphore support */
-#ifdef CONFIG_WILC_SEMAPHORE_FEATURE
 #include "wilc_semaphore.h"
-#endif
 
 /* Sleep support */
 #ifdef CONFIG_WILC_SLEEP_FEATURE
drivers/staging/wilc1000/wilc_semaphore.c +0 -14
index 637107bfb877..f09a88ca6ae4 100644
@@ -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
index 3006f9f20c4d..3c0ecc326fb3 100644
@@ -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
Signature · 1 line
2.1.0.rc2
#6 lore raw

PATCH v2 6/12 staging: wilc1000: clean up sleep wrapper

In reply to Arnd Bergmann

The driver has a simple wrapper around msleep, as well as a more advanced sleep function that is unused. This removes the unused code and the options to turn the feature on or off.

A follow-up should rework the code to use msleep directly.

---
 drivers/staging/wilc1000/wilc_osconfig.h  |  2 --
 drivers/staging/wilc1000/wilc_oswrapper.h |  2 --
 drivers/staging/wilc1000/wilc_platform.h  |  6 ------
 drivers/staging/wilc1000/wilc_sleep.c     | 10 ----------
 drivers/staging/wilc1000/wilc_sleep.h     | 30 +-----------------------------
 5 files changed, 1 insertion(+), 49 deletions(-)
drivers/staging/wilc1000/wilc_osconfig.h +0 -2
index d0bf08f89906..6da42c837928 100644
@@ -11,8 +11,6 @@
 /* OS features supported */
 
 /* #define CONFIG_WILC_SEMAPHORE_TIMEOUT 1 */
-#define CONFIG_WILC_SLEEP_FEATURE 1
-#define CONFIG_WILC_SLEEP_HI_RES 1
 #define CONFIG_WILC_TIMER_FEATURE 1
 /* #define CONFIG_WILC_TIMER_PERIODIC 1 */
 /* #define CONFIG_WILC_ASSERTION_SUPPORT 1 */
drivers/staging/wilc1000/wilc_oswrapper.h +0 -2
index 32fe48a6034b..2af32fff84aa 100644
@@ -58,9 +58,7 @@ typedef WILC_Uint16 WILC_WideChar;
 #include "wilc_semaphore.h"
 
 /* Sleep support */
-#ifdef CONFIG_WILC_SLEEP_FEATURE
 #include "wilc_sleep.h"
-#endif
 
 /* Timer support */
 #ifdef CONFIG_WILC_TIMER_FEATURE
drivers/staging/wilc1000/wilc_platform.h +0 -6
index 36e2e707354b..2c66c3f3a2c5 100644
@@ -22,12 +22,6 @@
  * #error This feature is not supported by this OS
  #endif*/
 
-/* CONFIG_WILC_SLEEP_FEATURE is implemented */
-
-/* remove the following block when implementing its feature */
-/* #ifdef CONFIG_WILC_SLEEP_HI_RES */
-/* #error This feature is not supported by this OS */
-/* #endif */
 
 /* CONFIG_WILC_TIMER_FEATURE is implemented */
 
drivers/staging/wilc1000/wilc_sleep.c +0 -10
index b8f45146956b..98a079f3d6c9 100644
@@ -1,8 +1,6 @@
 
 #include "wilc_oswrapper.h"
 
-#ifdef CONFIG_WILC_SLEEP_FEATURE
-
 /*
  *  @author	mdaftedar
  *  @date	10 Aug 2010
@@ -18,11 +16,3 @@ void WILC_Sleep(WILC_Uint32 u32TimeMilliSec)
 	}
 
 }
-#endif
-
-/* #ifdef CONFIG_WILC_SLEEP_HI_RES */
-void WILC_SleepMicrosec(WILC_Uint32 u32TimeMicoSec)
-{
-	usleep_range(u32TimeMicoSec, u32TimeMicoSec);
-}
-/* #endif */
drivers/staging/wilc1000/wilc_sleep.h +1 -29
index d640fb553aca..2865c8e44346 100644
@@ -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
Signature · 1 line
2.1.0.rc2
#7 lore raw

PATCH v2 7/12 staging: wilc1000: clean up timer feature

In reply to Arnd Bergmann

The driver has a simple wrapper around timer_list, and an optional but unused feature to make the timer periodic.

This removes support for the periodic timer and simplifies the code around timers.

A follow-up should replace the remaining wrapper with open-coded timers.

---
 drivers/staging/wilc1000/wilc_osconfig.h  |  2 --
 drivers/staging/wilc1000/wilc_oswrapper.h |  2 --
 drivers/staging/wilc1000/wilc_platform.h  |  4 ----
 drivers/staging/wilc1000/wilc_timer.c     |  6 ------
 drivers/staging/wilc1000/wilc_timer.h     | 27 ---------------------------
 5 files changed, 41 deletions(-)
drivers/staging/wilc1000/wilc_osconfig.h +0 -2
index 6da42c837928..639160d1fa4e 100644
@@ -11,8 +11,6 @@
 /* OS features supported */
 
 /* #define CONFIG_WILC_SEMAPHORE_TIMEOUT 1 */
-#define CONFIG_WILC_TIMER_FEATURE 1
-/* #define CONFIG_WILC_TIMER_PERIODIC 1 */
 /* #define CONFIG_WILC_ASSERTION_SUPPORT 1 */
 /* #define CONFIG_WILC_FILE_OPERATIONS_FEATURE */
 /* #define CONFIG_WILC_FILE_OPERATIONS_STRING_API */
drivers/staging/wilc1000/wilc_oswrapper.h +0 -2
index 2af32fff84aa..be6393cba8c2 100644
@@ -61,9 +61,7 @@ typedef WILC_Uint16 WILC_WideChar;
 #include "wilc_sleep.h"
 
 /* Timer support */
-#ifdef CONFIG_WILC_TIMER_FEATURE
 #include "wilc_timer.h"
-#endif
 
 /* Memory support */
 #include "wilc_memory.h"
drivers/staging/wilc1000/wilc_platform.h +0 -4
index 2c66c3f3a2c5..d3f8fc6f2971 100644
@@ -23,10 +23,6 @@
  #endif*/
 
 
-/* CONFIG_WILC_TIMER_FEATURE is implemented */
-
-/* CONFIG_WILC_TIMER_PERIODIC is implemented */
-
 /* remove the following block when implementing its feature */
 #ifdef CONFIG_WILC_ASSERTION_SUPPORT
 #error This feature is not supported by this OS
drivers/staging/wilc1000/wilc_timer.c +0 -6
index 477986dcff0a..7d2e6f19c00b 100644
@@ -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
index 1080ce24a045..41c6784ab8e1 100644
@@ -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.
Signature · 1 line
2.1.0.rc2
#8 lore raw

PATCH v2 8/12 staging: wilc1000: remove unused OS abstraction features

In reply to Arnd Bergmann

All the remaining features from the OS abstraction layer are not used at all in the driver, so we can just remove the remaining references to them.

---
 drivers/staging/wilc1000/wilc_errorsupport.h |  17 ----
 drivers/staging/wilc1000/wilc_event.h        | 123 ---------------------------
 drivers/staging/wilc1000/wilc_osconfig.h     |  14 ---
 drivers/staging/wilc1000/wilc_oswrapper.h    |  22 -----
 drivers/staging/wilc1000/wilc_platform.h     |  62 --------------
 5 files changed, 238 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_event.h
drivers/staging/wilc1000/wilc_errorsupport.h +0 -17
index 6405ef8ad431..4da657d17020 100644
@@ -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 -123

124 lines not on this page · raw message

drivers/staging/wilc1000/wilc_osconfig.h +0 -14
index 639160d1fa4e..f9c25140393e 100644
@@ -7,17 +7,3 @@
 #define WILC_LOGS_ALL              5
 
 #define WILC_LOG_VERBOSITY_LEVEL WILC_LOGS_ALL
-
-/* OS features supported */
-
-/* #define CONFIG_WILC_SEMAPHORE_TIMEOUT 1 */
-/* #define CONFIG_WILC_ASSERTION_SUPPORT 1 */
-/* #define CONFIG_WILC_FILE_OPERATIONS_FEATURE */
-/* #define CONFIG_WILC_FILE_OPERATIONS_STRING_API */
-/* #define CONFIG_WILC_FILE_OPERATIONS_PATH_API */
-/* #define CONFIG_WILC_EVENT_FEATURE */
-/* #define CONFIG_WILC_EVENT_TIMEOUT */
-/* #define CONFIG_WILC_SOCKET_FEATURE */
-/* #define CONFIG_WILC_MATH_OPERATIONS_FEATURE */
-/* #define CONFIG_WILC_EXTENDED_FILE_OPERATIONS */
-/* #define CONFIG_WILC_EXTENDED_TIME_OPERATIONS */
drivers/staging/wilc1000/wilc_oswrapper.h +0 -22
index be6393cba8c2..1999970635aa 100644
@@ -72,26 +72,4 @@ typedef WILC_Uint16 WILC_WideChar;
 /* Message Queue */
 #include "wilc_msgqueue.h"
 
-/* File operations */
-#ifdef CONFIG_WILC_FILE_OPERATIONS_FEATURE
-#include "wilc_fileops.h"
-#endif
-
-/* Event support */
-#ifdef CONFIG_WILC_EVENT_FEATURE
-#include "wilc_event.h"
-#endif
-
-/* Socket operations */
-#ifdef CONFIG_WILC_SOCKET_FEATURE
-#include "wilc_socket.h"
-#endif
-
-/* Math operations */
-#ifdef CONFIG_WILC_MATH_OPERATIONS_FEATURE
-#include "wilc_math.h"
-#endif
-
-
-
 #endif
drivers/staging/wilc1000/wilc_platform.h +0 -62

68 lines not on this page · raw message

Signature · 1 line
2.1.0.rc2
#9 lore raw

PATCH v2 9/12 staging: wilc1000: remove EXPORT_SYMTAB

In reply to Arnd Bergmann

The EXPORT_SYMTAB symbol has not been used in Linux for a very long time, the driver does not need to set it.

---
 drivers/staging/wilc1000/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/Makefile +1 -1
index 44551ee3c697..d8d8395cc4a6 100644
@@ -10,7 +10,7 @@ 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 \
 		-Wno-unused-function -DUSE_WIRELESS -DWILC_DEBUGFS
Signature · 1 line
2.1.0.rc2
#10 lore raw

PATCH v2 10/12 staging: wilc1000: remove semaphore wrapper

In reply to Arnd Bergmann

The various semaphore functions all directly translate into sema_init(), down() and up(), so we can just remove the API.

This is a mostly automated conversion using simple sed scripts, plus some manual changes to account for down() returning no error.

As a positive side-effect, down() no longer hangs after receiving a signal, as the original code did by looping around down_interruptible.

The semaphores still need to be turned into mutexes as a follow-up step.

---
 drivers/staging/wilc1000/Makefile                 |   2 +-
 drivers/staging/wilc1000/coreconfigurator.c       |  29 +---
 drivers/staging/wilc1000/fifo_buffer.c            | 108 +++++++-------
 drivers/staging/wilc1000/fifo_buffer.h            |   2 +-
 drivers/staging/wilc1000/host_interface.c         | 171 +++++++++-------------
 drivers/staging/wilc1000/host_interface.h         |  16 +-
 drivers/staging/wilc1000/wilc_msgqueue.c          |  32 ++--
 drivers/staging/wilc1000/wilc_oswrapper.h         |   3 -
 drivers/staging/wilc1000/wilc_platform.h          |   4 +-
 drivers/staging/wilc1000/wilc_semaphore.c         |  56 -------
 drivers/staging/wilc1000/wilc_semaphore.h         |  99 -------------
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  35 ++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h     |   4 +-
 13 files changed, 161 insertions(+), 400 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/wilc_semaphore.c
 delete mode 100644 drivers/staging/wilc1000/wilc_semaphore.h
drivers/staging/wilc1000/Makefile +1 -1
index d8d8395cc4a6..a78c4d529a58 100644
@@ -26,7 +26,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_memory.o wilc_msgqueue.o wilc_sleep.o wilc_strutils.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
 
drivers/staging/wilc1000/coreconfigurator.c +8 -21
index d5a076ed2426..bf444825711f 100644
@@ -164,8 +164,8 @@ extern void host_int_ScanCompleteReceived(WILC_Uint8 *pu8Buffer, WILC_Uint32 u32
 /*****************************************************************************/
 /* Global Variables                                                          */
 /*****************************************************************************/
-static WILC_SemaphoreHandle SemHandleSendPkt;
-static WILC_SemaphoreHandle SemHandlePktResp;
+static struct semaphore SemHandleSendPkt;
+static struct semaphore SemHandlePktResp;
 
 static WILC_Sint8 *gps8ConfigPacket;
 
@@ -672,18 +672,10 @@ INLINE WILC_Uint16 get_asoc_id(WILC_Uint8 *data)
 WILC_Sint32 CoreConfiguratorInit(void)
 {
 	WILC_Sint32 s32Error = WILC_SUCCESS;
-	tstrWILC_SemaphoreAttrs strSemSendPktAttrs;
-	tstrWILC_SemaphoreAttrs strSemPktRespAttrs;
-
 	PRINT_D(CORECONFIG_DBG, "CoreConfiguratorInit() \n");
 
-	WILC_SemaphoreFillDefault(&strSemSendPktAttrs);
-	strSemSendPktAttrs.u32InitCount = 1;
-	WILC_SemaphoreCreate(&SemHandleSendPkt, &strSemSendPktAttrs);
-
-	WILC_SemaphoreFillDefault(&strSemPktRespAttrs);
-	strSemPktRespAttrs.u32InitCount = 0;
-	WILC_SemaphoreCreate(&SemHandlePktResp, &strSemPktRespAttrs);
+	sema_init(&SemHandleSendPkt, 1);
+	sema_init(&SemHandlePktResp, 0);
 
 	gps8ConfigPacket = (WILC_Sint8 *)WILC_MALLOC(MAX_PACKET_BUFF_SIZE);
 	if (gps8ConfigPacket == NULL) {
@@ -1931,7 +1923,7 @@ WILC_Sint32 ConfigWaitResponse(WILC_Char *pcRespBuffer, WILC_Sint32 s32MaxRespBu
 
 
 	if (gstrConfigPktInfo.bRespRequired == WILC_TRUE) {
-		WILC_SemaphoreAcquire(&SemHandlePktResp, WILC_NULL);
+		down(&SemHandlePktResp);
 
 		*ps32BytesRead = gstrConfigPktInfo.s32BytesRead;
 	}
@@ -1964,7 +1956,7 @@ WILC_Sint32 SendConfigPkt(WILC_Uint8 u8Mode, tstrWID *pstrWIDs,
 	WILC_Sint32 s32ConfigPacketLen = 0;
 	WILC_Sint32 s32RcvdRespLen = 0;
 
-	WILC_SemaphoreAcquire(&SemHandleSendPkt, WILC_NULL);
+	down(&SemHandleSendPkt);
 
 	/*set the packet mode*/
 	g_oper_mode = u8Mode;
@@ -2019,7 +2011,7 @@ WILC_Sint32 SendConfigPkt(WILC_Uint8 u8Mode, tstrWID *pstrWIDs,
 
 
 End_ConfigPkt:
-	WILC_SemaphoreRelease(&SemHandleSendPkt, WILC_NULL);
+	up(&SemHandleSendPkt);
 
 	return s32Error;
 }
@@ -2038,7 +2030,7 @@ WILC_Sint32 ConfigProvideResponse(WILC_Char *pcRespBuffer, WILC_Sint32 s32RespLe
 			PRINT_ER("BusProvideResponse() Response greater than the prepared Buffer Size \n");
 		}
 
-		WILC_SemaphoreRelease(&SemHandlePktResp, WILC_NULL);
+		up(&SemHandlePktResp);
 	}
 
 	return s32Error;
@@ -2107,11 +2099,6 @@ WILC_Sint32 CoreConfiguratorDeInit(void)
 
 	PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit() \n");
 
-
-	WILC_SemaphoreDestroy(&SemHandleSendPkt, WILC_NULL);
-	WILC_SemaphoreDestroy(&SemHandlePktResp, WILC_NULL);
-
-
 	if (gps8ConfigPacket != NULL) {
 
 		WILC_FREE(gps8ConfigPacket);
drivers/staging/wilc1000/fifo_buffer.c +50 -58

144 lines not on this page · raw message

drivers/staging/wilc1000/fifo_buffer.h +1 -1
index 0700e7929c00..c7e140be8fab 100644
@@ -10,7 +10,7 @@ typedef struct {
 	WILC_Uint32 u32WriteOffset;
 	WILC_Uint32 u32ReadOffset;
 	WILC_Uint32 u32TotalBytes;
-	WILC_SemaphoreHandle SemBuffer;
+	struct semaphore SemBuffer;
 } tstrFifoHandler;
 
 
drivers/staging/wilc1000/host_interface.c +70 -101

516 lines not on this page · raw message

drivers/staging/wilc1000/host_interface.h +8 -8
index f2a348506a8b..9c06db12b7ea 100644
@@ -422,14 +422,14 @@ typedef struct {
 	WILC_Uint8 au8AssociatedBSSID[ETH_ALEN];
 	tstrCfgParamVal strCfgValues;
 /* semaphores */
-	WILC_SemaphoreHandle gtOsCfgValuesSem;
-	WILC_SemaphoreHandle hSemTestKeyBlock;
-
-	WILC_SemaphoreHandle hSemTestDisconnectBlock;
-	WILC_SemaphoreHandle hSemGetRSSI;
-	WILC_SemaphoreHandle hSemGetLINKSPEED;
-	WILC_SemaphoreHandle hSemGetCHNL;
-	WILC_SemaphoreHandle hSemInactiveTime;
+	struct semaphore gtOsCfgValuesSem;
+	struct semaphore hSemTestKeyBlock;
+
+	struct semaphore hSemTestDisconnectBlock;
+	struct semaphore hSemGetRSSI;
+	struct semaphore hSemGetLINKSPEED;
+	struct semaphore hSemGetCHNL;
+	struct semaphore hSemInactiveTime;
 /* timer handlers */
 	WILC_TimerHandle hScanTimer;
 	WILC_TimerHandle hConnectTimer;
drivers/staging/wilc1000/wilc_msgqueue.c +10 -22
index 1113092398d1..ebbba8b24de0 100644
@@ -11,21 +11,12 @@
 WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle,
 			       tstrWILC_MsgQueueAttrs *pstrAttrs)
 {
-	tstrWILC_SemaphoreAttrs strSemAttrs;
-	WILC_SemaphoreFillDefault(&strSemAttrs);
-	strSemAttrs.u32InitCount = 0;
-
 	spin_lock_init(&pHandle->strCriticalSection);
-	if ((WILC_SemaphoreCreate(&pHandle->hSem, &strSemAttrs) == WILC_SUCCESS)) {
-
-		pHandle->pstrMessageList = NULL;
-		pHandle->u32ReceiversCount = 0;
-		pHandle->bExiting = WILC_FALSE;
-
-		return WILC_SUCCESS;
-	} else {
-		return WILC_FAIL;
-	}
+	sema_init(&pHandle->hSem, 0);
+	pHandle->pstrMessageList = NULL;
+	pHandle->u32ReceiversCount = 0;
+	pHandle->bExiting = WILC_FALSE;
+	return WILC_SUCCESS;
 }
 
 /*!
@@ -42,12 +33,10 @@ WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle,
 
 	/* Release any waiting receiver thread. */
 	while (pHandle->u32ReceiversCount > 0) {
-		WILC_SemaphoreRelease(&(pHandle->hSem), WILC_NULL);
+		up(&(pHandle->hSem));
 		pHandle->u32ReceiversCount--;
 	}
 
-	WILC_SemaphoreDestroy(&pHandle->hSem, WILC_NULL);
-
 	while (pHandle->pstrMessageList != NULL) {
 		Message *pstrMessge = pHandle->pstrMessageList->pstrNext;
 		WILC_FREE(pHandle->pstrMessageList);
@@ -104,7 +93,7 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
 
 	spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
 
-	WILC_SemaphoreRelease(&pHandle->hSem, WILC_NULL);
+	up(&pHandle->hSem);
 
 	WILC_CATCH(s32RetStatus)
 	{
@@ -136,7 +125,6 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
 
 	Message *pstrMessage;
 	WILC_ErrNo s32RetStatus = WILC_SUCCESS;
-	tstrWILC_SemaphoreAttrs strSemAttrs;
 	unsigned long flags;
 	if ((pHandle == NULL) || (u32RecvBufferSize == 0)
 	    || (pvRecvBuffer == NULL) || (pu32ReceivedLength == NULL)) {
@@ -151,8 +139,8 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
 	pHandle->u32ReceiversCount++;
 	spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
 
-	WILC_SemaphoreFillDefault(&strSemAttrs);
-	s32RetStatus = WILC_SemaphoreAcquire(&(pHandle->hSem), &strSemAttrs);
+	down(&(pHandle->hSem));
+
 	if (s32RetStatus == WILC_TIMEOUT) {
 		/* timed out, just exit without consumeing the message */
 		spin_lock_irqsave(&pHandle->strCriticalSection, flags);
@@ -176,7 +164,7 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
 		/* check buffer size */
 		if (u32RecvBufferSize < pstrMessage->u32Length)	{
 			spin_unlock_irqrestore(&pHandle->strCriticalSection, flags);
-			WILC_SemaphoreRelease(&pHandle->hSem, WILC_NULL);
+			up(&pHandle->hSem);
 			WILC_ERRORREPORT(s32RetStatus, WILC_BUFFER_OVERFLOW);
 		}
 
drivers/staging/wilc1000/wilc_oswrapper.h +0 -3
index 1999970635aa..7375ec44cc42 100644
@@ -54,9 +54,6 @@ typedef WILC_Uint16 WILC_WideChar;
 /* Error reporting and handling support */
 #include "wilc_errorsupport.h"
 
-/* Semaphore support */
-#include "wilc_semaphore.h"
-
 /* Sleep support */
 #include "wilc_sleep.h"
 
drivers/staging/wilc1000/wilc_platform.h +1 -3
index 2e0f41735df0..ae42bbcbd5eb 100644
@@ -16,8 +16,6 @@
  *      OS specific types
  *******************************************************************/
 
-typedef struct semaphore WILC_SemaphoreHandle;
-
 typedef struct timer_list WILC_TimerHandle;
 
 
@@ -30,7 +28,7 @@ typedef struct __Message_struct {
 } Message;
 
 typedef struct __MessageQueue_struct {
-	WILC_SemaphoreHandle hSem;
+	struct semaphore hSem;
 	spinlock_t strCriticalSection;
 	WILC_Bool bExiting;
 	WILC_Uint32 u32ReceiversCount;
drivers/staging/wilc1000/wilc_semaphore.c deleted +0 -56

56 lines not on this page · raw message

drivers/staging/wilc1000/wilc_semaphore.h deleted +0 -99

99 lines not on this page · raw message

drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +10 -25
index c1d511825147..d8ca75cf73f6 100644
@@ -462,7 +462,7 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo
 				PRINT_D(CFG80211_DBG, "No networks found \n");
 			}
 
-			WILC_SemaphoreAcquire(&(priv->hSemScanReq), NULL);
+			down(&(priv->hSemScanReq));
 
 			if (priv->pstrScanReq != WILC_NULL) {
 				cfg80211_scan_done(priv->pstrScanReq, WILC_FALSE);
@@ -470,12 +470,12 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo
 				priv->bCfgScanning = WILC_FALSE;
 				priv->pstrScanReq = WILC_NULL;
 			}
-			WILC_SemaphoreRelease(&(priv->hSemScanReq), NULL);
+			up(&(priv->hSemScanReq));
 
 		}
 		/*Aborting any scan operation during mac close*/
 		else if (enuScanEvent == SCAN_EVENT_ABORTED) {
-			WILC_SemaphoreAcquire(&(priv->hSemScanReq), NULL);
+			down(&(priv->hSemScanReq));
 
 			PRINT_D(CFG80211_DBG, "Scan Aborted \n");
 			if (priv->pstrScanReq != WILC_NULL) {
@@ -487,7 +487,7 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo
 				priv->bCfgScanning = WILC_FALSE;
 				priv->pstrScanReq = WILC_NULL;
 			}
-			WILC_SemaphoreRelease(&(priv->hSemScanReq), NULL);
+			up(&(priv->hSemScanReq));
 		}
 	}
 
@@ -2839,13 +2839,13 @@ static int WILC_WFI_dump_station(struct wiphy *wiphy, struct net_device *dev,
 		STATION_INFO_RX_BYTES |
 		STATION_INFO_RX_PACKETS | STATION_INFO_SIGNAL | STATION_INFO_INACTIVE_TIME;
 
-	WILC_SemaphoreAcquire(&SemHandleUpdateStats, NULL);
+	down(&SemHandleUpdateStats);
 	sinfo->inactive_time = priv->netstats.rx_time > priv->netstats.tx_time ? jiffies_to_msecs(jiffies - priv->netstats.tx_time) : jiffies_to_msecs(jiffies - priv->netstats.rx_time);
 	sinfo->rx_bytes = priv->netstats.rx_bytes;
 	sinfo->tx_bytes = priv->netstats.tx_bytes;
 	sinfo->rx_packets = priv->netstats.rx_packets;
 	sinfo->tx_packets = priv->netstats.tx_packets;
-	WILC_SemaphoreRelease(&SemHandleUpdateStats, NULL);
+	up(&SemHandleUpdateStats);
 #endif
 	return 0;
 
@@ -3767,7 +3767,7 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
 	struct WILC_WFI_priv *priv;
 
 	priv = wiphy_priv(wiphy);
-	/* WILC_SemaphoreAcquire(&SemHandleUpdateStats,NULL); */
+	/* down(&SemHandleUpdateStats); */
 #if 1
 	switch (changed) {
 
@@ -3792,7 +3792,7 @@ int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
 	default:
 		break;
 	}
-	/* WILC_SemaphoreRelease(&SemHandleUpdateStats,NULL); */
+	/* down(&SemHandleUpdateStats); */
 #endif
 	return 0;
 }
@@ -3898,7 +3898,7 @@ struct wireless_dev *WILC_WFI_WiphyRegister(struct net_device *net)
 
 	/*Return hardware description structure (wiphy)'s priv*/
 	priv = wdev_priv(wdev);
-	WILC_SemaphoreCreate(&(priv->SemHandleUpdateStats), NULL);
+	sema_init(&(priv->SemHandleUpdateStats), 1);
 
 	/*Link the wiphy with wireless structure*/
 	priv->wdev = wdev;
@@ -3991,8 +3991,6 @@ int WILC_WFI_InitHostInt(struct net_device *net)
 
 	struct WILC_WFI_priv *priv;
 
-	tstrWILC_SemaphoreAttrs strSemaphoreAttrs;
-
 	PRINT_D(INIT_DBG, "Host[%p][%p]\n", net, net->ieee80211_ptr);
 	priv = wdev_priv(net->ieee80211_ptr);
 	if (op_ifcs == 0) {
@@ -4007,17 +4005,11 @@ int WILC_WFI_InitHostInt(struct net_device *net)
 		return s32Error;
 	}
 
-	WILC_SemaphoreFillDefault(&strSemaphoreAttrs);
-
-	/* /////////////////////////////////////// */
-	/* strSemaphoreAttrs.u32InitCount = 0; */
-
-
 	priv->gbAutoRateAdjusted = WILC_FALSE;
 
 	priv->bInP2PlistenState = WILC_FALSE;
 
-	WILC_SemaphoreCreate(&(priv->hSemScanReq), &strSemaphoreAttrs);
+	sema_init(&(priv->hSemScanReq), 1);
 	s32Error = host_int_init(&priv->hWILCWFIDrv);
 	/* s32Error = host_int_init(&priv->hWILCWFIDrv_2); */
 	if (s32Error) {
@@ -4042,13 +4034,6 @@ int WILC_WFI_DeInitHostInt(struct net_device *net)
 	struct WILC_WFI_priv *priv;
 	priv = wdev_priv(net->ieee80211_ptr);
 
-
-
-
-
-
-	WILC_SemaphoreDestroy(&(priv->hSemScanReq), NULL);
-
 	priv->gbAutoRateAdjusted = WILC_FALSE;
 
 	priv->bInP2PlistenState = WILC_FALSE;
drivers/staging/wilc1000/wilc_wfi_netdevice.h +2 -2
index 0abe653acc66..0fc383b272aa 100644
@@ -165,8 +165,8 @@ struct WILC_WFI_priv {
 	struct wilc_wfi_key *wilc_ptk[MAX_NUM_STA];
 	WILC_Uint8 wilc_groupkey;
 	/* semaphores */
-	WILC_SemaphoreHandle SemHandleUpdateStats;
-	WILC_SemaphoreHandle hSemScanReq;
+	struct semaphore SemHandleUpdateStats;
+	struct semaphore hSemScanReq;
 	/*  */
 	WILC_Bool gbAutoRateAdjusted;
 
Signature · 1 line
2.1.0.rc2
#11 lore raw

PATCH v2 11/12 staging: wilc1000: fix const cast warnings

In reply to Arnd Bergmann

The wilc1000 driver produces a lot of warnings about invalid casts between const and non-const variables. This reworks the code to avoid all those warnings, by marking variables and function arguments const.

A lot of the types use WILC_Uint8, I change them to const u8 for style reasons, as I'm touching them anyway.

---
 drivers/staging/wilc1000/host_interface.c         | 32 ++++++++++++-----------
 drivers/staging/wilc1000/host_interface.h         | 24 ++++++++---------
 drivers/staging/wilc1000/linux_mon.c              |  2 +-
 drivers/staging/wilc1000/wilc_memory.c            |  2 +-
 drivers/staging/wilc1000/wilc_memory.h            |  2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 12 ++++-----
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  2 +-
 7 files changed, 39 insertions(+), 37 deletions(-)
drivers/staging/wilc1000/host_interface.c +17 -15
index 8f7adc760500..6d9bd4983e90 100644
@@ -4912,8 +4912,8 @@ WILC_Sint32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const WILC_Ui
  *  @date		8 March 2012
  *  @version		1.0
  */
-WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8Ptk, WILC_Uint8 u8PtkKeylen,
-			     const WILC_Uint8 *mac_addr, WILC_Uint8 *pu8RxMic, WILC_Uint8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode, WILC_Uint8 u8Idx)
+WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, WILC_Uint8 u8PtkKeylen,
+			     const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode, WILC_Uint8 u8Idx)
 {
 	WILC_Sint32 s32Error = WILC_SUCCESS;
 	tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
@@ -5014,9 +5014,9 @@ WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8Ptk, WILC
  *  @date		8 March 2012
  *  @version		1.0
  */
-WILC_Sint32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8RxGtk, WILC_Uint8 u8GtkKeylen,
-				WILC_Uint8 u8KeyIdx, WILC_Uint32 u32KeyRSClen, WILC_Uint8 *KeyRSC,
-				WILC_Uint8 *pu8RxMic, WILC_Uint8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode)
+WILC_Sint32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, WILC_Uint8 u8GtkKeylen,
+				WILC_Uint8 u8KeyIdx, WILC_Uint32 u32KeyRSClen, const u8 *KeyRSC,
+				const u8 *pu8RxMic, const u8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode)
 {
 	WILC_Sint32 s32Error = WILC_SUCCESS;
 	tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
@@ -5531,7 +5531,7 @@ WILC_Sint32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *p
  *  @version		1.0
  */
 WILC_Sint32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8bssid,
-				  WILC_Uint8 *pu8ssid, size_t ssidLen,
+				  const u8 *pu8ssid, size_t ssidLen,
 				  const WILC_Uint8 *pu8IEs, size_t IEsLen,
 				  tWILCpfConnectResult pfConnectResult, void *pvUserArg,
 				  WILC_Uint8 u8security, AUTHTYPE_T tenuAuth_type,
@@ -6090,7 +6090,7 @@ WILC_Sint32 host_int_test_set_int_wid(WILC_WFIDrvHandle hWFIDrv, WILC_Uint32 u32
  *  @date
  *  @version		1.0
  */
-WILC_Sint32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *mac, WILC_Uint32 *pu32InactiveTime)
+WILC_Sint32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, WILC_Uint32 *pu32InactiveTime)
 {
 	WILC_Sint32 s32Error = WILC_SUCCESS;
 	tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
@@ -7364,10 +7364,11 @@ WILC_Sint32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam
 
 	WILC_memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam));
 	if (pstrAddStationMsg->u8NumRates > 0) {
-		pstrAddStationMsg->pu8Rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates);
-		WILC_NULLCHECK(s32Error, pstrAddStationMsg->pu8Rates);
+		u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates);
+		WILC_NULLCHECK(s32Error, rates);
 
-		WILC_memcpy(pstrAddStationMsg->pu8Rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
+		WILC_memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
+		pstrAddStationMsg->pu8Rates = rates;
 	}
 
 
@@ -7391,7 +7392,7 @@ WILC_Sint32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam
  *  @date
  *  @version	1.0
  */
-WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8MacAddr)
+WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr)
 {
 	WILC_Sint32 s32Error = WILC_SUCCESS;
 	tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
@@ -7437,7 +7438,7 @@ WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8MacAd
  *  @date
  *  @version	1.0
  */
-WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 pu8MacAddr[][ETH_ALEN])
+WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN])
 {
 	WILC_Sint32 s32Error = WILC_SUCCESS;
 	tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv;
@@ -7523,9 +7524,10 @@ WILC_Sint32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaPara
 
 	WILC_memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam));
 	if (pstrAddStationMsg->u8NumRates > 0) {
-		pstrAddStationMsg->pu8Rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates);
-		WILC_memcpy(pstrAddStationMsg->pu8Rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
-		WILC_NULLCHECK(s32Error, pstrAddStationMsg->pu8Rates);
+		u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates);
+		WILC_NULLCHECK(s32Error, rates);
+		WILC_memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates);
+		pstrAddStationMsg->pu8Rates = rates;
 	}
 
 	s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), WILC_NULL);
drivers/staging/wilc1000/host_interface.h +12 -12
index 9c06db12b7ea..5c17076d10f6 100644
@@ -464,7 +464,7 @@ typedef struct {
 	WILC_Uint8 au8BSSID[ETH_ALEN];
 	WILC_Uint16 u16AssocID;
 	WILC_Uint8 u8NumRates;
-	WILC_Uint8 *pu8Rates;
+	const u8 *pu8Rates;
 	WILC_Bool bIsHTSupported;
 	WILC_Uint16 u16HTCapInfo;
 	WILC_Uint8 u8AmpduParams;
@@ -578,8 +578,8 @@ WILC_Sint32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const WILC_Ui
  *  @date		8 March 2012
  *  @version		1.0
  */
-WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8Ptk, WILC_Uint8 u8PtkKeylen,
-			     const WILC_Uint8 *mac_addr, WILC_Uint8 *pu8RxMic, WILC_Uint8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode, WILC_Uint8 u8Idx);
+WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, WILC_Uint8 u8PtkKeylen,
+			     const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode, WILC_Uint8 u8Idx);
 
 /**
  *  @brief              host_int_get_inactive_time
@@ -593,7 +593,7 @@ WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8Ptk, WILC
  *  @date		15 April 2013
  *  @version		1.0
  */
-WILC_Sint32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *mac, WILC_Uint32 *pu32InactiveTime);
+WILC_Sint32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, WILC_Uint32 *pu32InactiveTime);
 
 /**
  *  @brief              adds Rx GTk Key
@@ -611,9 +611,9 @@ WILC_Sint32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *ma
  *  @date		8 March 2012
  *  @version		1.0
  */
-WILC_Sint32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8RxGtk, WILC_Uint8 u8GtkKeylen,
-				WILC_Uint8 u8KeyIdx, WILC_Uint32 u32KeyRSClen, WILC_Uint8 *KeyRSC,
-				WILC_Uint8 *pu8RxMic, WILC_Uint8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode);
+WILC_Sint32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, WILC_Uint8 u8GtkKeylen,
+				WILC_Uint8 u8KeyIdx, WILC_Uint32 u32KeyRSClen, const u8 *KeyRSC,
+				const u8 *pu8RxMic, const u8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode);
 
 
 /**
@@ -836,7 +836,7 @@ WILC_Sint32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *p
  */
 
 WILC_Sint32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8bssid,
-				  WILC_Uint8 *pu8ssid, size_t ssidLen,
+				  const u8 *pu8ssid, size_t ssidLen,
 				  const WILC_Uint8 *pu8IEs, size_t IEsLen,
 				  tWILCpfConnectResult pfConnectResult, void *pvUserArg,
 				  WILC_Uint8 u8security, AUTHTYPE_T tenuAuth_type,
@@ -1157,7 +1157,7 @@ WILC_Sint32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv);
 WILC_Sint32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrStaParams);
 
 /*!
- *  @fn		WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8* pu8MacAddr)
+ *  @fn		WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr)
  *  @brief		Deauthenticates clients when group is terminating
  *  @details
  *  @param[in,out]	hWFIDrv		handle to the wifi driver
@@ -1169,10 +1169,10 @@ WILC_Sint32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam
  *  @date		09 April 2014
  *  @version		1.0 Description
  */
-WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 pu8MacAddr[][ETH_ALEN]);
+WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]);
 
 /*!
- *  @fn		WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8* pu8MacAddr)
+ *  @fn		WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr)
  *  @brief		Notifies the firmware with a new deleted station
  *  @details
  *  @param[in,out]	hWFIDrv		handle to the wifi driver
@@ -1184,7 +1184,7 @@ WILC_Sint32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 pu8Mac
  *  @date		15 July 2012
  *  @version		1.0 Description
  */
-WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8MacAddr);
+WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr);
 
 /*!
  *  @fn		WILC_Sint32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam strStaParams)
drivers/staging/wilc1000/linux_mon.c +1 -1
index a19be45b5897..f0a20a98774d 100644
@@ -522,7 +522,7 @@ static void WILC_WFI_mon_setup(struct net_device *dev)
  *  @date	12 JUL 2012
  *  @version	1.0
  */
-struct net_device *WILC_WFI_init_mon_interface(char *name, struct net_device *real_dev)
+struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_device *real_dev)
 {
 
 
drivers/staging/wilc1000/wilc_memory.c +1 -1
index fbba38da19bc..f5f4b7acc993 100644
@@ -51,7 +51,7 @@ void *WILC_MemoryRealloc(void *pvOldBlock, WILC_Uint32 u32NewSize,
  *  @date	18 Aug 2010
  *  @version	1.0
  */
-void WILC_MemoryFree(void *pvBlock, tstrWILC_MemoryAttrs *strAttrs,
+void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs,
 		     WILC_Char *pcFileName, WILC_Uint32 u32LineNo)
 {
 	kfree(pvBlock);
drivers/staging/wilc1000/wilc_memory.h +1 -1
index 012f03cae0c8..4038e1f3e30b 100644
@@ -113,7 +113,7 @@ void *WILC_MemoryRealloc(void *pvOldBlock, WILC_Uint32 u32NewSize,
  *  @date	16 Aug 2010
  *  @version	1.0
  */
-void WILC_MemoryFree(void *pvBlock, tstrWILC_MemoryAttrs *strAttrs,
+void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs,
 			WILC_Char *pcFileName, WILC_Uint32 u32LineNo);
 
 /*!
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +6 -6
index d8ca75cf73f6..e9ab2cb35381 100644
@@ -1159,8 +1159,8 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k
 	WILC_Sint32 s32Error = WILC_SUCCESS, KeyLen = params->key_len;
 	WILC_Uint32 i;
 	struct WILC_WFI_priv *priv;
-	WILC_Uint8 *pu8RxMic = NULL;
-	WILC_Uint8 *pu8TxMic = NULL;
+	const u8 *pu8RxMic = NULL;
+	const u8 *pu8TxMic = NULL;
 	WILC_Uint8 u8mode = NO_ENCRYPT;
 	#ifdef WILC_AP_EXTERNAL_MLME
 	WILC_Uint8 u8gmode = NO_ENCRYPT;
@@ -1662,7 +1662,7 @@ static int WILC_WFI_dump_survey(struct wiphy *wiphy, struct net_device *netdev,
 
 extern uint32_t Statisitcs_totalAcks, Statisitcs_DroppedAcks;
 static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev,
-				u8 *mac, struct station_info *sinfo)
+				const u8 *mac, struct station_info *sinfo)
 {
 	WILC_Sint32 s32Error = WILC_SUCCESS;
 	struct WILC_WFI_priv *priv;
@@ -3431,7 +3431,7 @@ static int  WILC_WFI_stop_ap(struct wiphy *wiphy, struct net_device *dev)
  *  @version	1.0
  */
 static int  WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev,
-				 u8 *mac, struct station_parameters *params)
+				 const u8 *mac, struct station_parameters *params)
 {
 	WILC_Sint32 s32Error = WILC_SUCCESS;
 	struct WILC_WFI_priv *priv;
@@ -3518,7 +3518,7 @@ static int  WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev,
 static int WILC_WFI_del_station(struct wiphy *wiphy, struct net_device *dev,
 				struct station_del_parameters *params)
 {
-	u8 *mac = params->mac;
+	const u8 *mac = params->mac;
 	WILC_Sint32 s32Error = WILC_SUCCESS;
 	struct WILC_WFI_priv *priv;
 	perInterface_wlan_t *nic;
@@ -3564,7 +3564,7 @@ static int WILC_WFI_del_station(struct wiphy *wiphy, struct net_device *dev,
  *  @version	1.0
  */
 static int WILC_WFI_change_station(struct wiphy *wiphy, struct net_device *dev,
-				   u8 *mac, struct station_parameters *params)
+				   const u8 *mac, struct station_parameters *params)
 {
 	WILC_Sint32 s32Error = WILC_SUCCESS;
 	struct WILC_WFI_priv *priv;
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +1 -1
index 829ba32ea210..f45a15f4650f 100644
@@ -118,7 +118,7 @@ int WILC_WFI_DeInitHostInt(struct net_device *net);
 int WILC_WFI_InitHostInt(struct net_device *net);
 void WILC_WFI_monitor_rx(uint8_t *buff, uint32_t size);
 int WILC_WFI_deinit_mon_interface(void);
-struct net_device *WILC_WFI_init_mon_interface(char *name, struct net_device *real_dev);
+struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_device *real_dev);
 
 #ifdef TCP_ENHANCEMENTS
 #define TCP_ACK_FILTER_LINK_SPEED_THRESH 54
Signature · 1 line
2.1.0.rc2
#12 lore raw

PATCH v2 12/12 staging: wilc1000: fix compiler warnings

In reply to Arnd Bergmann

This avoids the remaining warnings that one gets on a normal
build: unused variables, unused labels, and invalid printk format strings.

---
 drivers/staging/wilc1000/linux_wlan.c     | 8 ++++++--
 drivers/staging/wilc1000/linux_wlan_spi.c | 3 ---
 drivers/staging/wilc1000/wilc_spi.c       | 4 ++--
 drivers/staging/wilc1000/wilc_wlan.c      | 6 ++----
 4 files changed, 10 insertions(+), 11 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +6 -2
index 2a74441af09e..46c7e4f3471d 100644
@@ -1025,7 +1025,6 @@ int repeat_power_cycle(perInterface_wlan_t *nic);
 static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
 {
 
-	static int timeout = 5;
 	int ret = 0;
 	/* start firmware */
 	PRINT_D(INIT_DBG, "Starting Firmware ...\n");
@@ -1040,6 +1039,7 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
 	ret = linux_wlan_lock_timeout(&g_linux_wlan->sync_event, 5000);
 	if (ret) {
 #ifdef COMPLEMENT_BOOT
+		static int timeout = 5;
 
 		if (timeout--) {
 			PRINT_D(INIT_DBG, "repeat power cycle[%d]", timeout);
@@ -1675,7 +1675,9 @@ _fail_2:
 	linux_wlan_unlock(&g_linux_wlan->rxq_event);
 	kthread_stop(g_linux_wlan->rxq_thread);
 
+#ifndef TCP_ENHANCEMENTS
 _fail_1:
+#endif
 	#if (RX_BH_TYPE == RX_BH_KTHREAD)
 	/*De-Initialize 1st thread*/
 	g_linux_wlan->close = 1;
@@ -1999,8 +2001,8 @@ _fail_fw_start_:
 _fail_irq_enable_:
 #if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
 		disable_sdio_interrupt();
-#endif
 _fail_irq_init_:
+#endif
 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
 		deinit_irq(g_linux_wlan);
 
@@ -2522,8 +2524,10 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset)
 	int stats;
 	unsigned char *buff_to_send = NULL;
 	struct sk_buff *skb;
+#ifndef TCP_ENHANCEMENTS
 	char *pu8UdpBuffer;
 	struct iphdr *ih;
+#endif
 	struct net_device *wilc_netdev;
 	perInterface_wlan_t *nic;
 
drivers/staging/wilc1000/linux_wlan_spi.c +0 -3
index 0c30bbb5fa65..e5d794590f00 100644
@@ -102,9 +102,6 @@ int linux_spi_init(void *vp)
 
 	if (called == 0) {
 		called++;
-		if (&wilc_bus == NULL) {
-			PRINT_ER("wilc_bus address is NULL\n");
-		}
 		ret = spi_register_driver(&wilc_bus);
 	}
 
drivers/staging/wilc1000/wilc_spi.c +2 -2
index 2f38ddabc654..d0e761080ca5 100644
@@ -1194,10 +1194,10 @@ static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func)
 		/* Read failed. Try with CRC off. This might happen when module
 		 * is removed but chip isn't reset*/
 		g_spi.crc_off = 1;
-		PRINT_ER("[wilc spi]: Failed internal read protocol with CRC on, retyring with CRC off...\n", __LINE__);
+		PRINT_ER("[wilc spi]: Failed internal read protocol with CRC on, retyring with CRC off...\n");
 		if (!spi_internal_read(WILC_SPI_PROTOCOL_OFFSET, &reg)) {
 			/* Reaad failed with both CRC on and off, something went bad */
-			PRINT_ER("[wilc spi]: Failed internal read protocol...\n", __LINE__);
+			PRINT_ER("[wilc spi]: Failed internal read protocol...\n");
 			return 0;
 		}
 	}
drivers/staging/wilc1000/wilc_wlan.c +2 -4
index 92ed42ad49ac..badc8743dd1a 100644
@@ -894,8 +894,6 @@ INLINE void chip_wakeup(void)
 #endif
 void chip_sleep_manually(WILC_Uint32 u32SleepTime)
 {
-	uint32_t val32;
-
 	if (genuChipPSstate != CHIP_WAKEDUP) {
 		/* chip is already sleeping. Do nothing */
 		return;
@@ -2302,7 +2300,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)
 #else
 		g_wlan.tx_buffer = (uint8_t *)g_wlan.os_func.os_malloc(g_wlan.tx_buffer_size);
 #endif
-	PRINT_D(TX_DBG, "g_wlan.tx_buffer = 0x%x\n", g_wlan.tx_buffer);
+	PRINT_D(TX_DBG, "g_wlan.tx_buffer = %p\n", g_wlan.tx_buffer);
 
 	if (g_wlan.tx_buffer == WILC_NULL) {
 		/* ENOBUFS	105 */
@@ -2319,7 +2317,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)
   #else
 		g_wlan.rx_buffer = (uint8_t *)g_wlan.os_func.os_malloc(g_wlan.rx_buffer_size);
   #endif
-	PRINT_D(TX_DBG, "g_wlan.rx_buffer =0x%x\n", g_wlan.rx_buffer);
+	PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer);
 	if (g_wlan.rx_buffer == WILC_NULL) {
 		/* ENOBUFS	105 */
 		ret = -105;
Signature · 1 line
2.1.0.rc2
maintainer
#13 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

Hi Greg,

Next try, I've rebased on top of your staging-testing branch and fixed the two build errors.

While I had done my normal build testing on the driver (a few hundred randconfig builds), I don't normally do 'make clean', so the stale Makefile entry ended up picking the old object files and succeeding with that.

Thanks, I've applied these but there are still a bunch of warnings. It's obvious no one has ever built this code on a 64bit processor (Atmel, come on, not all the world is 32bits...)

I'll take a pass at it to see if I can clean up some stuff to maybe reduce the number of warnings, but right now, it's still way too many for linux-next to want to enable as it blows up their logs...

thanks,

greg k-h

maintainer
#14 lore raw
Quoted 11 lines · Greg KH
Quoted 9 lines · Arnd Bergmann

Hi Greg,

Next try, I've rebased on top of your staging-testing branch and fixed the two build errors.

While I had done my normal build testing on the driver (a few hundred randconfig builds), I don't normally do 'make clean', so the stale Makefile entry ended up picking the old object files and succeeding with that.

Quoted 7 lines

Thanks, I've applied these but there are still a bunch of warnings. It's obvious no one has ever built this code on a 64bit processor (Atmel, come on, not all the world is 32bits...)

I'll take a pass at it to see if I can clean up some stuff to maybe reduce the number of warnings, but right now, it's still way too many for linux-next to want to enable as it blows up their logs...

Ugh, that's a rabbit hole you can disappear into for a long time. I did a few patches but ran out of time, I can spend days mucking down in there unwinding the mess...

Johnny, Rachel, Dean, and Chris, can you all fix up all of the build warnings as soon as possible? Take my tree and work off of that, just build it on your desktop 64bit Linux build and get rid of all of them properly and send me the patches. Hopefully by the end of this week so that linux-next can get some testing with this driver enabled.

thanks,

greg k-h

#15 lore raw
Quoted 22 lines · Greg KH
Quoted 10 lines · Greg KH
Quoted 9 lines · Arnd Bergmann

Hi Greg,

Next try, I've rebased on top of your staging-testing branch and fixed the two build errors.

While I had done my normal build testing on the driver (a few hundred randconfig builds), I don't normally do 'make clean', so the stale Makefile entry ended up picking the old object files and succeeding with that.

Quoted 7 lines

Thanks, I've applied these but there are still a bunch of warnings. It's obvious no one has ever built this code on a 64bit processor (Atmel, come on, not all the world is 32bits...)

I'll take a pass at it to see if I can clean up some stuff to maybe reduce the number of warnings, but right now, it's still way too many for linux-next to want to enable as it blows up their logs...

Ugh, that's a rabbit hole you can disappear into for a long time. I did a few patches but ran out of time, I can spend days mucking down in there unwinding the mess...

Quoted 5 lines

Johnny, Rachel, Dean, and Chris, can you all fix up all of the build warnings as soon as possible? Take my tree and work off of that, just build it on your desktop 64bit Linux build and get rid of all of them properly and send me the patches. Hopefully by the end of this week so that linux-next can get some testing with this driver enabled.

OK. I will fix the warnings and 64bits dependency on current staging-next by the end of this week. Thanks for your review.

Best regards.
Johnny.