diff options
author | Arnd Bergmann <arnd@arndb.de> | 2015-06-01 21:06:43 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-06-02 13:46:05 +0900 |
commit | 83383ea33c63a622619acf2b979037ee775500dd (patch) | |
tree | d21687c04b6a6403cfd89553ce0db6c5fef1cf4f /drivers/staging/wilc1000/coreconfigurator.c | |
parent | e14af67d8fb20128927b65d824b389698dd5c663 (diff) | |
download | op-kernel-dev-83383ea33c63a622619acf2b979037ee775500dd.zip op-kernel-dev-83383ea33c63a622619acf2b979037ee775500dd.tar.gz |
staging: wilc1000: remove semaphore wrapper
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.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wilc1000/coreconfigurator.c')
-rw-r--r-- | drivers/staging/wilc1000/coreconfigurator.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index d5a076e..bf44482 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -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); |