From 8d91c1e411f55d7ea91b1183a2e9f8088fb4d5be Mon Sep 17 00:00:00 2001 From: AndrĂ© Fabian Silva Delgado Date: Tue, 15 Dec 2015 14:52:16 -0300 Subject: Linux-libre 4.3.2-gnu --- drivers/staging/wilc1000/Kconfig | 28 +- drivers/staging/wilc1000/Makefile | 8 +- drivers/staging/wilc1000/coreconfigsimulator.h | 17 - drivers/staging/wilc1000/coreconfigurator.c | 225 +--- drivers/staging/wilc1000/coreconfigurator.h | 37 +- drivers/staging/wilc1000/fifo_buffer.c | 133 -- drivers/staging/wilc1000/fifo_buffer.h | 26 - drivers/staging/wilc1000/host_interface.c | 1433 ++++++++++----------- drivers/staging/wilc1000/host_interface.h | 115 +- drivers/staging/wilc1000/linux_mon.c | 25 +- drivers/staging/wilc1000/linux_wlan.c | 248 +--- drivers/staging/wilc1000/linux_wlan_common.h | 4 +- drivers/staging/wilc1000/linux_wlan_sdio.c | 1 - drivers/staging/wilc1000/wilc_debugfs.c | 30 +- drivers/staging/wilc1000/wilc_exported_buf.c | 13 +- drivers/staging/wilc1000/wilc_log.h | 47 - drivers/staging/wilc1000/wilc_memory.c | 46 +- drivers/staging/wilc1000/wilc_memory.h | 173 --- drivers/staging/wilc1000/wilc_msgqueue.c | 28 +- drivers/staging/wilc1000/wilc_msgqueue.h | 35 +- drivers/staging/wilc1000/wilc_osconfig.h | 9 - drivers/staging/wilc1000/wilc_oswrapper.h | 12 - drivers/staging/wilc1000/wilc_platform.h | 8 +- drivers/staging/wilc1000/wilc_sdio.c | 288 +---- drivers/staging/wilc1000/wilc_sleep.c | 18 - drivers/staging/wilc1000/wilc_sleep.h | 20 - drivers/staging/wilc1000/wilc_spi.c | 15 +- drivers/staging/wilc1000/wilc_strutils.c | 80 -- drivers/staging/wilc1000/wilc_strutils.h | 134 -- drivers/staging/wilc1000/wilc_timer.c | 45 - drivers/staging/wilc1000/wilc_timer.h | 129 -- drivers/staging/wilc1000/wilc_type.h | 34 - drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 321 +++-- drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +- drivers/staging/wilc1000/wilc_wfi_netdevice.c | 951 -------------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 16 +- drivers/staging/wilc1000/wilc_wlan.c | 53 +- drivers/staging/wilc1000/wilc_wlan.h | 2 +- drivers/staging/wilc1000/wilc_wlan_cfg.c | 16 +- drivers/staging/wilc1000/wilc_wlan_if.h | 6 +- 40 files changed, 1143 insertions(+), 3688 deletions(-) delete mode 100644 drivers/staging/wilc1000/coreconfigsimulator.h delete mode 100644 drivers/staging/wilc1000/fifo_buffer.c delete mode 100644 drivers/staging/wilc1000/fifo_buffer.h delete mode 100644 drivers/staging/wilc1000/wilc_log.h delete mode 100644 drivers/staging/wilc1000/wilc_osconfig.h delete mode 100644 drivers/staging/wilc1000/wilc_sleep.c delete mode 100644 drivers/staging/wilc1000/wilc_sleep.h delete mode 100644 drivers/staging/wilc1000/wilc_strutils.c delete mode 100644 drivers/staging/wilc1000/wilc_strutils.h delete mode 100644 drivers/staging/wilc1000/wilc_timer.c delete mode 100644 drivers/staging/wilc1000/wilc_timer.h delete mode 100644 drivers/staging/wilc1000/wilc_type.h delete mode 100644 drivers/staging/wilc1000/wilc_wfi_netdevice.c (limited to 'drivers/staging/wilc1000') diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig index 062d9c5ca..51bbf468f 100644 --- a/drivers/staging/wilc1000/Kconfig +++ b/drivers/staging/wilc1000/Kconfig @@ -37,17 +37,26 @@ choice bool "SDIO support" depends on MMC ---help--- - This module adds support for the SDIO interface - of adapters using WILC chipset. Select this if - your platform is using the SDIO bus. + This module adds support for the SDIO interface of adapters using + WILC1000 chipset. The Atmel WILC1000 SDIO is a full speed interface. + It meets SDIO card specification version 2.0. The interface supports + the 1-bit/4-bit SD transfer mode at the clock range of 0-50 MHz. + The host can use this interface to read and write from any register + within the chip as well as configure the WILC1000 for data DMA. + To use this interface, pin9 (SDIO_SPI_CFG) must be grounded. Select + this if your platform is using the SDIO bus. config WILC1000_SPI depends on SPI bool "SPI support" ---help--- - This module adds support for the SPI interface - of adapters using WILC chipset. Select this if - your platform is using the SPI bus. + This module adds support for the SPI interface of adapters using + WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral + Interface (SPI) that operates as a SPI slave. This SPI interface can + be used for control and for serial I/O of 802.11 data. The SPI is a + full-duplex slave synchronous serial interface that is available + immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to + VDDIO. Select this if your platform is using the SPI bus. endchoice config WILC1000_HW_OOB_INTR @@ -55,5 +64,8 @@ config WILC1000_HW_OOB_INTR depends on WILC1000 && WILC1000_SDIO default n ---help--- - If your platform don't recognize SDIO IRQ, connect chipset external IRQ pin - and check this option. Or, Use this to get all interrupts including SDIO interrupts. + This option enables out-of-band interrupt support for the WILC1000 + chipset. This OOB interrupt is intended to provide a faster interrupt + mechanism for SDIO host controllers that don't support SDIO interrupt. + Select this option If the SDIO host controller in your platform + doesn't support SDIO time devision interrupt. diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 59b102074..30eb0090e 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -25,10 +25,10 @@ ccflags-$(CONFIG_WILC1000_PREALLOCATE_AT_LOADING_DRIVER) += -DMEMORY_STATIC \ 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_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 +wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ + wilc_memory.o wilc_msgqueue.o \ + coreconfigurator.o host_interface.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 diff --git a/drivers/staging/wilc1000/coreconfigsimulator.h b/drivers/staging/wilc1000/coreconfigsimulator.h deleted file mode 100644 index 5e01f8e4a..000000000 --- a/drivers/staging/wilc1000/coreconfigsimulator.h +++ /dev/null @@ -1,17 +0,0 @@ - -/*! - * @file coreconfigsimulator.h - * @brief - * @author - * @sa coreconfigsimulator.c - * @date 1 Mar 2012 - * @version 1.0 - */ - -#ifndef CORECONFIGSIMULATOR_H -#define CORECONFIGSIMULATOR_H - -extern s32 CoreConfigSimulatorInit(void); -extern s32 CoreConfigSimulatorDeInit(void); - -#endif diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index ed6ac45c0..16a0abc97 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -167,7 +167,6 @@ extern void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length); static struct semaphore SemHandleSendPkt; static struct semaphore SemHandlePktResp; -static s8 *gps8ConfigPacket; static tstrConfigPktInfo gstrConfigPktInfo; @@ -544,21 +543,21 @@ INLINE u8 get_from_ds(u8 *header) /* header and updates the MAC Address in the allocated 'addr' variable. */ INLINE void get_address1(u8 *pu8msa, u8 *addr) { - WILC_memcpy(addr, pu8msa + 4, 6); + memcpy(addr, pu8msa + 4, 6); } /* This function extracts the MAC Address in 'address2' field of the MAC */ /* header and updates the MAC Address in the allocated 'addr' variable. */ INLINE void get_address2(u8 *pu8msa, u8 *addr) { - WILC_memcpy(addr, pu8msa + 10, 6); + memcpy(addr, pu8msa + 10, 6); } /* This function extracts the MAC Address in 'address3' field of the MAC */ /* header and updates the MAC Address in the allocated 'addr' variable. */ INLINE void get_address3(u8 *pu8msa, u8 *addr) { - WILC_memcpy(addr, pu8msa + 16, 6); + memcpy(addr, pu8msa + 16, 6); } /* This function extracts the BSSID from the incoming WLAN packet based on */ @@ -605,7 +604,7 @@ INLINE u16 get_cap_info(u8 *data) { u16 cap_info = 0; u16 index = MAC_HDR_LEN; - tenuFrmSubtype st = BEACON; + tenuFrmSubtype st; st = get_sub_type(data); @@ -674,17 +673,8 @@ s32 CoreConfiguratorInit(void) sema_init(&SemHandleSendPkt, 1); sema_init(&SemHandlePktResp, 0); - gps8ConfigPacket = (s8 *)WILC_MALLOC(MAX_PACKET_BUFF_SIZE); - if (gps8ConfigPacket == NULL) { - PRINT_ER("failed in gps8ConfigPacket allocation\n"); - s32Error = WILC_NO_MEM; - goto _fail_; - } - - WILC_memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE); - WILC_memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo)); -_fail_: + memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo)); return s32Error; } @@ -706,11 +696,10 @@ u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset) /* Search for the TIM Element Field and return if the element is found */ while (u16index < (u16RxLen - FCS_LEN)) { - if (pu8msa[u16index] == ITIM) { + if (pu8msa[u16index] == ITIM) return &pu8msa[u16index]; - } else { + else u16index += (IE_HDR_LEN + pu8msa[u16index + 1]); - } } return 0; @@ -811,8 +800,11 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) u32 u32Tsf_Lo; u32 u32Tsf_Hi; - pstrNetworkInfo = (tstrNetworkInfo *)WILC_MALLOC(sizeof(tstrNetworkInfo)); - WILC_memset((void *)(pstrNetworkInfo), 0, sizeof(tstrNetworkInfo)); + pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_KERNEL); + if (!pstrNetworkInfo) + return -ENOMEM; + + memset((void *)(pstrNetworkInfo), 0, sizeof(tstrNetworkInfo)); pstrNetworkInfo->s8rssi = pu8WidVal[0]; @@ -855,17 +847,19 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) /* Get DTIM Period */ pu8TimElm = get_tim_elm(pu8msa, (u16RxLen + FCS_LEN), u8index); - if (pu8TimElm != 0) { + if (pu8TimElm != 0) pstrNetworkInfo->u8DtimPeriod = pu8TimElm[3]; - } pu8IEs = &pu8msa[MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN]; u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN); if (u16IEsLen > 0) { - pstrNetworkInfo->pu8IEs = (u8 *)WILC_MALLOC(u16IEsLen); - WILC_memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen); + pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, GFP_KERNEL); + if (!pstrNetworkInfo->pu8IEs) + return -ENOMEM; - WILC_memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen); + memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen); + + memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen); } pstrNetworkInfo->u16IEsLen = u16IEsLen; @@ -893,13 +887,13 @@ s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo) if (pstrNetworkInfo != NULL) { if (pstrNetworkInfo->pu8IEs != NULL) { - WILC_FREE(pstrNetworkInfo->pu8IEs); + kfree(pstrNetworkInfo->pu8IEs); pstrNetworkInfo->pu8IEs = NULL; } else { s32Error = WILC_FAIL; } - WILC_FREE(pstrNetworkInfo); + kfree(pstrNetworkInfo); pstrNetworkInfo = NULL; } else { @@ -929,8 +923,11 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, u8 *pu8IEs = 0; u16 u16IEsLen = 0; - pstrConnectRespInfo = (tstrConnectRespInfo *)WILC_MALLOC(sizeof(tstrConnectRespInfo)); - WILC_memset((void *)(pstrConnectRespInfo), 0, sizeof(tstrConnectRespInfo)); + pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL); + if (!pstrConnectRespInfo) + return -ENOMEM; + + memset((void *)(pstrConnectRespInfo), 0, sizeof(tstrConnectRespInfo)); /* u16AssocRespLen = pu8Buffer[0]; */ u16AssocRespLen = (u16)u32BufferLen; @@ -949,10 +946,13 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN]; u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN); - pstrConnectRespInfo->pu8RespIEs = (u8 *)WILC_MALLOC(u16IEsLen); - WILC_memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen); + pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, GFP_KERNEL); + if (!pstrConnectRespInfo->pu8RespIEs) + return -ENOMEM; - WILC_memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen); + memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen); + + memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen); pstrConnectRespInfo->u16RespIEsLen = u16IEsLen; } @@ -978,13 +978,13 @@ s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo) if (pstrConnectRespInfo != NULL) { if (pstrConnectRespInfo->pu8RespIEs != NULL) { - WILC_FREE(pstrConnectRespInfo->pu8RespIEs); + kfree(pstrConnectRespInfo->pu8RespIEs); pstrConnectRespInfo->pu8RespIEs = NULL; } else { s32Error = WILC_FAIL; } - WILC_FREE(pstrConnectRespInfo); + kfree(pstrConnectRespInfo); pstrConnectRespInfo = NULL; } else { @@ -1018,13 +1018,12 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ } } - pstrSurveyResults = (wid_site_survey_reslts_s *)WILC_MALLOC(u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s)); - if (pstrSurveyResults == NULL) { - u32SurveyResultsCount = 0; - WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } + pstrSurveyResults = kmalloc_array(u32SurveyResultsCount, + sizeof(wid_site_survey_reslts_s), GFP_KERNEL); + if (!pstrSurveyResults) + return -ENOMEM; - WILC_memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s)); + memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s)); u32SurveyResultsCount = 0; @@ -1039,7 +1038,7 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ pu8BufferPtr += 2; for (j = 0; j < u32SurveyBytesLength; j += SURVEY_RESULT_LENGTH) { - WILC_memcpy(&pstrSurveyResults[u32SurveyResultsCount], pu8BufferPtr, SURVEY_RESULT_LENGTH); + memcpy(&pstrSurveyResults[u32SurveyResultsCount], pu8BufferPtr, SURVEY_RESULT_LENGTH); pu8BufferPtr += SURVEY_RESULT_LENGTH; u32SurveyResultsCount++; } @@ -1058,7 +1057,7 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults) s32 s32Error = WILC_SUCCESS; if (pstrSurveyResults != NULL) { - WILC_FREE(pstrSurveyResults); + kfree(pstrSurveyResults); } return s32Error; @@ -1334,7 +1333,6 @@ void ProcessStrWid(char *pcPacket, s32 *ps32PktLen, if (g_oper_mode == SET_CFG) { /* Message Length */ - /* u16MsgLen = WILC_strlen(pu8val); */ u16MsgLen = (u16)s32ValueSize; /* Length */ @@ -1441,8 +1439,6 @@ void ProcessAdrWid(char *pcPacket, s32 *ps32PktLen, void ProcessBinWid(char *pcPacket, s32 *ps32PktLen, tstrWID *pstrWID, u8 *pu8val, s32 s32ValueSize) { - /* WILC_ERROR("processing Binary WIDs is not supported\n"); */ - u16 u16MsgLen = 0; u16 idx = 0; s32 s32PktLen = *ps32PktLen; @@ -1528,11 +1524,10 @@ s32 further_process_response(u8 *resp, u8 cfg_str[256] = {0}; tenuWIDtype enuWIDtype = WID_UNDEF; - if (process_wid_num) { + if (process_wid_num) enuWIDtype = get_wid_type(g_wid_num); - } else { + else enuWIDtype = gastrWIDs[cnt].enuWIDtype; - } switch (enuWIDtype) { @@ -1566,18 +1561,10 @@ s32 further_process_response(u8 *resp, } case WID_STR: - WILC_memcpy(cfg_str, resp + idx, cfg_len); + memcpy(cfg_str, resp + idx, cfg_len); /* cfg_str[cfg_len] = '\0'; //mostafa: no need currently for NULL termination */ - if (process_wid_num) { - /*fprintf(out_file,"0x%4.4x = %s\n",g_wid_num, - * cfg_str);*/ - } else { - /*fprintf(out_file,"%s = %s\n",gastrWIDs[cnt].cfg_switch, - * cfg_str);*/ - } - if (pstrWIDresult->s32ValueSize >= cfg_len) { - WILC_memcpy(pstrWIDresult->ps8WidVal, cfg_str, cfg_len); /* mostafa: no need currently for the extra NULL byte */ + memcpy(pstrWIDresult->ps8WidVal, cfg_str, cfg_len); /* mostafa: no need currently for the extra NULL byte */ pstrWIDresult->s32ValueSize = cfg_len; } else { PRINT_ER("allocated WID buffer length is smaller than the received WID Length\n"); @@ -1589,15 +1576,8 @@ s32 further_process_response(u8 *resp, case WID_ADR: create_mac_addr(cfg_str, resp + idx); - WILC_strncpy(pstrWIDresult->ps8WidVal, cfg_str, WILC_strlen(cfg_str)); - pstrWIDresult->ps8WidVal[WILC_strlen(cfg_str)] = '\0'; - if (process_wid_num) { - /*fprintf(out_file,"0x%4.4x = %s\n",g_wid_num, - * cfg_str);*/ - } else { - /*fprintf(out_file,"%s = %s\n",gastrWIDs[cnt].cfg_switch, - * cfg_str);*/ - } + strncpy(pstrWIDresult->ps8WidVal, cfg_str, strlen(cfg_str)); + pstrWIDresult->ps8WidVal[strlen(cfg_str)] = '\0'; break; case WID_IP: @@ -1606,18 +1586,11 @@ s32 further_process_response(u8 *resp, MAKE_WORD16(resp[idx + 2], resp[idx + 3]) ); conv_int_to_ip(cfg_str, cfg_int); - if (process_wid_num) { - /*fprintf(out_file,"0x%4.4x = %s\n",g_wid_num, - * cfg_str);*/ - } else { - /*fprintf(out_file,"%s = %s\n",gastrWIDs[cnt].cfg_switch, - * cfg_str);*/ - } break; case WID_BIN_DATA: if (pstrWIDresult->s32ValueSize >= cfg_len) { - WILC_memcpy(pstrWIDresult->ps8WidVal, resp + idx, cfg_len); + memcpy(pstrWIDresult->ps8WidVal, resp + idx, cfg_len); pstrWIDresult->s32ValueSize = cfg_len; } else { PRINT_ER("Allocated WID buffer length is smaller than the received WID Length Err(%d)\n", retval); @@ -1739,7 +1712,6 @@ s32 ParseResponse(u8 *resp, tstrWID *pstrWIDcfgResult) s32 ParseWriteResponse(u8 *pu8RespBuffer) { s32 s32Error = WILC_FAIL; - u16 u16RespLen = 0; u16 u16WIDtype = (u16)WID_NIL; /* Check whether the received frame is a valid response */ @@ -1748,9 +1720,6 @@ s32 ParseWriteResponse(u8 *pu8RespBuffer) return WILC_FAIL; } - /* Extract Response Length */ - u16RespLen = MAKE_WORD16(pu8RespBuffer[2], pu8RespBuffer[3]); - u16WIDtype = MAKE_WORD16(pu8RespBuffer[4], pu8RespBuffer[5]); /* Check for WID_STATUS ID and then check the length and status value */ @@ -1898,104 +1867,21 @@ s32 ConfigWaitResponse(char *pcRespBuffer, s32 s32MaxRespBuffLen, s32 *ps32Bytes *ps32BytesRead = gstrConfigPktInfo.s32BytesRead; } - WILC_memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo)); + memset((void *)(&gstrConfigPktInfo), 0, sizeof(tstrConfigPktInfo)); return s32Error; } -/** - * @brief sends certain Configuration Packet based on the input WIDs pstrWIDs - * and retrieves the packet response pu8RxResp - * @details - * @param[in] pstrWIDs WIDs to be sent in the configuration packet - * @param[in] u32WIDsCount number of WIDs to be sent in the configuration packet - * @param[out] pu8RxResp The received Packet Response - * @param[out] ps32RxRespLen Length of the received Packet Response - * @return Error code indicating success/failure - * @note - * @author mabubakr - * @date 1 Mar 2012 - * @version 1.0 - */ -#ifdef SIMULATION -s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, - u32 u32WIDsCount, bool bRespRequired, u32 drvHandler) -{ - s32 s32Error = WILC_SUCCESS; - s32 err = WILC_SUCCESS; - s32 s32ConfigPacketLen = 0; - s32 s32RcvdRespLen = 0; - - down(&SemHandleSendPkt); - - /*set the packet mode*/ - g_oper_mode = u8Mode; - - WILC_memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE); - - if (CreateConfigPacket(gps8ConfigPacket, &s32ConfigPacketLen, pstrWIDs, u32WIDsCount) != WILC_SUCCESS) { - s32Error = WILC_FAIL; - goto End_ConfigPkt; - } - /*bug 3878*/ - gstrConfigPktInfo.pcRespBuffer = gps8ConfigPacket; - gstrConfigPktInfo.s32MaxRespBuffLen = MAX_PACKET_BUFF_SIZE; - PRINT_INFO(CORECONFIG_DBG, "GLOBAL =bRespRequired =%d\n", bRespRequired); - gstrConfigPktInfo.bRespRequired = bRespRequired; - - s32Error = SendRawPacket(gps8ConfigPacket, s32ConfigPacketLen); - if (s32Error != WILC_SUCCESS) { - goto End_ConfigPkt; - } - - WILC_memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE); - - ConfigWaitResponse(gps8ConfigPacket, MAX_PACKET_BUFF_SIZE, &s32RcvdRespLen, bRespRequired); - - - if (bRespRequired) { - /* If the operating Mode is GET, then we expect a response frame from */ - /* the driver. Hence start listening to the port for response */ - if (g_oper_mode == GET_CFG) { - #if 1 - err = ParseResponse(gps8ConfigPacket, pstrWIDs); - if (err != 0) { - s32Error = WILC_FAIL; - goto End_ConfigPkt; - } else { - s32Error = WILC_SUCCESS; - } - #endif - } else { - err = ParseWriteResponse(gps8ConfigPacket); - if (err != WRITE_RESP_SUCCESS) { - s32Error = WILC_FAIL; - goto End_ConfigPkt; - } else { - s32Error = WILC_SUCCESS; - } - } - - - } - - -End_ConfigPkt: - up(&SemHandleSendPkt); - - return s32Error; -} -#endif s32 ConfigProvideResponse(char *pcRespBuffer, s32 s32RespLen) { s32 s32Error = WILC_SUCCESS; if (gstrConfigPktInfo.bRespRequired) { if (s32RespLen <= gstrConfigPktInfo.s32MaxRespBuffLen) { - WILC_memcpy(gstrConfigPktInfo.pcRespBuffer, pcRespBuffer, s32RespLen); + memcpy(gstrConfigPktInfo.pcRespBuffer, pcRespBuffer, s32RespLen); gstrConfigPktInfo.s32BytesRead = s32RespLen; } else { - WILC_memcpy(gstrConfigPktInfo.pcRespBuffer, pcRespBuffer, gstrConfigPktInfo.s32MaxRespBuffLen); + memcpy(gstrConfigPktInfo.pcRespBuffer, pcRespBuffer, gstrConfigPktInfo.s32MaxRespBuffLen); gstrConfigPktInfo.s32BytesRead = gstrConfigPktInfo.s32MaxRespBuffLen; PRINT_ER("BusProvideResponse() Response greater than the prepared Buffer Size\n"); } @@ -2069,17 +1955,10 @@ s32 CoreConfiguratorDeInit(void) PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit()\n"); - if (gps8ConfigPacket != NULL) { - - WILC_FREE(gps8ConfigPacket); - gps8ConfigPacket = NULL; - } return s32Error; } - -#ifndef SIMULATION /*Using the global handle of the driver*/ extern wilc_wlan_oup_t *gpstrWlanOps; /** @@ -2129,7 +2008,6 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, /** * get the value **/ - /* WILC_Sleep(1000); */ counter = 0; for (counter = 0; counter < u32WIDsCount; counter++) { pstrWIDs[counter].s32ValueSize = gpstrWlanOps->wlan_cfg_get_value( @@ -2153,4 +2031,3 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, return ret; } -#endif diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h index 9059c8df7..3af193543 100644 --- a/drivers/staging/wilc1000/coreconfigurator.h +++ b/drivers/staging/wilc1000/coreconfigurator.h @@ -8,7 +8,6 @@ * @version 1.0 */ - #ifndef CORECONFIGURATOR_H #define CORECONFIGURATOR_H @@ -42,7 +41,6 @@ extern u16 g_num_total_switches; #define AID_LEN 2 #define IE_HDR_LEN 2 - /* Operating Mode: SET */ #define SET_CFG 0 /* Operating Mode: GET */ @@ -59,15 +57,12 @@ extern u16 g_num_total_switches; #define MAC_CONNECTED 1 #define MAC_DISCONNECTED 0 - - /*****************************************************************************/ /* Function Macros */ /*****************************************************************************/ #define MAKE_WORD16(lsb, msb) ((((u16)(msb) << 8) & 0xFF00) | (lsb)) #define MAKE_WORD32(lsw, msw) ((((u32)(msw) << 16) & 0xFFFF0000) | (lsw)) - /*****************************************************************************/ /* Type Definitions */ /*****************************************************************************/ @@ -140,7 +135,6 @@ typedef struct { u16 u16RespIEsLen; } tstrConnectRespInfo; - typedef struct { u8 au8bssid[6]; u8 *pu8ReqIEs; @@ -150,8 +144,6 @@ typedef struct { u16 u16ConnectStatus; } tstrConnectInfo; - - typedef struct { u16 u16reason; u8 *ie; @@ -171,26 +163,27 @@ typedef struct wid_site_survey_reslts { } wid_site_survey_reslts_s; #endif -extern s32 CoreConfiguratorInit(void); -extern s32 CoreConfiguratorDeInit(void); +s32 CoreConfiguratorInit(void); +s32 CoreConfiguratorDeInit(void); -extern s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, - u32 u32WIDsCount, bool bRespRequired, u32 drvHandler); -extern s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo); -extern s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo); +s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs, + u32 u32WIDsCount, bool bRespRequired, u32 drvHandler); +s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo); +s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo); -extern s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, - tstrConnectRespInfo **ppstrConnectRespInfo); -extern s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo); +s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, + tstrConnectRespInfo **ppstrConnectRespInfo); +s32 DeallocateAssocRespInfo(tstrConnectRespInfo *pstrConnectRespInfo); #ifndef CONNECT_DIRECT -extern s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], - wid_site_survey_reslts_s **ppstrSurveyResults, u32 *pu32SurveyResultsCount); -extern s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults); +s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], + wid_site_survey_reslts_s **ppstrSurveyResults, + u32 *pu32SurveyResultsCount); +s32 DeallocateSurveyResults(wid_site_survey_reslts_s *pstrSurveyResults); #endif -extern s32 SendRawPacket(s8 *pspacket, s32 s32PacketLen); -extern void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length); +s32 SendRawPacket(s8 *pspacket, s32 s32PacketLen); +void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length); void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length); void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length); diff --git a/drivers/staging/wilc1000/fifo_buffer.c b/drivers/staging/wilc1000/fifo_buffer.c deleted file mode 100644 index b6c07cfc4..000000000 --- a/drivers/staging/wilc1000/fifo_buffer.c +++ /dev/null @@ -1,133 +0,0 @@ - - -#include "fifo_buffer.h" - - - -u32 FIFO_InitBuffer(tHANDLE *hBuffer, u32 u32BufferLength) -{ - u32 u32Error = 0; - tstrFifoHandler *pstrFifoHandler = WILC_MALLOC (sizeof (tstrFifoHandler)); - if (pstrFifoHandler) { - WILC_memset (pstrFifoHandler, 0, sizeof (tstrFifoHandler)); - pstrFifoHandler->pu8Buffer = WILC_MALLOC (u32BufferLength); - if (pstrFifoHandler->pu8Buffer) { - pstrFifoHandler->u32BufferLength = u32BufferLength; - WILC_memset (pstrFifoHandler->pu8Buffer, 0, u32BufferLength); - /* create semaphore */ - sema_init(&pstrFifoHandler->SemBuffer, 1); - *hBuffer = pstrFifoHandler; - } else { - *hBuffer = NULL; - u32Error = 1; - } - } else { - u32Error = 1; - } - return u32Error; -} -u32 FIFO_DeInit(tHANDLE hFifo) -{ - u32 u32Error = 0; - tstrFifoHandler *pstrFifoHandler = (tstrFifoHandler *) hFifo; - if (pstrFifoHandler) { - if (pstrFifoHandler->pu8Buffer) { - WILC_FREE (pstrFifoHandler->pu8Buffer); - } else { - u32Error = 1; - } - - WILC_FREE (pstrFifoHandler); - } else { - u32Error = 1; - } - return u32Error; -} - -u32 FIFO_ReadBytes(tHANDLE hFifo, u8 *pu8Buffer, u32 u32BytesToRead, u32 *pu32BytesRead) -{ - u32 u32Error = 0; - tstrFifoHandler *pstrFifoHandler = (tstrFifoHandler *) hFifo; - if (pstrFifoHandler && pu32BytesRead) { - if (pstrFifoHandler->u32TotalBytes) { - down(&pstrFifoHandler->SemBuffer); - - if (u32BytesToRead > pstrFifoHandler->u32TotalBytes) { - *pu32BytesRead = pstrFifoHandler->u32TotalBytes; - } else { - *pu32BytesRead = u32BytesToRead; - } - if ((pstrFifoHandler->u32ReadOffset + u32BytesToRead) <= pstrFifoHandler->u32BufferLength) { - WILC_memcpy(pu8Buffer, pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32ReadOffset, - *pu32BytesRead); - /* update read offset and total bytes */ - pstrFifoHandler->u32ReadOffset += u32BytesToRead; - pstrFifoHandler->u32TotalBytes -= u32BytesToRead; - - } else { - u32 u32FirstPart = - pstrFifoHandler->u32BufferLength - pstrFifoHandler->u32ReadOffset; - WILC_memcpy(pu8Buffer, pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32ReadOffset, - u32FirstPart); - WILC_memcpy(pu8Buffer + u32FirstPart, pstrFifoHandler->pu8Buffer, - u32BytesToRead - u32FirstPart); - /* update read offset and total bytes */ - pstrFifoHandler->u32ReadOffset = u32BytesToRead - u32FirstPart; - pstrFifoHandler->u32TotalBytes -= u32BytesToRead; - } - up(&pstrFifoHandler->SemBuffer); - } else { - u32Error = 1; - } - } else { - u32Error = 1; - } - return u32Error; -} - -u32 FIFO_WriteBytes(tHANDLE hFifo, u8 *pu8Buffer, u32 u32BytesToWrite, bool bForceOverWrite) -{ - u32 u32Error = 0; - tstrFifoHandler *pstrFifoHandler = (tstrFifoHandler *) hFifo; - if (pstrFifoHandler) { - if (u32BytesToWrite < pstrFifoHandler->u32BufferLength) { - if ((pstrFifoHandler->u32TotalBytes + u32BytesToWrite) <= pstrFifoHandler->u32BufferLength || - bForceOverWrite) { - down(&pstrFifoHandler->SemBuffer); - if ((pstrFifoHandler->u32WriteOffset + u32BytesToWrite) <= pstrFifoHandler->u32BufferLength) { - WILC_memcpy(pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32WriteOffset, pu8Buffer, - u32BytesToWrite); - /* update read offset and total bytes */ - pstrFifoHandler->u32WriteOffset += u32BytesToWrite; - pstrFifoHandler->u32TotalBytes += u32BytesToWrite; - - } else { - u32 u32FirstPart = - pstrFifoHandler->u32BufferLength - pstrFifoHandler->u32WriteOffset; - WILC_memcpy(pstrFifoHandler->pu8Buffer + pstrFifoHandler->u32WriteOffset, pu8Buffer, - u32FirstPart); - WILC_memcpy(pstrFifoHandler->pu8Buffer, pu8Buffer + u32FirstPart, - u32BytesToWrite - u32FirstPart); - /* update read offset and total bytes */ - pstrFifoHandler->u32WriteOffset = u32BytesToWrite - u32FirstPart; - pstrFifoHandler->u32TotalBytes += u32BytesToWrite; - } - /* if data overwriten */ - if (pstrFifoHandler->u32TotalBytes > pstrFifoHandler->u32BufferLength) { - /* adjust read offset to the oldest data available */ - pstrFifoHandler->u32ReadOffset = pstrFifoHandler->u32WriteOffset; - /* data availabe is the buffer length */ - pstrFifoHandler->u32TotalBytes = pstrFifoHandler->u32BufferLength; - } - up(&pstrFifoHandler->SemBuffer); - } else { - u32Error = 1; - } - } else { - u32Error = 1; - } - } else { - u32Error = 1; - } - return u32Error; -} diff --git a/drivers/staging/wilc1000/fifo_buffer.h b/drivers/staging/wilc1000/fifo_buffer.h deleted file mode 100644 index 7b76998e4..000000000 --- a/drivers/staging/wilc1000/fifo_buffer.h +++ /dev/null @@ -1,26 +0,0 @@ - -#include -#include -#include "wilc_memory.h" -#include "wilc_strutils.h" - - -#define tHANDLE void * - -typedef struct { - u8 *pu8Buffer; - u32 u32BufferLength; - u32 u32WriteOffset; - u32 u32ReadOffset; - u32 u32TotalBytes; - struct semaphore SemBuffer; -} tstrFifoHandler; - - -extern u32 FIFO_InitBuffer(tHANDLE *hBuffer, - u32 u32BufferLength); -extern u32 FIFO_DeInit(tHANDLE hFifo); -extern u32 FIFO_ReadBytes(tHANDLE hFifo, u8 *pu8Buffer, - u32 u32BytesToRead, u32 *pu32BytesRead); -extern u32 FIFO_WriteBytes(tHANDLE hFifo, u8 *pu8Buffer, - u32 u32BytesToWrite, bool bForceOverWrite); diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 6b10bbbe6..66fa67701 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -6,10 +6,9 @@ extern s32 TransportDeInit(void); extern u8 connecting; #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP -extern WILC_TimerHandle hDuringIpTimer; +extern struct timer_list hDuringIpTimer; #endif -extern bool bEnablePS; /*BugID_5137*/ extern u8 g_wilc_initialized; /*****************************************************************************/ @@ -467,7 +466,7 @@ typedef union _tuniHostIFmsgBody { typedef struct _tstrHostIFmsg { u16 u16MsgId; /*!< Message ID */ tuniHostIFmsgBody uniHostIFmsgBody; /*!< Message body */ - void *drvHandler; + tstrWILC_WFIDrv *drvHandler; } tstrHostIFmsg; #ifdef CONNECT_DIRECT @@ -534,8 +533,8 @@ typedef enum { /*****************************************************************************/ -tstrWILC_WFIDrv *terminated_handle = NULL; -tstrWILC_WFIDrv *gWFiDrvHandle = NULL; +tstrWILC_WFIDrv *terminated_handle; +tstrWILC_WFIDrv *gWFiDrvHandle; #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP bool g_obtainingIP = false; #endif @@ -547,7 +546,7 @@ static struct semaphore hSemHostIFthrdEnd; struct semaphore hSemDeinitDrvHandle; static struct semaphore hWaitResponse; struct semaphore hSemHostIntDeinit; -WILC_TimerHandle g_hPeriodicRSSI; +struct timer_list g_hPeriodicRSSI; @@ -570,9 +569,7 @@ static u8 gs8GetIP[2][4]; static u32 gu32InactiveTime; static u8 gu8DelBcn; #endif -#ifndef SIMULATION static u32 gu32WidConnRstHack; -#endif /*BugID_5137*/ u8 *gu8FlushedJoinReq; @@ -604,7 +601,7 @@ extern int linux_wlan_get_num_conn_ifcs(void); * @date * @version 1.0 */ -static s32 Handle_SetChannel(void *drvHandler, tstrHostIFSetChan *pstrHostIFSetChan) +static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetChan *pstrHostIFSetChan) { s32 s32Error = WILC_SUCCESS; @@ -659,9 +656,8 @@ static s32 Handle_SetWfiDrvHandler(tstrHostIfSetDrvHandler *pstrHostIfSetDrvHand s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - if ((pstrHostIfSetDrvHandler->u32Address) == (u32)NULL) { + if ((pstrHostIfSetDrvHandler->u32Address) == (u32)NULL) up(&hSemDeinitDrvHandle); - } if (s32Error) { @@ -685,7 +681,7 @@ static s32 Handle_SetWfiDrvHandler(tstrHostIfSetDrvHandler *pstrHostIfSetDrvHand * @date * @version 1.0 */ -static s32 Handle_SetOperationMode(void *drvHandler, tstrHostIfSetOperationMode *pstrHostIfSetOperationMode) +static s32 Handle_SetOperationMode(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetOperationMode *pstrHostIfSetOperationMode) { s32 s32Error = WILC_SUCCESS; @@ -700,14 +696,13 @@ static s32 Handle_SetOperationMode(void *drvHandler, tstrHostIfSetOperationMode strWID.s32ValueSize = sizeof(u32); /*Sending Cfg*/ - PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p \n", pstrWFIDrv); + PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p\n", pstrWFIDrv); s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - if ((pstrHostIfSetOperationMode->u32Mode) == (u32)NULL) { + if ((pstrHostIfSetOperationMode->u32Mode) == (u32)NULL) up(&hSemDeinitDrvHandle); - } if (s32Error) { @@ -731,7 +726,7 @@ static s32 Handle_SetOperationMode(void *drvHandler, tstrHostIfSetOperationMode * @date * @version 1.0 */ -s32 Handle_set_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) +s32 Handle_set_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) { s32 s32Error = WILC_SUCCESS; @@ -742,9 +737,9 @@ s32 Handle_set_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) if (pu8IPAddr[0] < 192) pu8IPAddr[0] = 0; - PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %d.%d.%d.%d \n", idx, pu8IPAddr[0], pu8IPAddr[1], pu8IPAddr[2], pu8IPAddr[3]); + PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", idx, pu8IPAddr); - WILC_memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); + memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); /*prepare configuration packet*/ strWID.u16WIDid = (u16)WID_IP_ADDRESS; @@ -756,7 +751,7 @@ s32 Handle_set_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) - host_int_get_ipaddress((WILC_WFIDrvHandle)drvHandler, firmwareIPAddress, idx); + host_int_get_ipaddress(drvHandler, firmwareIPAddress, idx); if (s32Error) { PRINT_D(HOSTINF_DBG, "Failed to set IP address\n"); @@ -783,7 +778,7 @@ s32 Handle_set_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) * @date * @version 1.0 */ -s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) +s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) { s32 s32Error = WILC_SUCCESS; @@ -793,27 +788,27 @@ s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) /*prepare configuration packet*/ strWID.u16WIDid = (u16)WID_IP_ADDRESS; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = (u8 *)WILC_MALLOC(IP_ALEN); + strWID.ps8WidVal = WILC_MALLOC(IP_ALEN); strWID.s32ValueSize = IP_ALEN; s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - PRINT_INFO(HOSTINF_DBG, "%d.%d.%d.%d\n", (u8)(strWID.ps8WidVal[0]), (u8)(strWID.ps8WidVal[1]), (u8)(strWID.ps8WidVal[2]), (u8)(strWID.ps8WidVal[3])); + PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.ps8WidVal); - WILC_memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN); + memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN); /*get the value by searching the local copy*/ - WILC_FREE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); - if (WILC_memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) - host_int_setup_ipaddress((WILC_WFIDrvHandle)pstrWFIDrv, gs8SetIP[idx], idx); + if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) + host_int_setup_ipaddress(pstrWFIDrv, gs8SetIP[idx], idx); if (s32Error != WILC_SUCCESS) { PRINT_ER("Failed to get IP address\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); } else { - PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d \n", idx); - PRINT_INFO(HOSTINF_DBG, "%d.%d.%d.%d\n", gs8GetIP[idx][0], gs8GetIP[idx][1], gs8GetIP[idx][2], gs8GetIP[idx][3]); + PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); + PRINT_INFO(HOSTINF_DBG, "%pI4\n", gs8GetIP[idx]); PRINT_INFO(HOSTINF_DBG, "\n"); } @@ -836,18 +831,19 @@ s32 Handle_get_IPAddress(void *drvHandler, u8 *pu8IPAddr, u8 idx) * @date November 2013 * @version 7.0 */ -static s32 Handle_SetMacAddress(void *drvHandler, tstrHostIfSetMacAddress *pstrHostIfSetMacAddress) +static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetMacAddress *pstrHostIfSetMacAddress) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; - u8 *mac_buf = (u8 *)WILC_MALLOC(ETH_ALEN); + u8 *mac_buf = WILC_MALLOC(ETH_ALEN); + if (mac_buf == NULL) { PRINT_ER("No buffer to send mac address\n"); return WILC_FAIL; } - WILC_memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN); + memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN); /*prepare configuration packet*/ strWID.u16WIDid = (u16)WID_MAC_ADDR; @@ -866,7 +862,7 @@ static s32 Handle_SetMacAddress(void *drvHandler, tstrHostIfSetMacAddress *pstrH { } - WILC_FREE(mac_buf); + kfree(mac_buf); return s32Error; } @@ -881,7 +877,7 @@ static s32 Handle_SetMacAddress(void *drvHandler, tstrHostIfSetMacAddress *pstrH * @date JAN 2013 * @version 8.0 */ -static s32 Handle_GetMacAddress(void *drvHandler, tstrHostIfGetMacAddress *pstrHostIfGetMacAddress) +static s32 Handle_GetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfGetMacAddress *pstrHostIfGetMacAddress) { s32 s32Error = WILC_SUCCESS; @@ -918,7 +914,7 @@ static s32 Handle_GetMacAddress(void *drvHandler, tstrHostIfGetMacAddress *pstrH * @date * @version 1.0 */ -static s32 Handle_CfgParam(void *drvHandler, tstrHostIFCfgParamAttr *strHostIFCfgParamAttr) +static s32 Handle_CfgParam(tstrWILC_WFIDrv *drvHandler, tstrHostIFCfgParamAttr *strHostIFCfgParamAttr) { s32 s32Error = WILC_SUCCESS; tstrWID strWIDList[32]; @@ -1204,10 +1200,9 @@ static s32 Handle_CfgParam(void *drvHandler, tstrHostIFCfgParamAttr *strHostIFCf } s32Error = SendConfigPkt(SET_CFG, strWIDList, u8WidCnt, false, (u32)pstrWFIDrv); - if (s32Error) { + if (s32Error) PRINT_ER("Error in setting CFG params\n"); - } WILC_CATCH(s32Error) { } @@ -1228,6 +1223,7 @@ static s32 Handle_CfgParam(void *drvHandler, tstrHostIFCfgParamAttr *strHostIFCf static s32 Handle_wait_msg_q_empty(void) { s32 s32Error = WILC_SUCCESS; + g_wilc_initialized = 0; up(&hWaitResponse); return s32Error; @@ -1242,7 +1238,7 @@ static s32 Handle_wait_msg_q_empty(void) * @date * @version 1.0 */ -static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) +static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) { s32 s32Error = WILC_SUCCESS; tstrWID strWIDList[5]; @@ -1254,7 +1250,7 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); - PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state \n", pstrWFIDrv->enuHostIFstate); + PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", pstrWFIDrv->enuHostIFstate); pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->pfScanResult; pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->pvUserArg; @@ -1284,9 +1280,8 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) strWIDList[u32WidsCount].u16WIDid = (u16)WID_SSID_PROBE_REQ; strWIDList[u32WidsCount].enuWIDtype = WID_STR; - for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) { + for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); - } pu8HdnNtwrksWidVal = WILC_MALLOC(valuesize + 1); strWIDList[u32WidsCount].ps8WidVal = pu8HdnNtwrksWidVal; if (strWIDList[u32WidsCount].ps8WidVal != NULL) { @@ -1298,7 +1293,7 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) { *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; - WILC_memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen); + memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen); pu8Buffer += pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; } @@ -1336,9 +1331,8 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) int i; for (i = 0; i < pstrHostIFscanAttr->u8ChnlListLen; i++) { - if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0) { + if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0) pstrHostIFscanAttr->pu8ChnlFreqList[i] = pstrHostIFscanAttr->pu8ChnlFreqList[i] - 1; - } } } @@ -1356,11 +1350,10 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) /*keep the state as is , no need to change it*/ /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */ - if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) { + if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) gbScanWhileConnected = true; - } else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE) { + else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE) gbScanWhileConnected = false; - } s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (u32)pstrWFIDrv); @@ -1373,36 +1366,35 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) WILC_CATCH(s32Error) { - WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); + del_timer(&pstrWFIDrv->hScanTimer); /*if there is an ongoing scan request*/ Handle_ScanDone(drvHandler, SCAN_EVENT_ABORTED); } /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { - WILC_FREE(pstrHostIFscanAttr->pu8ChnlFreqList); + kfree(pstrHostIFscanAttr->pu8ChnlFreqList); pstrHostIFscanAttr->pu8ChnlFreqList = NULL; } /* Deallocate pstrHostIFscanAttr->pu8IEs which was previously allocated by the sending thread */ if (pstrHostIFscanAttr->pu8IEs != NULL) { - WILC_FREE(pstrHostIFscanAttr->pu8IEs); + kfree(pstrHostIFscanAttr->pu8IEs); pstrHostIFscanAttr->pu8IEs = NULL; } if (pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo != NULL) { - WILC_FREE(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo); + kfree(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo); pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo = NULL; } /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { - WILC_FREE(pstrHostIFscanAttr->pu8ChnlFreqList); + kfree(pstrHostIFscanAttr->pu8ChnlFreqList); pstrHostIFscanAttr->pu8ChnlFreqList = NULL; } - if (pu8HdnNtwrksWidVal != NULL) { - WILC_FREE(pu8HdnNtwrksWidVal); - } + if (pu8HdnNtwrksWidVal != NULL) + kfree(pu8HdnNtwrksWidVal); return s32Error; } @@ -1416,7 +1408,7 @@ static s32 Handle_Scan(void *drvHandler, tstrHostIFscanAttr *pstrHostIFscanAttr) * @date * @version 1.0 */ -static s32 Handle_ScanDone(void *drvHandler, tenuScanEvent enuEvent) +static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent) { s32 s32Error = WILC_SUCCESS; @@ -1476,7 +1468,7 @@ static s32 Handle_ScanDone(void *drvHandler, tenuScanEvent enuEvent) * @version 1.0 */ u8 u8ConnectedSSID[6] = {0}; -static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFconnectAttr) +static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *pstrHostIFconnectAttr) { tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; s32 s32Error = WILC_SUCCESS; @@ -1500,12 +1492,12 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon PRINT_D(GENERIC_DBG, "Handling connect request\n"); #ifndef CONNECT_DIRECT - WILC_memset(gapu8RcvdSurveyResults[0], 0, MAX_SURVEY_RESULT_FRAG_SIZE); - WILC_memset(gapu8RcvdSurveyResults[1], 0, MAX_SURVEY_RESULT_FRAG_SIZE); + memset(gapu8RcvdSurveyResults[0], 0, MAX_SURVEY_RESULT_FRAG_SIZE); + memset(gapu8RcvdSurveyResults[1], 0, MAX_SURVEY_RESULT_FRAG_SIZE); PRINT_D(HOSTINF_DBG, "Getting site survey results\n"); - s32Err = host_int_get_site_survey_results((WILC_WFIDrvHandle)pstrWFIDrv, + s32Err = host_int_get_site_survey_results(pstrWFIDrv, gapu8RcvdSurveyResults, MAX_SURVEY_RESULT_FRAG_SIZE); if (s32Err) { @@ -1521,19 +1513,19 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon /* use the parsed info in pstrSurveyResults, then deallocate it */ PRINT_D(HOSTINF_DBG, "Copying site survey results in global structure, then deallocate\n"); for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { - WILC_memcpy(&pstrWFIDrv->astrSurveyResults[i], &pstrSurveyResults[i], + memcpy(&pstrWFIDrv->astrSurveyResults[i], &pstrSurveyResults[i], sizeof(wid_site_survey_reslts_s)); } DeallocateSurveyResults(pstrSurveyResults); } else { WILC_ERRORREPORT(s32Error, WILC_FAIL); - PRINT_ER("ParseSurveyResults() Error(%d) \n", s32Err); + PRINT_ER("ParseSurveyResults() Error(%d)\n", s32Err); } for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { - if (WILC_memcmp(pstrWFIDrv->astrSurveyResults[i].SSID, + if (memcmp(pstrWFIDrv->astrSurveyResults[i].SSID, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen) == 0) { PRINT_INFO(HOSTINF_DBG, "Network with required SSID is found %s\n", pstrHostIFconnectAttr->pu8ssid); @@ -1546,7 +1538,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon /* BSSID is also passed from the user, so decision of matching * should consider also this passed BSSID */ - if (WILC_memcmp(pstrWFIDrv->astrSurveyResults[i].BSSID, + if (memcmp(pstrWFIDrv->astrSurveyResults[i].BSSID, pstrHostIFconnectAttr->pu8bssid, 6) == 0) { PRINT_INFO(HOSTINF_DBG, "BSSID is passed from the user and matched\n"); @@ -1559,29 +1551,29 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon if (i < pstrWFIDrv->u32SurveyResultsCount) { u8bssDscListIndex = i; - PRINT_INFO(HOSTINF_DBG, "Connecting to network of Bss Idx %d and SSID %s and channel %d \n", + PRINT_INFO(HOSTINF_DBG, "Connecting to network of Bss Idx%d and SSID %s and channel%d\n", u8bssDscListIndex, pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].SSID, pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].Channel); PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); if (pstrHostIFconnectAttr->pu8bssid != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = (u8 *)WILC_MALLOC(6); - WILC_memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); + pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = WILC_MALLOC(6); + memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); } pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; if (pstrHostIFconnectAttr->pu8ssid != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); - WILC_memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, + pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); + memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; } pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; if (pstrHostIFconnectAttr->pu8IEs != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); - WILC_memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, + pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); + memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, pstrHostIFconnectAttr->IEsLen); } @@ -1630,14 +1622,12 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon strWIDList[u32WidsCount].ps8WidVal = (s8 *)&u8bssDscListIndex; u32WidsCount++; - #ifndef SIMULATION /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the * firmware at chip reset when processing the WIDs of the Connect Request. * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ /* ////////////////////// */ gu32WidConnRstHack = 0; /* ////////////////////// */ - #endif s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (u32)pstrWFIDrv); if (s32Error) { @@ -1656,7 +1646,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon /* if we try to connect to an already connected AP then discard the request */ - if (WILC_memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) { + if (memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) { s32Error = WILC_SUCCESS; PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); @@ -1675,22 +1665,22 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon #endif /*WILC_PARSE_SCAN_IN_HOST*/ if (pstrHostIFconnectAttr->pu8bssid != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = (u8 *)WILC_MALLOC(6); - WILC_memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); + pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = WILC_MALLOC(6); + memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); } pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; if (pstrHostIFconnectAttr->pu8ssid != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); - WILC_memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, + pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); + memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; } pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; if (pstrHostIFconnectAttr->pu8IEs != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); - WILC_memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, + pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); + memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, pstrHostIFconnectAttr->IEsLen); } @@ -1728,7 +1718,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon u32WidsCount++; /*BugID_5137*/ - if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { + if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { gu32FlushedInfoElemAsocSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; gu8FlushedInfoElemAsoc = WILC_MALLOC(gu32FlushedInfoElemAsocSize); @@ -1743,7 +1733,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon u32WidsCount++; /*BugID_5137*/ - if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) + if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) gu8Flushed11iMode = pstrWFIDrv->strWILC_UsrConnReq.u8security; PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); @@ -1756,7 +1746,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon u32WidsCount++; /*BugID_5137*/ - if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) + if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) gu8FlushedAuthType = (u8)pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type; PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); @@ -1778,14 +1768,13 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon strWIDList[u32WidsCount].s32ValueSize = MAX_SSID_LEN + 7; strWIDList[u32WidsCount].ps8WidVal = WILC_MALLOC(strWIDList[u32WidsCount].s32ValueSize); - if (strWIDList[u32WidsCount].ps8WidVal == NULL) { + if (strWIDList[u32WidsCount].ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; if (pstrHostIFconnectAttr->pu8ssid != NULL) { - WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); + memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; } pu8CurrByte += MAX_SSID_LEN; @@ -1795,9 +1784,8 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon PRINT_ER("Channel out of range\n"); *(pu8CurrByte++) = 0xFF; } - if (pstrHostIFconnectAttr->pu8bssid != NULL) { - WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); - } + if (pstrHostIFconnectAttr->pu8bssid != NULL) + memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); pu8CurrByte += 6; /* keep the buffer at the start of the allocated pointer to use it with the free*/ @@ -1813,19 +1801,18 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon strWIDList[u32WidsCount].ps8WidVal = WILC_MALLOC(strWIDList[u32WidsCount].s32ValueSize); /*BugID_5137*/ - if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { + if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { gu32FlushedJoinReqSize = strWIDList[u32WidsCount].s32ValueSize; gu8FlushedJoinReq = WILC_MALLOC(gu32FlushedJoinReqSize); } - if (strWIDList[u32WidsCount].ps8WidVal == NULL) { + if (strWIDList[u32WidsCount].ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; if (pstrHostIFconnectAttr->pu8ssid != NULL) { - WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); + memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; } pu8CurrByte += MAX_SSID_LEN; @@ -1845,15 +1832,13 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); /* sa*/ - if (pstrHostIFconnectAttr->pu8bssid != NULL) { - WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); - } + if (pstrHostIFconnectAttr->pu8bssid != NULL) + memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); pu8CurrByte += 6; /* bssid*/ - if (pstrHostIFconnectAttr->pu8bssid != NULL) { - WILC_memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); - } + if (pstrHostIFconnectAttr->pu8bssid != NULL) + memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); pu8CurrByte += 6; /* Beacon Period*/ @@ -1864,7 +1849,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); /* Supported rates*/ - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); + memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); pu8CurrByte += (MAX_RATES_SUPPORTED + 1); /* wmm cap*/ @@ -1888,15 +1873,15 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); /* rsn pcip policy*/ - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); + memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); /* rsn auth policy*/ - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); + memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); /* rsn auth policy*/ - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); + memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); /*BugID_5137*/ @@ -1921,15 +1906,15 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon *(pu8CurrByte++) = ptstrJoinBssParam->u8Count; - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration)); + memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration)); pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration); - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval)); + memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval)); pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval); - WILC_memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime)); + memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime)); pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime); @@ -1945,17 +1930,15 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon #endif /* #ifdef WILC_PARSE_SCAN_IN_HOST*/ u32WidsCount++; - #ifndef SIMULATION /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the * firmware at chip reset when processing the WIDs of the Connect Request. * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ /* ////////////////////// */ gu32WidConnRstHack = 0; /* ////////////////////// */ - #endif /*BugID_5137*/ - if (WILC_memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { + if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize); gu8FlushedJoinReqDrvHandler = (u32)pstrWFIDrv; } @@ -1963,7 +1946,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); if (pstrHostIFconnectAttr->pu8bssid != NULL) { - WILC_memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN); + memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN); PRINT_D(GENERIC_DBG, "save Bssid = %x:%x:%x:%x:%x:%x\n", (pstrHostIFconnectAttr->pu8bssid[0]), (pstrHostIFconnectAttr->pu8bssid[1]), (pstrHostIFconnectAttr->pu8bssid[2]), (pstrHostIFconnectAttr->pu8bssid[3]), (pstrHostIFconnectAttr->pu8bssid[4]), (pstrHostIFconnectAttr->pu8bssid[5])); PRINT_D(GENERIC_DBG, "save bssid = %x:%x:%x:%x:%x:%x\n", (u8ConnectedSSID[0]), (u8ConnectedSSID[1]), (u8ConnectedSSID[2]), (u8ConnectedSSID[3]), (u8ConnectedSSID[4]), (u8ConnectedSSID[5])); @@ -1983,21 +1966,20 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon { tstrConnectInfo strConnectInfo; - WILC_TimerStop(&(pstrWFIDrv->hConnectTimer), NULL); + del_timer(&pstrWFIDrv->hConnectTimer); PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); - WILC_memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); + memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); if (pstrHostIFconnectAttr->pfConnectResult != NULL) { - if (pstrHostIFconnectAttr->pu8bssid != NULL) { - WILC_memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); - } + if (pstrHostIFconnectAttr->pu8bssid != NULL) + memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); if (pstrHostIFconnectAttr->pu8IEs != NULL) { strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; - strConnectInfo.pu8ReqIEs = (u8 *)WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); - WILC_memcpy(strConnectInfo.pu8ReqIEs, + strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); + memcpy(strConnectInfo.pu8ReqIEs, pstrHostIFconnectAttr->pu8IEs, pstrHostIFconnectAttr->IEsLen); } @@ -2011,37 +1993,36 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; /* Deallocation */ if (strConnectInfo.pu8ReqIEs != NULL) { - WILC_FREE(strConnectInfo.pu8ReqIEs); + kfree(strConnectInfo.pu8ReqIEs); strConnectInfo.pu8ReqIEs = NULL; } } else { - PRINT_ER("Connect callback function pointer is NULL \n"); + PRINT_ER("Connect callback function pointer is NULL\n"); } } PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); /* Deallocate pstrHostIFconnectAttr->pu8bssid which was prevoisuly allocated by the sending thread */ if (pstrHostIFconnectAttr->pu8bssid != NULL) { - WILC_FREE(pstrHostIFconnectAttr->pu8bssid); + kfree(pstrHostIFconnectAttr->pu8bssid); pstrHostIFconnectAttr->pu8bssid = NULL; } /* Deallocate pstrHostIFconnectAttr->pu8ssid which was prevoisuly allocated by the sending thread */ if (pstrHostIFconnectAttr->pu8ssid != NULL) { - WILC_FREE(pstrHostIFconnectAttr->pu8ssid); + kfree(pstrHostIFconnectAttr->pu8ssid); pstrHostIFconnectAttr->pu8ssid = NULL; } /* Deallocate pstrHostIFconnectAttr->pu8IEs which was prevoisuly allocated by the sending thread */ if (pstrHostIFconnectAttr->pu8IEs != NULL) { - WILC_FREE(pstrHostIFconnectAttr->pu8IEs); + kfree(pstrHostIFconnectAttr->pu8IEs); pstrHostIFconnectAttr->pu8IEs = NULL; } - if (pu8CurrByte != NULL) { - WILC_FREE(pu8CurrByte); - } + if (pu8CurrByte != NULL) + kfree(pu8CurrByte); return s32Error; } @@ -2056,7 +2037,7 @@ static s32 Handle_Connect(void *drvHandler, tstrHostIFconnectAttr *pstrHostIFcon * @version 8.0 */ -static s32 Handle_FlushConnect(void *drvHandler) +static s32 Handle_FlushConnect(tstrWILC_WFIDrv *drvHandler) { s32 s32Error = WILC_SUCCESS; tstrWID strWIDList[5]; @@ -2123,7 +2104,7 @@ static s32 Handle_FlushConnect(void *drvHandler) * @date * @version 1.0 */ -static s32 Handle_ConnectTimeout(void *drvHandler) +static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) { s32 s32Error = WILC_SUCCESS; tstrConnectInfo strConnectInfo; @@ -2141,7 +2122,7 @@ static s32 Handle_ConnectTimeout(void *drvHandler) gbScanWhileConnected = false; - WILC_memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); + memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); /* First, we will notify the upper layer with the Connection failure {through the Connect Callback function}, @@ -2149,14 +2130,14 @@ static s32 Handle_ConnectTimeout(void *drvHandler) * WID_DISCONNECT} */ if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { - WILC_memcpy(strConnectInfo.au8bssid, + memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); } if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; - strConnectInfo.pu8ReqIEs = (u8 *)WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); - WILC_memcpy(strConnectInfo.pu8ReqIEs, + strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); + memcpy(strConnectInfo.pu8ReqIEs, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); } @@ -2169,11 +2150,11 @@ static s32 Handle_ConnectTimeout(void *drvHandler) /* Deallocation of strConnectInfo.pu8ReqIEs */ if (strConnectInfo.pu8ReqIEs != NULL) { - WILC_FREE(strConnectInfo.pu8ReqIEs); + kfree(strConnectInfo.pu8ReqIEs); strConnectInfo.pu8ReqIEs = NULL; } } else { - PRINT_ER("Connect callback function pointer is NULL \n"); + PRINT_ER("Connect callback function pointer is NULL\n"); } /* Here we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying @@ -2186,37 +2167,36 @@ static s32 Handle_ConnectTimeout(void *drvHandler) PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv); - if (s32Error) { + if (s32Error) PRINT_ER("Failed to send dissconect config packet\n"); - } /* Deallocation of the Saved Connect Request in the global Handle */ pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; } if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; } pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; } - WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); + memset(u8ConnectedSSID, 0, ETH_ALEN); /*BugID_5213*/ /*Freeing flushed join request params on connect timeout*/ if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { - WILC_FREE(gu8FlushedJoinReq); + kfree(gu8FlushedJoinReq); gu8FlushedJoinReq = NULL; } if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { - WILC_FREE(gu8FlushedInfoElemAsoc); + kfree(gu8FlushedInfoElemAsoc); gu8FlushedInfoElemAsoc = NULL; } @@ -2232,7 +2212,7 @@ static s32 Handle_ConnectTimeout(void *drvHandler) * @date * @version 1.0 */ -static s32 Handle_RcvdNtwrkInfo(void *drvHandler, tstrRcvdNetworkInfo *pstrRcvdNetworkInfo) +static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdNetworkInfo *pstrRcvdNetworkInfo) { u32 i; bool bNewNtwrkFound; @@ -2264,7 +2244,7 @@ static s32 Handle_RcvdNtwrkInfo(void *drvHandler, tstrRcvdNetworkInfo *pstrRcvdN if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid != NULL) && (pstrNetworkInfo->au8bssid != NULL)) { - if (WILC_memcmp(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, + if (memcmp(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { if (pstrNetworkInfo->s8rssi <= pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) { /*we have already found this network with better rssi, so keep the old cached one and don't @@ -2294,7 +2274,7 @@ static s32 Handle_RcvdNtwrkInfo(void *drvHandler, tstrRcvdNetworkInfo *pstrRcvdN if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid != NULL) && (pstrNetworkInfo->au8bssid != NULL)) { - WILC_memcpy(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, + memcpy(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, pstrNetworkInfo->au8bssid, 6); pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount++; @@ -2313,7 +2293,7 @@ static s32 Handle_RcvdNtwrkInfo(void *drvHandler, tstrRcvdNetworkInfo *pstrRcvdN } } else { - PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit \n"); + PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); } } else { pstrNetworkInfo->bNewNetwork = false; @@ -2332,7 +2312,7 @@ static s32 Handle_RcvdNtwrkInfo(void *drvHandler, tstrRcvdNetworkInfo *pstrRcvdN done: /* Deallocate pstrRcvdNetworkInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ if (pstrRcvdNetworkInfo->pu8Buffer != NULL) { - WILC_FREE(pstrRcvdNetworkInfo->pu8Buffer); + kfree(pstrRcvdNetworkInfo->pu8Buffer); pstrRcvdNetworkInfo->pu8Buffer = NULL; } @@ -2354,7 +2334,7 @@ done: * @date * @version 1.0 */ -static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pstrRcvdGnrlAsyncInfo) +static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsyncInfo *pstrRcvdGnrlAsyncInfo) { /* TODO: mostafa: till now, this function just handles only the received mac status msg, */ /* which carries only 1 WID which have WID ID = WID_STATUS */ @@ -2371,9 +2351,9 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst tstrDisconnectNotifInfo strDisconnectNotifInfo; s32 s32Err = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; - if (pstrWFIDrv == NULL) { + + if (pstrWFIDrv == NULL) PRINT_ER("Driver handler is NULL\n"); - } PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", pstrWFIDrv->enuHostIFstate, pstrRcvdGnrlAsyncInfo->pu8Buffer[7]); @@ -2417,12 +2397,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); - WILC_memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); + memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); if (u8MacStatus == MAC_CONNECTED) { - WILC_memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); + memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); - host_int_get_assoc_res_info((WILC_WFIDrvHandle)pstrWFIDrv, + host_int_get_assoc_res_info(pstrWFIDrv, gapu8RcvdAssocResp, MAX_ASSOC_RESP_FRAME_SIZE, &u32RcvdAssocRespInfoLen); @@ -2435,7 +2415,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst s32Err = ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen, &pstrConnectRespInfo); if (s32Err) { - PRINT_ER("ParseAssocRespInfo() returned error %d \n", s32Err); + PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); } else { /* use the necessary parsed Info from the Received Association Response */ strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; @@ -2446,8 +2426,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; - strConnectInfo.pu8RespIEs = (u8 *)WILC_MALLOC(pstrConnectRespInfo->u16RespIEsLen); - WILC_memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, + strConnectInfo.pu8RespIEs = WILC_MALLOC(pstrConnectRespInfo->u16RespIEsLen); + memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, pstrConnectRespInfo->u16RespIEsLen); } } @@ -2466,23 +2446,23 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst * So check first the matching between the received mac status and the received status code in Asoc Resp */ if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { - PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE \n"); - WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); + PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n"); + memset(u8ConnectedSSID, 0, ETH_ALEN); } else if (u8MacStatus == MAC_DISCONNECTED) { PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); - WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); + memset(u8ConnectedSSID, 0, ETH_ALEN); } /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */ /* through a structure of type tstrConnectRespInfo */ if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); - WILC_memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); + memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); if ((u8MacStatus == MAC_CONNECTED) && (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { - WILC_memcpy(pstrWFIDrv->au8AssociatedBSSID, + memcpy(pstrWFIDrv->au8AssociatedBSSID, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN); } } @@ -2490,14 +2470,14 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; - strConnectInfo.pu8ReqIEs = (u8 *)WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); - WILC_memcpy(strConnectInfo.pu8ReqIEs, + strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); + memcpy(strConnectInfo.pu8ReqIEs, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); } - WILC_TimerStop(&(pstrWFIDrv->hConnectTimer), NULL); + del_timer(&pstrWFIDrv->hConnectTimer); pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, &strConnectInfo, u8MacStatus, @@ -2512,7 +2492,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP - host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 0, 0); + host_int_set_power_mgmt(pstrWFIDrv, 0, 0); #endif PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); @@ -2521,7 +2501,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); g_obtainingIP = true; - WILC_TimerStart(&hDuringIpTimer, 10000, NULL, NULL); + mod_timer(&hDuringIpTimer, + jiffies + msecs_to_jiffies(10000)); #endif #ifdef WILC_PARSE_SCAN_IN_HOST @@ -2540,30 +2521,30 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /* Deallocation */ if (strConnectInfo.pu8RespIEs != NULL) { - WILC_FREE(strConnectInfo.pu8RespIEs); + kfree(strConnectInfo.pu8RespIEs); strConnectInfo.pu8RespIEs = NULL; } if (strConnectInfo.pu8ReqIEs != NULL) { - WILC_FREE(strConnectInfo.pu8ReqIEs); + kfree(strConnectInfo.pu8ReqIEs); strConnectInfo.pu8ReqIEs = NULL; } pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; } if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; } pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; } @@ -2572,11 +2553,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /* Disassociation or Deauthentication frame has been received */ PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); - WILC_memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); + memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { - PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >> \n\n"); - WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); + PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); + del_timer(&pstrWFIDrv->hScanTimer); Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); } @@ -2588,7 +2569,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP g_obtainingIP = false; - host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 0, 0); + host_int_set_power_mgmt(pstrWFIDrv, 0, 0); #endif pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, @@ -2598,10 +2579,10 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); } else { - PRINT_ER("Connect result callback function is NULL \n"); + PRINT_ER("Connect result callback function is NULL\n"); } - WILC_memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); + memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); /* Deallocation */ @@ -2611,25 +2592,25 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /* * if(strDisconnectNotifInfo.ie != NULL) * { - * WILC_FREE(strDisconnectNotifInfo.ie); + * kfree(strDisconnectNotifInfo.ie); * strDisconnectNotifInfo.ie = NULL; * } */ pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; } if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; } pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; } @@ -2637,11 +2618,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /*Freeing flushed join request params on receiving*/ /*MAC_DISCONNECTED while connected*/ if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { - WILC_FREE(gu8FlushedJoinReq); + kfree(gu8FlushedJoinReq); gu8FlushedJoinReq = NULL; } if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { - WILC_FREE(gu8FlushedInfoElemAsoc); + kfree(gu8FlushedInfoElemAsoc); gu8FlushedInfoElemAsoc = NULL; } @@ -2651,13 +2632,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst } else if ((u8MacStatus == MAC_DISCONNECTED) && (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL)) { PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW while scanning\n"); - PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >> \n\n"); + PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); /*Abort the running scan*/ - WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); - if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { - Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); + del_timer(&pstrWFIDrv->hScanTimer); + if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) + Handle_ScanDone(pstrWFIDrv, SCAN_EVENT_ABORTED); - } } } @@ -2669,7 +2649,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst /* Deallocate pstrRcvdGnrlAsyncInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ if (pstrRcvdGnrlAsyncInfo->pu8Buffer != NULL) { - WILC_FREE(pstrRcvdGnrlAsyncInfo->pu8Buffer); + kfree(pstrRcvdGnrlAsyncInfo->pu8Buffer); pstrRcvdGnrlAsyncInfo->pu8Buffer = NULL; } @@ -2685,7 +2665,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(void *drvHandler, tstrRcvdGnrlAsyncInfo *pst * @date * @version 1.0 */ -static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) +static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -2726,7 +2706,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) strWIDList[2].s32ValueSize = sizeof(char); - pu8keybuf = (u8 *)WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); + pu8keybuf = WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); if (pu8keybuf == NULL) { @@ -2734,11 +2714,11 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) return -1; } - WILC_memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, + memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); - WILC_FREE(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); + kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); strWIDList[3].u16WIDid = (u16)WID_WEP_KEY_VALUE; strWIDList[3].enuWIDtype = WID_STR; @@ -2747,7 +2727,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) s32Error = SendConfigPkt(SET_CFG, strWIDList, 4, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); } @@ -2755,19 +2735,19 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); - pu8keybuf = (u8 *)WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2); + pu8keybuf = WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2); if (pu8keybuf == NULL) { PRINT_ER("No buffer to send Key\n"); return -1; } pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; - WILC_memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, 1); + memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, 1); - WILC_memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, + memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); - WILC_FREE(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); + kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); strWID.u16WIDid = (u16)WID_ADD_WEP_KEY; strWID.enuWIDtype = WID_STR; @@ -2775,7 +2755,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) strWID.s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2; s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); } else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) { PRINT_D(HOSTINF_DBG, "Removing key\n"); @@ -2803,14 +2783,14 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) case WPARxGtk: #ifdef WILC_AP_EXTERNAL_MLME if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { - pu8keybuf = (u8 *)WILC_MALLOC(RX_MIC_KEY_MSG_LEN); + pu8keybuf = WILC_MALLOC(RX_MIC_KEY_MSG_LEN); if (pu8keybuf == NULL) { PRINT_ER("No buffer to send RxGTK Key\n"); ret = -1; goto _WPARxGtk_end_case_; } - WILC_memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); + memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); /*|----------------------------------------------------------------------------| @@ -2821,14 +2801,14 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) if (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq != NULL) - WILC_memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); + memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); - WILC_memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); + memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); - WILC_memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); + memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); - WILC_memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, + memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); /* pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = 0X51; */ strWIDList[0].u16WIDid = (u16)WID_11I_MODE; @@ -2843,7 +2823,7 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); /* ////////////////////////// */ up(&(pstrWFIDrv->hSemTestKeyBlock)); @@ -2854,14 +2834,14 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); - pu8keybuf = (u8 *)WILC_MALLOC(RX_MIC_KEY_MSG_LEN); + pu8keybuf = WILC_MALLOC(RX_MIC_KEY_MSG_LEN); if (pu8keybuf == NULL) { PRINT_ER("No buffer to send RxGTK Key\n"); ret = -1; goto _WPARxGtk_end_case_; } - WILC_memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); + memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); /*|----------------------------------------------------------------------------| @@ -2869,18 +2849,17 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) * |------------|---------|-------|------------|---------------|----------------| | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ - if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) { - WILC_memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); - } else { - PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED \n"); - } + if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) + memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); + else + PRINT_ER("Couldn't handle WPARxGtk while enuHostIFstate is not HOST_IF_CONNECTED\n"); - WILC_memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); + memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); - WILC_memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); + memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); - WILC_memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); - WILC_memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, + memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); + memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); strWID.u16WIDid = (u16)WID_ADD_RX_GTK; @@ -2890,15 +2869,15 @@ static int Handle_Key(void *drvHandler, tstrHostIFkeyAttr *pstrHostIFkeyAttr) s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); /* ////////////////////////// */ up(&(pstrWFIDrv->hSemTestKeyBlock)); /* ///////////////////////// */ } _WPARxGtk_end_case_: - WILC_FREE(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); - WILC_FREE(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq); + kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); + kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq); if (ret == -1) return ret; @@ -2909,7 +2888,7 @@ _WPARxGtk_end_case_: if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { - pu8keybuf = (u8 *)WILC_MALLOC(PTK_KEY_MSG_LEN + 1); + pu8keybuf = WILC_MALLOC(PTK_KEY_MSG_LEN + 1); @@ -2926,12 +2905,12 @@ _WPARxGtk_end_case_: | 6 bytes | 1 byte | 1byte | 16 bytes | 8 bytes | 8 bytes | |-----------------------------------------------------------------------------|*/ - WILC_memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ + memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ - WILC_memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); - WILC_memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); + memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); + memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); /*16 byte TK*/ - WILC_memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, + memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); @@ -2946,7 +2925,7 @@ _WPARxGtk_end_case_: strWIDList[1].s32ValueSize = PTK_KEY_MSG_LEN + 1; s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); /* ////////////////////////// */ up(&(pstrWFIDrv->hSemTestKeyBlock)); @@ -2956,7 +2935,7 @@ _WPARxGtk_end_case_: if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { - pu8keybuf = (u8 *)WILC_MALLOC(PTK_KEY_MSG_LEN); + pu8keybuf = WILC_MALLOC(PTK_KEY_MSG_LEN); @@ -2973,11 +2952,11 @@ _WPARxGtk_end_case_: | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |-----------------------------------------------------------------------------|*/ - WILC_memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ + memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ - WILC_memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); + memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); /*16 byte TK*/ - WILC_memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, + memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); @@ -2987,7 +2966,7 @@ _WPARxGtk_end_case_: strWID.s32ValueSize = PTK_KEY_MSG_LEN; s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); /* ////////////////////////// */ up(&(pstrWFIDrv->hSemTestKeyBlock)); @@ -2995,7 +2974,7 @@ _WPARxGtk_end_case_: } _WPAPtk_end_case_: - WILC_FREE(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); + kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); if (ret == -1) return ret; @@ -3006,7 +2985,7 @@ _WPAPtk_end_case_: PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); - pu8keybuf = (u8 *)WILC_MALLOC((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1); + pu8keybuf = WILC_MALLOC((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1); if (pu8keybuf == NULL) { PRINT_ER("No buffer to send PMKSA Key\n"); return -1; @@ -3016,8 +2995,8 @@ _WPAPtk_end_case_: for (i = 0; i < pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; i++) { - WILC_memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, ETH_ALEN); - WILC_memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, PMKID_LEN); + memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, ETH_ALEN); + memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, PMKID_LEN); } strWID.u16WIDid = (u16)WID_PMKID_INFO; @@ -3027,7 +3006,7 @@ _WPAPtk_end_case_: s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - WILC_FREE(pu8keybuf); + kfree(pu8keybuf); break; } @@ -3048,7 +3027,7 @@ _WPAPtk_end_case_: * @date * @version 1.0 */ -static void Handle_Disconnect(void *drvHandler) +static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) { tstrWID strWID; @@ -3069,10 +3048,10 @@ static void Handle_Disconnect(void *drvHandler) #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP g_obtainingIP = false; - host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 0, 0); + host_int_set_power_mgmt(pstrWFIDrv, 0, 0); #endif - WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); + memset(u8ConnectedSSID, 0, ETH_ALEN); s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv); @@ -3082,14 +3061,14 @@ static void Handle_Disconnect(void *drvHandler) } else { tstrDisconnectNotifInfo strDisconnectNotifInfo; - WILC_memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); + memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); strDisconnectNotifInfo.u16reason = 0; strDisconnectNotifInfo.ie = NULL; strDisconnectNotifInfo.ie_len = 0; if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { - WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); + del_timer(&pstrWFIDrv->hScanTimer); pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); @@ -3102,48 +3081,48 @@ static void Handle_Disconnect(void *drvHandler) /*Stop connect timer, if connection in progress*/ if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); - WILC_TimerStop(&(pstrWFIDrv->hConnectTimer), NULL); + del_timer(&pstrWFIDrv->hConnectTimer); } pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, 0, &strDisconnectNotifInfo, pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); } else { - PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL \n"); + PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n"); } gbScanWhileConnected = false; pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; - WILC_memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); + memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); /* Deallocation */ pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; } if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; } pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { - WILC_FREE(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); + kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; } /*BugID_5137*/ if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { - WILC_FREE(gu8FlushedJoinReq); + kfree(gu8FlushedJoinReq); gu8FlushedJoinReq = NULL; } if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) { - WILC_FREE(gu8FlushedInfoElemAsoc); + kfree(gu8FlushedInfoElemAsoc); gu8FlushedInfoElemAsoc = NULL; } @@ -3161,7 +3140,7 @@ static void Handle_Disconnect(void *drvHandler) } -void resolve_disconnect_aberration(void *drvHandler) +void resolve_disconnect_aberration(tstrWILC_WFIDrv *drvHandler) { tstrWILC_WFIDrv *pstrWFIDrv; @@ -3170,10 +3149,10 @@ void resolve_disconnect_aberration(void *drvHandler) return; if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTING)) { PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); - host_int_disconnect((WILC_WFIDrvHandle)pstrWFIDrv, 1); + host_int_disconnect(pstrWFIDrv, 1); } } -static s32 Switch_Log_Terminal(void *drvHandler) +static s32 Switch_Log_Terminal(tstrWILC_WFIDrv *drvHandler) { @@ -3194,7 +3173,7 @@ static s32 Switch_Log_Terminal(void *drvHandler) PRINT_D(HOSTINF_DBG, "Failed to switch log terminal\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE); } else { - PRINT_INFO(HOSTINF_DBG, "MAC address set :: \n"); + PRINT_INFO(HOSTINF_DBG, "MAC address set ::\n"); } @@ -3217,13 +3196,14 @@ static s32 Switch_Log_Terminal(void *drvHandler) * @date * @version 1.0 */ -static s32 Handle_GetChnl(void *drvHandler) +static s32 Handle_GetChnl(tstrWILC_WFIDrv *drvHandler) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; + strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; strWID.enuWIDtype = WID_CHAR; strWID.ps8WidVal = (s8 *)&gu8Chnl; @@ -3261,7 +3241,7 @@ static s32 Handle_GetChnl(void *drvHandler) * @date * @version 1.0 */ -static void Handle_GetRssi(void *drvHandler) +static void Handle_GetRssi(tstrWILC_WFIDrv *drvHandler) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3291,7 +3271,7 @@ static void Handle_GetRssi(void *drvHandler) } -static void Handle_GetLinkspeed(void *drvHandler) +static void Handle_GetLinkspeed(tstrWILC_WFIDrv *drvHandler) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3321,7 +3301,7 @@ static void Handle_GetLinkspeed(void *drvHandler) } -s32 Handle_GetStatistics(void *drvHandler, tstrStatistics *pstrStatistics) +s32 Handle_GetStatistics(tstrWILC_WFIDrv *drvHandler, tstrStatistics *pstrStatistics) { tstrWID strWIDList[5]; uint32_t u32WidsCount = 0, s32Error = 0; @@ -3382,7 +3362,7 @@ s32 Handle_GetStatistics(void *drvHandler, tstrStatistics *pstrStatistics) * @date * @version 1.0 */ -static s32 Handle_Get_InActiveTime(void *drvHandler, tstrHostIfStaInactiveT *strHostIfStaInactiveT) +static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, tstrHostIfStaInactiveT *strHostIfStaInactiveT) { s32 s32Error = WILC_SUCCESS; @@ -3394,11 +3374,11 @@ static s32 Handle_Get_InActiveTime(void *drvHandler, tstrHostIfStaInactiveT *str strWID.u16WIDid = (u16)WID_SET_STA_MAC_INACTIVE_TIME; strWID.enuWIDtype = WID_STR; strWID.s32ValueSize = ETH_ALEN; - strWID.ps8WidVal = (u8 *)WILC_MALLOC(strWID.s32ValueSize); + strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); stamac = strWID.ps8WidVal; - WILC_memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); + memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); @@ -3451,21 +3431,21 @@ static s32 Handle_Get_InActiveTime(void *drvHandler, tstrHostIfStaInactiveT *str * @date * @version 1.0 */ -static void Handle_AddBeacon(void *drvHandler, tstrHostIFSetBeacon *pstrSetBeaconParam) +static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetBeacon *pstrSetBeaconParam) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; u8 *pu8CurrByte; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; + PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); strWID.u16WIDid = (u16)WID_ADD_BEACON; strWID.enuWIDtype = WID_BIN; strWID.s32ValueSize = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16; strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; *pu8CurrByte++ = (pstrSetBeaconParam->u32Interval & 0xFF); @@ -3508,9 +3488,9 @@ static void Handle_AddBeacon(void *drvHandler, tstrHostIFSetBeacon *pstrSetBeaco WILC_CATCH(s32Error) { } - WILC_FREE_IF_TRUE(strWID.ps8WidVal); - WILC_FREE_IF_TRUE(pstrSetBeaconParam->pu8Head); - WILC_FREE_IF_TRUE(pstrSetBeaconParam->pu8Tail); + kfree(strWID.ps8WidVal); + kfree(pstrSetBeaconParam->pu8Head); + kfree(pstrSetBeaconParam->pu8Tail); } @@ -3523,20 +3503,20 @@ static void Handle_AddBeacon(void *drvHandler, tstrHostIFSetBeacon *pstrSetBeaco * @date * @version 1.0 */ -static void Handle_DelBeacon(void *drvHandler, tstrHostIFDelBeacon *pstrDelBeacon) +static void Handle_DelBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelBeacon *pstrDelBeacon) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; u8 *pu8CurrByte; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; + strWID.u16WIDid = (u16)WID_DEL_BEACON; strWID.enuWIDtype = WID_CHAR; strWID.s32ValueSize = sizeof(char); strWID.ps8WidVal = &gu8DelBcn; - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; @@ -3573,16 +3553,15 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrSta pu8CurrByte = pu8Buffer; PRINT_D(HOSTINF_DBG, "Packing STA params\n"); - WILC_memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); + memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); pu8CurrByte += ETH_ALEN; *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; *pu8CurrByte++ = pstrStationParam->u8NumRates; - if (pstrStationParam->u8NumRates > 0) { - WILC_memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); - } + if (pstrStationParam->u8NumRates > 0) + memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); pu8CurrByte += pstrStationParam->u8NumRates; *pu8CurrByte++ = pstrStationParam->bIsHTSupported; @@ -3590,7 +3569,7 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrSta *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; *pu8CurrByte++ = pstrStationParam->u8AmpduParams; - WILC_memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); + memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; @@ -3621,21 +3600,21 @@ static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrSta * @date * @version 1.0 */ -static void Handle_AddStation(void *drvHandler, tstrWILC_AddStaParam *pstrStationParam) +static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; u8 *pu8CurrByte; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; + PRINT_D(HOSTINF_DBG, "Handling add station\n"); strWID.u16WIDid = (u16)WID_ADD_STA; strWID.enuWIDtype = WID_BIN; strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); @@ -3651,8 +3630,8 @@ static void Handle_AddStation(void *drvHandler, tstrWILC_AddStaParam *pstrStatio WILC_CATCH(s32Error) { } - WILC_FREE_IF_TRUE(pstrStationParam->pu8Rates); - WILC_FREE_IF_TRUE(strWID.ps8WidVal); + kfree(pstrStationParam->pu8Rates); + kfree(strWID.ps8WidVal); } /** @@ -3664,24 +3643,25 @@ static void Handle_AddStation(void *drvHandler, tstrWILC_AddStaParam *pstrStatio * @date * @version 1.0 */ -static void Handle_DelAllSta(void *drvHandler, tstrHostIFDelAllSta *pstrDelAllStaParam) +static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelAllSta *pstrDelAllStaParam) { s32 s32Error = WILC_SUCCESS; + tstrWID strWID; u8 *pu8CurrByte; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; u8 i; u8 au8Zero_Buff[6] = {0}; + strWID.u16WIDid = (u16)WID_DEL_ALL_STA; strWID.enuWIDtype = WID_STR; strWID.s32ValueSize = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1; - PRINT_D(HOSTINF_DBG, "Handling delete station \n"); + PRINT_D(HOSTINF_DBG, "Handling delete station\n"); strWID.ps8WidVal = WILC_MALLOC((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; @@ -3689,7 +3669,7 @@ static void Handle_DelAllSta(void *drvHandler, tstrHostIFDelAllSta *pstrDelAllSt for (i = 0; i < MAX_NUM_STA; i++) { if (memcmp(pstrDelAllStaParam->au8Sta_DelAllSta[i], au8Zero_Buff, ETH_ALEN)) - WILC_memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN); + memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN); else continue; @@ -3700,14 +3680,14 @@ static void Handle_DelAllSta(void *drvHandler, tstrHostIFDelAllSta *pstrDelAllSt s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); if (s32Error) { - PRINT_ER("Failed to send add station config packe\n"); + PRINT_ER("Failed to send add station config packet\n"); WILC_ERRORREPORT(s32Error, WILC_FAIL); } WILC_CATCH(s32Error) { } - WILC_FREE_IF_TRUE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); up(&hWaitResponse); } @@ -3722,7 +3702,7 @@ static void Handle_DelAllSta(void *drvHandler, tstrHostIFDelAllSta *pstrDelAllSt * @date * @version 1.0 */ -static void Handle_DelStation(void *drvHandler, tstrHostIFDelSta *pstrDelStaParam) +static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelSta *pstrDelStaParam) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3733,29 +3713,28 @@ static void Handle_DelStation(void *drvHandler, tstrHostIFDelSta *pstrDelStaPara strWID.enuWIDtype = WID_BIN; strWID.s32ValueSize = ETH_ALEN; - PRINT_D(HOSTINF_DBG, "Handling delete station \n"); + PRINT_D(HOSTINF_DBG, "Handling delete station\n"); strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; - WILC_memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN); + memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN); /*Sending Cfg*/ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv); if (s32Error) { - PRINT_ER("Failed to send add station config packe\n"); + PRINT_ER("Failed to send add station config packet\n"); WILC_ERRORREPORT(s32Error, WILC_FAIL); } WILC_CATCH(s32Error) { } - WILC_FREE_IF_TRUE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); } @@ -3768,7 +3747,7 @@ static void Handle_DelStation(void *drvHandler, tstrHostIFDelSta *pstrDelStaPara * @date * @version 1.0 */ -static void Handle_EditStation(void *drvHandler, tstrWILC_AddStaParam *pstrStationParam) +static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3781,9 +3760,8 @@ static void Handle_EditStation(void *drvHandler, tstrWILC_AddStaParam *pstrStati PRINT_D(HOSTINF_DBG, "Handling edit station\n"); strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); @@ -3799,8 +3777,8 @@ static void Handle_EditStation(void *drvHandler, tstrWILC_AddStaParam *pstrStati WILC_CATCH(s32Error) { } - WILC_FREE_IF_TRUE(pstrStationParam->pu8Rates); - WILC_FREE_IF_TRUE(strWID.ps8WidVal); + kfree(pstrStationParam->pu8Rates); + kfree(strWID.ps8WidVal); } #endif /*WILC_AP_EXTERNAL_MLME*/ @@ -3814,7 +3792,7 @@ static void Handle_EditStation(void *drvHandler, tstrWILC_AddStaParam *pstrStati * @date * @version 1.0 */ -static int Handle_RemainOnChan(void *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) +static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) { s32 s32Error = WILC_SUCCESS; u8 u8remain_on_chan_flag; @@ -3856,30 +3834,30 @@ static int Handle_RemainOnChan(void *drvHandler, tstrHostIfRemainOnChan *pstrHos strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; strWID.enuWIDtype = WID_STR; strWID.s32ValueSize = 2; - strWID.ps8WidVal = (s8 *)WILC_MALLOC(strWID.s32ValueSize); + strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } strWID.ps8WidVal[0] = u8remain_on_chan_flag; strWID.ps8WidVal[1] = (s8)pstrHostIfRemainOnChan->u16Channel; /*Sending Cfg*/ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); - if (s32Error != WILC_SUCCESS) { + if (s32Error != WILC_SUCCESS) PRINT_ER("Failed to set remain on channel\n"); - } WILC_CATCH(-1) { P2P_LISTEN_STATE = 1; - WILC_TimerStart(&(pstrWFIDrv->hRemainOnChannel), pstrHostIfRemainOnChan->u32duration, (void *)pstrWFIDrv, NULL); + pstrWFIDrv->hRemainOnChannel.data = (unsigned long)pstrWFIDrv; + mod_timer(&pstrWFIDrv->hRemainOnChannel, + jiffies + + msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); /*Calling CFG ready_on_channel*/ - if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) { + if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady(pstrWFIDrv->strHostIfRemainOnChan.pVoid); - } if (pstrWFIDrv->u8RemainOnChan_pendingreq) pstrWFIDrv->u8RemainOnChan_pendingreq = 0; @@ -3896,7 +3874,7 @@ static int Handle_RemainOnChan(void *drvHandler, tstrHostIfRemainOnChan *pstrHos * @date * @version 1.0 */ -static int Handle_RegisterFrame(void *drvHandler, tstrHostIfRegisterFrame *pstrHostIfRegisterFrame) +static int Handle_RegisterFrame(tstrWILC_WFIDrv *drvHandler, tstrHostIfRegisterFrame *pstrHostIfRegisterFrame) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -3909,15 +3887,14 @@ static int Handle_RegisterFrame(void *drvHandler, tstrHostIfRegisterFrame *pstrH strWID.u16WIDid = (u16)WID_REGISTER_FRAME; strWID.enuWIDtype = WID_STR; strWID.ps8WidVal = WILC_MALLOC(sizeof(u16) + 2); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; - WILC_memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16)); + memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16)); strWID.s32ValueSize = sizeof(u16) + 2; @@ -3949,7 +3926,7 @@ static int Handle_RegisterFrame(void *drvHandler, tstrHostIfRegisterFrame *pstrH * @version 1.0 */ #define FALSE_FRMWR_CHANNEL 100 -static u32 Handle_ListenStateExpired(void *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) +static u32 Handle_ListenStateExpired(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) { u8 u8remain_on_chan_flag; tstrWID strWID; @@ -3968,9 +3945,8 @@ static u32 Handle_ListenStateExpired(void *drvHandler, tstrHostIfRemainOnChan *p strWID.s32ValueSize = 2; strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) PRINT_ER("Failed to allocate memory\n"); - } strWID.ps8WidVal[0] = u8remain_on_chan_flag; strWID.ps8WidVal[1] = FALSE_FRMWR_CHANNEL; @@ -4006,25 +3982,24 @@ _done_: * @date * @version 1.0 */ -static void ListenTimerCB(void *pvArg) +static void ListenTimerCB(unsigned long arg) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; - tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)pvArg; + tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; /*Stopping remain-on-channel timer*/ - WILC_TimerStop(&(pstrWFIDrv->hRemainOnChannel), NULL); + del_timer(&pstrWFIDrv->hRemainOnChannel); /* prepare the Timer Callback message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_LISTEN_TIMER_FIRED; strHostIFmsg.drvHandler = pstrWFIDrv; strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -4042,19 +4017,19 @@ static void ListenTimerCB(void *pvArg) * @date * @version 1.0 */ -static void Handle_PowerManagement(void *drvHandler, tstrHostIfPowerMgmtParam *strPowerMgmtParam) +static void Handle_PowerManagement(tstrWILC_WFIDrv *drvHandler, tstrHostIfPowerMgmtParam *strPowerMgmtParam) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; s8 s8PowerMode; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; + strWID.u16WIDid = (u16)WID_POWER_MANAGEMENT; - if (strPowerMgmtParam->bIsEnabled == true) { + if (strPowerMgmtParam->bIsEnabled == true) s8PowerMode = MIN_FAST_PS; - } else { + else s8PowerMode = NO_POWERSAVE; - } PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); strWID.ps8WidVal = &s8PowerMode; strWID.s32ValueSize = sizeof(char); @@ -4083,7 +4058,7 @@ static void Handle_PowerManagement(void *drvHandler, tstrHostIfPowerMgmtParam *s * @date * @version 1.0 */ -static void Handle_SetMulticastFilter(void *drvHandler, tstrHostIFSetMulti *strHostIfSetMulti) +static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetMulti *strHostIfSetMulti) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -4095,9 +4070,8 @@ static void Handle_SetMulticastFilter(void *drvHandler, tstrHostIFSetMulti *strH strWID.enuWIDtype = WID_BIN; strWID.s32ValueSize = sizeof(tstrHostIFSetMulti) + ((strHostIfSetMulti->u32count) * ETH_ALEN); strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); - if (strWID.ps8WidVal == NULL) { + if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } pu8CurrByte = strWID.ps8WidVal; *pu8CurrByte++ = (strHostIfSetMulti->bIsEnabled & 0xFF); @@ -4123,7 +4097,7 @@ static void Handle_SetMulticastFilter(void *drvHandler, tstrHostIFSetMulti *strH WILC_CATCH(s32Error) { } - WILC_FREE_IF_TRUE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); } @@ -4138,7 +4112,7 @@ static void Handle_SetMulticastFilter(void *drvHandler, tstrHostIFSetMulti *strH * @date Feb. 2014 * @version 9.0 */ -static s32 Handle_AddBASession(void *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) +static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -4146,7 +4120,7 @@ static s32 Handle_AddBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos char *ptr = NULL; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; - PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x \nTID=%d \nBufferSize == %d \nSessionTimeOut = %d\n", + PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n", strHostIfBASessionInfo->au8Bssid[0], strHostIfBASessionInfo->au8Bssid[1], strHostIfBASessionInfo->au8Bssid[2], @@ -4156,14 +4130,14 @@ static s32 Handle_AddBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = (u8 *)WILC_MALLOC(BLOCK_ACK_REQ_SIZE); + strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE); strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; ptr = strWID.ps8WidVal; /* *ptr++ = 0x14; */ *ptr++ = 0x14; *ptr++ = 0x3; *ptr++ = 0x0; - WILC_memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); ptr += ETH_ALEN; *ptr++ = strHostIfBASessionInfo->u8Ted; /* BA Policy*/ @@ -4195,7 +4169,7 @@ static s32 Handle_AddBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos *ptr++ = 15; *ptr++ = 7; *ptr++ = 0x2; - WILC_memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); ptr += ETH_ALEN; /* TID*/ *ptr++ = strHostIfBASessionInfo->u8Ted; @@ -4209,7 +4183,7 @@ static s32 Handle_AddBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); if (strWID.ps8WidVal != NULL) - WILC_FREE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); return s32Error; @@ -4226,14 +4200,14 @@ static s32 Handle_AddBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos * @date Feb. 2013 * @version 9.0 */ -static s32 Handle_DelBASession(void *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) +static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; char *ptr = NULL; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; - PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x \nTID=%d\n", + PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", strHostIfBASessionInfo->au8Bssid[0], strHostIfBASessionInfo->au8Bssid[1], strHostIfBASessionInfo->au8Bssid[2], @@ -4241,14 +4215,14 @@ static s32 Handle_DelBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = (u8 *)WILC_MALLOC(BLOCK_ACK_REQ_SIZE); + strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE); strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; ptr = strWID.ps8WidVal; /* *ptr++ = 0x14; */ *ptr++ = 0x14; *ptr++ = 0x3; *ptr++ = 0x2; - WILC_memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); ptr += ETH_ALEN; *ptr++ = strHostIfBASessionInfo->u8Ted; /* BA direction = recipent*/ @@ -4269,7 +4243,7 @@ static s32 Handle_DelBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos *ptr++ = 15; *ptr++ = 7; *ptr++ = 0x3; - WILC_memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); ptr += ETH_ALEN; /* TID*/ *ptr++ = strHostIfBASessionInfo->u8Ted; @@ -4277,7 +4251,7 @@ static s32 Handle_DelBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv); if (strWID.ps8WidVal != NULL) - WILC_FREE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); /*BugID_5222*/ up(&hWaitResponse); @@ -4296,14 +4270,14 @@ static s32 Handle_DelBASession(void *drvHandler, tstrHostIfBASessionInfo *strHos * @date Feb. 2013 * @version 9.0 */ -static s32 Handle_DelAllRxBASessions(void *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) +static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; char *ptr = NULL; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; - PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x \nTID=%d\n", + PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", strHostIfBASessionInfo->au8Bssid[0], strHostIfBASessionInfo->au8Bssid[1], strHostIfBASessionInfo->au8Bssid[2], @@ -4311,13 +4285,13 @@ static s32 Handle_DelAllRxBASessions(void *drvHandler, tstrHostIfBASessionInfo * strWID.u16WIDid = (u16)WID_DEL_ALL_RX_BA; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = (u8 *)WILC_MALLOC(BLOCK_ACK_REQ_SIZE); + strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE); strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; ptr = strWID.ps8WidVal; *ptr++ = 0x14; *ptr++ = 0x3; *ptr++ = 0x2; - WILC_memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); + memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); ptr += ETH_ALEN; *ptr++ = strHostIfBASessionInfo->u8Ted; /* BA direction = recipent*/ @@ -4331,7 +4305,7 @@ static s32 Handle_DelAllRxBASessions(void *drvHandler, tstrHostIfBASessionInfo * if (strWID.ps8WidVal != NULL) - WILC_FREE(strWID.ps8WidVal); + kfree(strWID.ps8WidVal); /*BugID_5222*/ up(&hWaitResponse); @@ -4355,10 +4329,10 @@ static int hostIFthread(void *pvArg) tstrHostIFmsg strHostIFmsg; tstrWILC_WFIDrv *pstrWFIDrv; - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); while (1) { - WILC_MsgQueueRecv(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), &u32Ret, NULL); + WILC_MsgQueueRecv(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), &u32Ret); pstrWFIDrv = (tstrWILC_WFIDrv *)strHostIFmsg.drvHandler; if (strHostIFmsg.u16MsgId == HOST_IF_MSG_EXIT) { PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); @@ -4369,15 +4343,15 @@ static int hostIFthread(void *pvArg) /*Re-Queue HIF message*/ if ((!g_wilc_initialized)) { PRINT_D(GENERIC_DBG, "--WAIT--"); - WILC_Sleep(200); - WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + usleep_range(200 * 1000, 200 * 1000); + WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); continue; } if (strHostIFmsg.u16MsgId == HOST_IF_MSG_CONNECT && pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); - WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - WILC_Sleep(2); + WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + usleep_range(2 * 1000, 2 * 1000); continue; } @@ -4425,14 +4399,13 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_RCVD_SCAN_COMPLETE: - WILC_TimerStop(&(pstrWFIDrv->hScanTimer), NULL); + del_timer(&pstrWFIDrv->hScanTimer); PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); /*BugID_5213*/ /*Allow chip sleep, only if both interfaces are not connected*/ - if (!linux_wlan_get_num_conn_ifcs()) { + if (!linux_wlan_get_num_conn_ifcs()) chip_sleep_manually(INFINITE_SLEEP_TIME); - } Handle_ScanDone(strHostIFmsg.drvHandler, SCAN_EVENT_DONE); @@ -4492,7 +4465,7 @@ static int hostIFthread(void *pvArg) break; case HOST_IF_MSG_CONNECT_TIMER_FIRED: - PRINT_D(HOSTINF_DBG, "Connect Timeout \n"); + PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); Handle_ConnectTimeout(strHostIFmsg.drvHandler); break; @@ -4563,7 +4536,7 @@ static int hostIFthread(void *pvArg) break; default: - PRINT_ER("[Host Interface] undefined Received Msg ID \n"); + PRINT_ER("[Host Interface] undefined Received Msg ID\n"); break; } } @@ -4573,30 +4546,32 @@ static int hostIFthread(void *pvArg) return 0; } -static void TimerCB_Scan(void *pvArg) +static void TimerCB_Scan(unsigned long arg) { + void *pvArg = (void *)arg; tstrHostIFmsg strHostIFmsg; /* prepare the Timer Callback message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.drvHandler = pvArg; strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN_TIMER_FIRED; /* send the message */ - WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); } -static void TimerCB_Connect(void *pvArg) +static void TimerCB_Connect(unsigned long arg) { + void *pvArg = (void *)arg; tstrHostIFmsg strHostIFmsg; /* prepare the Timer Callback message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.drvHandler = pvArg; strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT_TIMER_FIRED; /* send the message */ - WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); } @@ -4613,7 +4588,7 @@ static void TimerCB_Connect(void *pvArg) * @version 1.0 */ /* Check implementation in core adding 9 bytes to the input! */ -s32 host_int_remove_key(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8StaAddress) +s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -4642,19 +4617,18 @@ s32 host_int_remove_key(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8StaAddress) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv, u8 u8keyIdx) +s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8keyIdx) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Remove Wep Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; @@ -4668,9 +4642,9 @@ s32 host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv, u8 u8keyIdx) uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8keyIdx; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) - PRINT_ER("Error in sending message queue : Request to remove WEP key \n"); + PRINT_ER("Error in sending message queue : Request to remove WEP key\n"); down(&(pstrWFIDrv->hSemTestKeyBlock)); WILC_CATCH(s32Error) @@ -4692,19 +4666,18 @@ s32 host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv, u8 u8keyIdx) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_WEPDefaultKeyID(WILC_WFIDrvHandle hWFIDrv, u8 u8Index) +s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; @@ -4717,7 +4690,7 @@ s32 host_int_set_WEPDefaultKeyID(WILC_WFIDrvHandle hWFIDrv, u8 u8Index) uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Index; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue : Default key index\n"); down(&(pstrWFIDrv->hSemTestKeyBlock)); @@ -4749,20 +4722,19 @@ s32 host_int_set_WEPDefaultKeyID(WILC_WFIDrvHandle hWFIDrv, u8 u8Index) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx) +s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; @@ -4772,9 +4744,9 @@ s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = (u8 *)WILC_MALLOC(u8WepKeylen); + uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = WILC_MALLOC(u8WepKeylen); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, pu8WepKey, u8WepKeylen); @@ -4785,7 +4757,7 @@ s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue :WEP Key\n"); down(&(pstrWFIDrv->hSemTestKeyBlock)); @@ -4815,7 +4787,7 @@ s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, * @date 28 FEB 2013 * @version 1.0 */ -s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, AUTHTYPE_T tenuAuth_type) +s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, AUTHTYPE_T tenuAuth_type) { s32 s32Error = WILC_SUCCESS; @@ -4823,13 +4795,12 @@ s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, tstrHostIFmsg strHostIFmsg; u8 i; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); if (INFO) { for (i = 0; i < u8WepKeylen; i++) @@ -4842,10 +4813,10 @@ s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = (u8 *)WILC_MALLOC((u8WepKeylen)); + uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = WILC_MALLOC((u8WepKeylen)); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, pu8WepKey, (u8WepKeylen)); @@ -4861,7 +4832,7 @@ s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type = tenuAuth_type; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue :WEP Key\n"); @@ -4891,7 +4862,7 @@ s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, +s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx) { s32 s32Error = WILC_SUCCESS; @@ -4899,18 +4870,16 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen tstrHostIFmsg strHostIFmsg; u8 u8KeyLen = u8PtkKeylen; u32 i; - if (pstrWFIDrv == NULL) { + + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } - if (pu8RxMic != NULL) { + if (pu8RxMic != NULL) u8KeyLen += RX_MIC_KEY_LEN; - } - if (pu8TxMic != NULL) { + if (pu8TxMic != NULL) u8KeyLen += TX_MIC_KEY_LEN; - } /* prepare the Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; @@ -4927,15 +4896,15 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = (u8 *)WILC_MALLOC(u8PtkKeylen); + uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = WILC_MALLOC(u8PtkKeylen); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pu8Ptk, u8PtkKeylen); if (pu8RxMic != NULL) { - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, pu8RxMic, RX_MIC_KEY_LEN); if (INFO) { for (i = 0; i < RX_MIC_KEY_LEN; i++) @@ -4944,7 +4913,7 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen } if (pu8TxMic != NULL) { - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, pu8TxMic, TX_MIC_KEY_LEN); if (INFO) { for (i = 0; i < TX_MIC_KEY_LEN; i++) @@ -4962,14 +4931,13 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue: PTK Key\n"); /* ////////////// */ down(&(pstrWFIDrv->hSemTestKeyBlock)); - /* WILC_Sleep(100); */ /* /////// */ WILC_CATCH(s32Error) @@ -4993,7 +4961,7 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, +s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) { @@ -5002,24 +4970,21 @@ s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkK tstrHostIFmsg strHostIFmsg; u8 u8KeyLen = u8GtkKeylen; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); - if (pu8RxMic != NULL) { + if (pu8RxMic != NULL) u8KeyLen += RX_MIC_KEY_LEN; - } - if (pu8TxMic != NULL) { + if (pu8TxMic != NULL) u8KeyLen += TX_MIC_KEY_LEN; - } if (KeyRSC != NULL) { strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = (u8 *)WILC_MALLOC(u32KeyRSClen); + uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = WILC_MALLOC(u32KeyRSClen); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, KeyRSC, u32KeyRSClen); } @@ -5039,20 +5004,20 @@ s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkK strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = (u8 *)WILC_MALLOC(u8KeyLen); + uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = WILC_MALLOC(u8KeyLen); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pu8RxGtk, u8GtkKeylen); if (pu8RxMic != NULL) { - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, pu8RxMic, RX_MIC_KEY_LEN); } if (pu8TxMic != NULL) { - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, pu8TxMic, TX_MIC_KEY_LEN); } @@ -5068,12 +5033,11 @@ s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkK /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Error in sending message queue: RX GTK\n"); /* ////////////// */ down(&(pstrWFIDrv->hSemTestKeyBlock)); - /* WILC_Sleep(100); */ /* /////// */ WILC_CATCH(s32Error) @@ -5103,7 +5067,7 @@ s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkK * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray) +s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -5111,12 +5075,11 @@ s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8P u32 i; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Key Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_KEY; strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.enuKeyType = PMKSA; @@ -5125,15 +5088,15 @@ s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8P for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, &pu8PmkidInfoArray->pmkidlist[i].bssid, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, &pu8PmkidInfoArray->pmkidlist[i].bssid, ETH_ALEN); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, &pu8PmkidInfoArray->pmkidlist[i].pmkid, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, &pu8PmkidInfoArray->pmkidlist[i].pmkid, PMKID_LEN); } /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); @@ -5166,7 +5129,7 @@ s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8P * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_pmkid_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PmkidInfoArray, +s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray, u32 u32PmkidInfoLen) { s32 s32Error = WILC_SUCCESS; @@ -5195,14 +5158,12 @@ s32 host_int_get_pmkid_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PmkidInfoArray, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PassPhrase, +s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, u8 u8Psklength) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; - /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ - /* u8 u8Psklength = WILC_strlen(pu8PassPhrase); */ /*validating psk length*/ if ((u8Psklength > 7) && (u8Psklength < 65)) { strWID.u16WIDid = (u16)WID_11I_PSK; @@ -5224,20 +5185,20 @@ s32 host_int_set_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PassP * @date 19 April 2012 * @version 1.0 */ -s32 host_int_get_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress) +s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; /* prepare the Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_MAC_ADDRESS; strHostIFmsg.uniHostIFmsgBody.strHostIfGetMacAddress.u8MacAddress = pu8MacAddress; strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send get mac address\n"); return WILC_FAIL; @@ -5258,7 +5219,7 @@ s32 host_int_get_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress) * @date 16 July 2012 * @version 1.0 */ -s32 host_int_set_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress) +s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; @@ -5266,12 +5227,12 @@ s32 host_int_set_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress) PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); /* prepare setting mac address message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_MAC_ADDRESS; - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress.u8MacAddress, pu8MacAddress, ETH_ALEN); + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfSetMacAddress.u8MacAddress, pu8MacAddress, ETH_ALEN); strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send message queue: Set mac address\n"); WILC_ERRORREPORT(s32Error, s32Error); @@ -5299,7 +5260,7 @@ s32 host_int_set_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, +s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, u8 u8Psklength) { s32 s32Error = WILC_SUCCESS; @@ -5346,7 +5307,7 @@ s32 host_int_get_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, * @version 1.0 */ #ifndef CONNECT_DIRECT -s32 host_int_get_site_survey_results(WILC_WFIDrvHandle hWFIDrv, +s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv, u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], u32 u32MaxSiteSrvyFragLen) { @@ -5396,7 +5357,7 @@ s32 host_int_get_site_survey_results(WILC_WFIDrvHandle hWFIDrv, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 scanSource) +s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -5426,7 +5387,7 @@ s32 host_int_set_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 scanSource) * @version 1.0 */ -s32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ScanSource) +s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -5451,7 +5412,7 @@ s32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ScanSource) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, +s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, const u8 *pu8IEs, size_t IEsLen, tWILCpfConnectResult pfConnectResult, void *pvUserArg, @@ -5464,9 +5425,8 @@ s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, tstrHostIFmsg strHostIFmsg; tenuScanConnTimer enuScanConnTimer; - if (pstrWFIDrv == NULL || pfConnectResult == NULL) { + if (pstrWFIDrv == NULL || pfConnectResult == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } if (hWFIDrv == NULL) { PRINT_ER("Driver not initialized: gWFiDrvHandle = NULL\n"); @@ -5486,7 +5446,7 @@ s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, * } */ /* prepare the Connect Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT; @@ -5499,39 +5459,41 @@ s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, strHostIFmsg.drvHandler = hWFIDrv; if (pu8bssid != NULL) { - strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid = (u8 *)WILC_MALLOC(6); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid, + strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid = WILC_MALLOC(6); /* will be deallocated by the receiving thread */ + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid, pu8bssid, 6); } if (pu8ssid != NULL) { strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.ssidLen = ssidLen; - strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid = (u8 *)WILC_MALLOC(ssidLen); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid, + strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid = WILC_MALLOC(ssidLen); /* will be deallocated by the receiving thread */ + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid, pu8ssid, ssidLen); } if (pu8IEs != NULL) { strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.IEsLen = IEsLen; - strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs = (u8 *)WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs, + strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs = WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs, pu8IEs, IEsLen); } - if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING) { + if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING) pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTING; - } else + else PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", pstrWFIDrv->enuHostIFstate); /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send message queue: Set join request\n"); WILC_ERRORREPORT(s32Error, WILC_FAIL); } enuScanConnTimer = CONNECT_TIMER; - WILC_TimerStart(&(pstrWFIDrv->hConnectTimer), HOST_IF_CONNECT_TIMEOUT, (void *) hWFIDrv, NULL); + pstrWFIDrv->hConnectTimer.data = (unsigned long)hWFIDrv; + mod_timer(&pstrWFIDrv->hConnectTimer, + jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); WILC_CATCH(s32Error) { @@ -5553,7 +5515,7 @@ s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, * @version 8.0 */ -s32 host_int_flush_join_req(WILC_WFIDrvHandle hWFIDrv) +s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; @@ -5564,16 +5526,15 @@ s32 host_int_flush_join_req(WILC_WFIDrvHandle hWFIDrv) } - if (hWFIDrv == NULL) { + if (hWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } strHostIFmsg.u16MsgId = HOST_IF_MSG_FLUSH_CONNECT; strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send message queue: Flush join request\n"); WILC_ERRORREPORT(s32Error, WILC_FAIL); @@ -5597,14 +5558,14 @@ s32 host_int_flush_join_req(WILC_WFIDrvHandle hWFIDrv) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_disconnect(WILC_WFIDrvHandle hWFIDrv, u16 u16ReasonCode) +s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } @@ -5614,13 +5575,13 @@ s32 host_int_disconnect(WILC_WFIDrvHandle hWFIDrv, u16 u16ReasonCode) } /* prepare the Disconnect Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_DISCONNECT; strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Failed to send message queue: disconnect\n"); /* ////////////// */ @@ -5646,7 +5607,7 @@ s32 host_int_disconnect(WILC_WFIDrvHandle hWFIDrv, u16 u16ReasonCode) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_disconnect_station(WILC_WFIDrvHandle hWFIDrv, u8 assoc_id) +s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -5686,7 +5647,7 @@ s32 host_int_disconnect_station(WILC_WFIDrvHandle hWFIDrv, u8 assoc_id) * @version 1.0 */ -s32 host_int_get_assoc_req_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocReqInfo, +s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo, u32 u32AssocReqInfoLen) { s32 s32Error = WILC_SUCCESS; @@ -5713,7 +5674,7 @@ s32 host_int_get_assoc_req_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocReqInfo, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_assoc_res_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocRespInfo, +s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo, u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen) { s32 s32Error = WILC_SUCCESS; @@ -5721,7 +5682,7 @@ s32 host_int_get_assoc_res_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocRespInfo, tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } @@ -5763,7 +5724,7 @@ s32 host_int_get_assoc_res_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocRespInfo, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_rx_power_level(WILC_WFIDrvHandle hWFIDrv, u8 *pu8RxPowerLevel, +s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel, u32 u32RxPowerLevelLen) { s32 s32Error = WILC_SUCCESS; @@ -5794,26 +5755,24 @@ s32 host_int_get_rx_power_level(WILC_WFIDrvHandle hWFIDrv, u8 *pu8RxPowerLevel, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_mac_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 u8ChNum) +s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the set channel message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_CHANNEL; strHostIFmsg.uniHostIFmsgBody.strHostIFSetChan.u8SetChan = u8ChNum; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -5831,12 +5790,11 @@ s32 host_int_wait_msg_queue_idle(void) /* prepare the set driver handler message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_Q_IDLE; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -5849,7 +5807,7 @@ s32 host_int_wait_msg_queue_idle(void) } -s32 host_int_set_wfi_drv_handler(u32 u32address) +s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address) { s32 s32Error = WILC_SUCCESS; @@ -5858,15 +5816,14 @@ s32 host_int_set_wfi_drv_handler(u32 u32address) /* prepare the set driver handler message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_WFIDRV_HANDLER; strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler.u32Address = u32address; /* strHostIFmsg.drvHandler=hWFIDrv; */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -5877,7 +5834,7 @@ s32 host_int_set_wfi_drv_handler(u32 u32address) -s32 host_int_set_operation_mode(WILC_WFIDrvHandle hWFIDrv, u32 u32mode) +s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode) { s32 s32Error = WILC_SUCCESS; @@ -5886,15 +5843,14 @@ s32 host_int_set_operation_mode(WILC_WFIDrvHandle hWFIDrv, u32 u32mode) /* prepare the set driver handler message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_OPERATION_MODE; strHostIFmsg.uniHostIFmsgBody.strHostIfSetOperationMode.u32Mode = u32mode; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -5918,25 +5874,25 @@ s32 host_int_set_operation_mode(WILC_WFIDrvHandle hWFIDrv, u32 u32mode) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_host_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ChNo) +s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } /* prepare the Get Channel Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_CHNL; strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Failed to send get host channel param's message queue "); down(&(pstrWFIDrv->hSemGetCHNL)); @@ -5964,7 +5920,7 @@ s32 host_int_get_host_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ChNo) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_test_set_int_wid(WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr) +s32 host_int_test_set_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 u32TestMemAddr) { s32 s32Error = WILC_SUCCESS; tstrWID strWID; @@ -5972,7 +5928,7 @@ s32 host_int_test_set_int_wid(WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr) if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } @@ -6011,28 +5967,28 @@ s32 host_int_test_set_int_wid(WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr) * @date * @version 1.0 */ -s32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, u32 *pu32InactiveTime) +s32 host_int_get_inactive_time(tstrWILC_WFIDrv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT.mac, + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIfStaInactiveT.mac, mac, ETH_ALEN); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_INACTIVETIME; strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) PRINT_ER("Failed to send get host channel param's message queue "); @@ -6057,7 +6013,7 @@ s32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, u32 *pu * @date 8 March 2012 * @version 1.0 */ -s32 host_int_test_get_int_wid(WILC_WFIDrvHandle hWFIDrv, u32 *pu32TestMemAddr) +s32 host_int_test_get_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 *pu32TestMemAddr) { s32 s32Error = WILC_SUCCESS; @@ -6066,7 +6022,7 @@ s32 host_int_test_get_int_wid(WILC_WFIDrvHandle hWFIDrv, u32 *pu32TestMemAddr) if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } @@ -6106,7 +6062,7 @@ s32 host_int_test_get_int_wid(WILC_WFIDrvHandle hWFIDrv, u32 *pu32TestMemAddr) * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_rssi(WILC_WFIDrvHandle hWFIDrv, s8 *ps8Rssi) +s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; @@ -6114,13 +6070,13 @@ s32 host_int_get_rssi(WILC_WFIDrvHandle hWFIDrv, s8 *ps8Rssi) /* prepare the Get RSSI Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_RSSI; strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send get host channel param's message queue "); return WILC_FAIL; @@ -6141,7 +6097,7 @@ s32 host_int_get_rssi(WILC_WFIDrvHandle hWFIDrv, s8 *ps8Rssi) return s32Error; } -s32 host_int_get_link_speed(WILC_WFIDrvHandle hWFIDrv, s8 *ps8lnkspd) +s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd) { tstrHostIFmsg strHostIFmsg; s32 s32Error = WILC_SUCCESS; @@ -6151,13 +6107,13 @@ s32 host_int_get_link_speed(WILC_WFIDrvHandle hWFIDrv, s8 *ps8lnkspd) /* prepare the Get LINKSPEED Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_LINKSPEED; strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send GET_LINKSPEED to message queue "); return WILC_FAIL; @@ -6178,20 +6134,20 @@ s32 host_int_get_link_speed(WILC_WFIDrvHandle hWFIDrv, s8 *ps8lnkspd) return s32Error; } -s32 host_int_get_statistics(WILC_WFIDrvHandle hWFIDrv, tstrStatistics *pstrStatistics) +s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; /* prepare the Get RSSI Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_STATISTICS; strHostIFmsg.uniHostIFmsgBody.pUserData = (char *)pstrStatistics; strHostIFmsg.drvHandler = hWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send get host channel param's message queue "); return WILC_FAIL; @@ -6218,7 +6174,7 @@ s32 host_int_get_statistics(WILC_WFIDrvHandle hWFIDrv, tstrStatistics *pstrStati * @date 8 March 2012 * @version 1.0 */ -s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, +s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList, u8 u8ChnlListLen, const u8 *pu8IEs, size_t IEsLen, tWILCpfScanResult ScanResult, @@ -6229,13 +6185,12 @@ s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, tstrHostIFmsg strHostIFmsg; tenuScanConnTimer enuScanConnTimer; - if (pstrWFIDrv == NULL || ScanResult == NULL) { + if (pstrWFIDrv == NULL || ScanResult == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the Scan Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN; @@ -6253,17 +6208,17 @@ s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pvUserArg = pvUserArg; strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ChnlListLen = u8ChnlListLen; - strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList = (u8 *)WILC_MALLOC(u8ChnlListLen); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList, + strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList = WILC_MALLOC(u8ChnlListLen); /* will be deallocated by the receiving thread */ + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList, pu8ChnlFreqList, u8ChnlListLen); strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.IEsLen = IEsLen; - strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs = (u8 *)WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs, + strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs = WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ + memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs, pu8IEs, IEsLen); /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Error in sending message queue scanning parameters: Error(%d)\n", s32Error); WILC_ERRORREPORT(s32Error, WILC_FAIL); @@ -6271,8 +6226,9 @@ s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, enuScanConnTimer = SCAN_TIMER; PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); - WILC_TimerStart(&(pstrWFIDrv->hScanTimer), HOST_IF_SCAN_TIMEOUT, (void *) hWFIDrv, NULL); - + pstrWFIDrv->hScanTimer.data = (unsigned long)hWFIDrv; + mod_timer(&pstrWFIDrv->hScanTimer, + jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); WILC_CATCH(s32Error) { @@ -6292,7 +6248,7 @@ s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, * @date 8 March 2012 * @version 1.0 */ -s32 hif_set_cfg(WILC_WFIDrvHandle hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) +s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) { s32 s32Error = WILC_SUCCESS; @@ -6301,16 +6257,15 @@ s32 hif_set_cfg(WILC_WFIDrvHandle hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the WiphyParams Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_CFG_PARAMS; strHostIFmsg.uniHostIFmsgBody.strHostIFCfgParamAttr.pstrCfgParamVal = *pstrCfgParamVal; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); WILC_CATCH(s32Error) { @@ -6334,7 +6289,7 @@ s32 hif_set_cfg(WILC_WFIDrvHandle hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) * @date 8 March 2012 * @version 1.0 */ -s32 hif_get_cfg(WILC_WFIDrvHandle hWFIDrv, u16 u16WID, u16 *pu16WID_Value) +s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -6342,7 +6297,7 @@ s32 hif_get_cfg(WILC_WFIDrvHandle hWFIDrv, u16 u16WID, u16 *pu16WID_Value) down(&(pstrWFIDrv->gtOsCfgValuesSem)); if (pstrWFIDrv == NULL) { - PRINT_ER("Driver not initialized: pstrWFIDrv = NULL \n"); + PRINT_ER("Driver not initialized: pstrWFIDrv = NULL\n"); WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); } PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); @@ -6469,9 +6424,10 @@ void host_int_send_join_leave_info_to_host * @version 1.0 */ -void GetPeriodicRSSI(void *pvArg) +static void GetPeriodicRSSI(unsigned long arg) { - tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)pvArg; + tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; + if (pstrWFIDrv == NULL) { PRINT_ER("Driver handler is NULL\n"); return; @@ -6482,19 +6438,20 @@ void GetPeriodicRSSI(void *pvArg) tstrHostIFmsg strHostIFmsg; /* prepare the Get RSSI Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_RSSI; strHostIFmsg.drvHandler = pstrWFIDrv; /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); if (s32Error) { PRINT_ER("Failed to send get host channel param's message queue "); return; } } - WILC_TimerStart(&(g_hPeriodicRSSI), 5000, (void *)pstrWFIDrv, NULL); + g_hPeriodicRSSI.data = (unsigned long)pstrWFIDrv; + mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); } @@ -6515,7 +6472,7 @@ static u32 u32Intialized; static u32 msgQ_created; static u32 clients_count; -s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) +s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv; @@ -6535,16 +6492,16 @@ s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) /*Allocate host interface private structure*/ - pstrWFIDrv = (tstrWILC_WFIDrv *)WILC_MALLOC(sizeof(tstrWILC_WFIDrv)); + pstrWFIDrv = WILC_MALLOC(sizeof(tstrWILC_WFIDrv)); if (pstrWFIDrv == NULL) { /* WILC_ERRORREPORT(s32Error,WILC_NO_MEM); */ s32Error = WILC_NO_MEM; PRINT_ER("Failed to allocate memory\n"); goto _fail_timer_2; } - WILC_memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv)); + memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv)); /*return driver handle to user*/ - *phWFIDrv = (WILC_WFIDrvHandle)pstrWFIDrv; + *phWFIDrv = pstrWFIDrv; /*save into globl handle*/ #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP @@ -6575,9 +6532,7 @@ s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); if (clients_count == 0) { - - s32Error = WILC_MsgQueueCreate(&gMsgQHostIF, NULL); - + s32Error = WILC_MsgQueueCreate(&gMsgQHostIF); if (s32Error < 0) { PRINT_ER("Failed to creat MQ\n"); @@ -6590,47 +6545,24 @@ s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) s32Error = WILC_FAIL; goto _fail_mq_; } - s32Error = WILC_TimerCreate(&(g_hPeriodicRSSI), GetPeriodicRSSI, NULL); - if (s32Error < 0) { - PRINT_ER("Failed to creat Timer\n"); - goto _fail_timer_1; - } - WILC_TimerStart(&(g_hPeriodicRSSI), 5000, (void *)pstrWFIDrv, NULL); - + setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, + (unsigned long)pstrWFIDrv); + mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); } - s32Error = WILC_TimerCreate(&(pstrWFIDrv->hScanTimer), TimerCB_Scan, NULL); - if (s32Error < 0) { - PRINT_ER("Failed to creat Timer\n"); - goto _fail_thread_; - } - - s32Error = WILC_TimerCreate(&(pstrWFIDrv->hConnectTimer), TimerCB_Connect, NULL); - if (s32Error < 0) { - PRINT_ER("Failed to creat Timer\n"); - goto _fail_timer_1; - } + setup_timer(&pstrWFIDrv->hScanTimer, TimerCB_Scan, 0); + setup_timer(&pstrWFIDrv->hConnectTimer, TimerCB_Connect, 0); #ifdef WILC_P2P /*Remain on channel timer*/ - s32Error = WILC_TimerCreate(&(pstrWFIDrv->hRemainOnChannel), ListenTimerCB, NULL); - if (s32Error < 0) { - PRINT_ER("Failed to creat Remain-on-channel Timer\n"); - goto _fail_timer_3; - } + setup_timer(&pstrWFIDrv->hRemainOnChannel, ListenTimerCB, 0); #endif sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1); down(&(pstrWFIDrv->gtOsCfgValuesSem)); - - -#ifdef SIMULATION - TransportInit(); -#endif - pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; /* gWFiDrvHandle->bPendingConnRequest = false; */ @@ -6666,11 +6598,6 @@ s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) goto _fail_mem_; } -#ifdef SIMULATION - /*Initialize Simulaor*/ - CoreConfigSimulatorInit(); -#endif - u32Intialized = 1; clients_count++; /* increase number of created entities */ @@ -6679,20 +6606,17 @@ s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) _fail_mem_: if (pstrWFIDrv != NULL) - WILC_FREE(pstrWFIDrv); + kfree(pstrWFIDrv); #ifdef WILC_P2P -_fail_timer_3: - WILC_TimerDestroy(&(pstrWFIDrv->hRemainOnChannel), NULL); + del_timer_sync(&pstrWFIDrv->hRemainOnChannel); #endif _fail_timer_2: up(&(pstrWFIDrv->gtOsCfgValuesSem)); - WILC_TimerDestroy(&(pstrWFIDrv->hConnectTimer), NULL); -_fail_timer_1: - WILC_TimerDestroy(&(pstrWFIDrv->hScanTimer), NULL); -_fail_thread_: + del_timer_sync(&pstrWFIDrv->hConnectTimer); + del_timer_sync(&pstrWFIDrv->hScanTimer); kthread_stop(HostIFthreadHandler); _fail_mq_: - WILC_MsgQueueDestroy(&gMsgQHostIF, NULL); + WILC_MsgQueueDestroy(&gMsgQHostIF); _fail_: return s32Error; @@ -6708,7 +6632,7 @@ _fail_: * @version 1.0 */ -s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv) +s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) { s32 s32Error = WILC_SUCCESS; tstrHostIFmsg strHostIFmsg; @@ -6737,28 +6661,28 @@ s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv) /*BugID_5348*/ /*Destroy all timers before acquiring hSemDeinitDrvHandle*/ /*to guarantee handling all messages befor proceeding*/ - if (WILC_TimerDestroy(&(pstrWFIDrv->hScanTimer), NULL)) { - PRINT_D(HOSTINF_DBG, ">> Scan timer is active \n"); + if (del_timer_sync(&pstrWFIDrv->hScanTimer)) { + PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */ } - if (WILC_TimerDestroy(&(pstrWFIDrv->hConnectTimer), NULL)) { - PRINT_D(HOSTINF_DBG, ">> Connect timer is active \n"); + if (del_timer_sync(&pstrWFIDrv->hConnectTimer)) { + PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ } - if (WILC_TimerDestroy(&(g_hPeriodicRSSI), NULL)) { - PRINT_D(HOSTINF_DBG, ">> Connect timer is active \n"); + if (del_timer_sync(&g_hPeriodicRSSI)) { + PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ } #ifdef WILC_P2P /*Destroy Remain-onchannel Timer*/ - WILC_TimerDestroy(&(pstrWFIDrv->hRemainOnChannel), NULL); + del_timer_sync(&pstrWFIDrv->hRemainOnChannel); #endif - host_int_set_wfi_drv_handler((u32)NULL); + host_int_set_wfi_drv_handler(NULL); down(&hSemDeinitDrvHandle); @@ -6770,39 +6694,30 @@ s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv) pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; } /*deinit configurator and simulator*/ -#ifdef SIMULATION - CoreConfigSimulatorDeInit(); -#endif CoreConfiguratorDeInit(); -#ifdef SIMULATION - TransportDeInit(); -#endif pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; gbScanWhileConnected = false; - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); if (clients_count == 1) { - if (WILC_TimerDestroy(&g_hPeriodicRSSI, NULL)) { - PRINT_D(HOSTINF_DBG, ">> Connect timer is active \n"); + if (del_timer_sync(&g_hPeriodicRSSI)) { + PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ } strHostIFmsg.u16MsgId = HOST_IF_MSG_EXIT; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error != WILC_SUCCESS) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error != WILC_SUCCESS) PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", s32Error); - } down(&hSemHostIFthrdEnd); - - - WILC_MsgQueueDestroy(&gMsgQHostIF, NULL); + WILC_MsgQueueDestroy(&gMsgQHostIF); msgQ_created = 0; } @@ -6812,7 +6727,7 @@ s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv) u32Intialized = 0; /* gWFiDrvHandle = NULL; */ if (pstrWFIDrv != NULL) { - WILC_FREE(pstrWFIDrv); + kfree(pstrWFIDrv); /* pstrWFIDrv=NULL; */ } @@ -6854,24 +6769,20 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) } /* prepare the Asynchronous Network Info message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_NTWRK_INFO; strHostIFmsg.drvHandler = pstrWFIDrv; strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.u32Length = u32Length; - strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer = (u8 *)WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer, + strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer = WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ + memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer, pu8Buffer, u32Length); /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", s32Error); - } - - - return; } /** @@ -6897,7 +6808,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; - PRINT_D(HOSTINF_DBG, "General asynchronous info packet received \n"); + PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { @@ -6916,7 +6827,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) } /* prepare the General Asynchronous Info message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; @@ -6924,19 +6835,17 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.u32Length = u32Length; - strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer = (u8 *)WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ - WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer, + strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer = WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ + memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer, pu8Buffer, u32Length); /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) PRINT_ER("Error in sending message queue asynchronous message info: Error(%d)\n", s32Error); - } /*BugID_5348*/ up(&hSemHostIntDeinit); - return; } /** @@ -6954,20 +6863,20 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) tstrHostIFmsg strHostIFmsg; u32 drvHandler; tstrWILC_WFIDrv *pstrWFIDrv = NULL; + drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; PRINT_D(GENERIC_DBG, "Scan notification received %p\n", pstrWFIDrv); - if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { + if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) return; - } /*if there is an ongoing scan request*/ if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { /* prepare theScan Done message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_RCVD_SCAN_COMPLETE; strHostIFmsg.drvHandler = pstrWFIDrv; @@ -6978,14 +6887,13 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) /*strHostIFmsg.uniHostIFmsgBody.strScanComplete.u32Length = u32Length; * strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer = (u8*)WILC_MALLOC(u32Length); - * WILC_memcpy(strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer, + * memcpy(strHostIFmsg.uniHostIFmsgBody.strScanComplete.pu8Buffer, * pu8Buffer, u32Length); */ /* send the message */ - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) PRINT_ER("Error in sending message queue scan complete parameters: Error(%d)\n", s32Error); - } } @@ -7008,18 +6916,17 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) * @date * @version 1.0 */ -s32 host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, tWILCpfRemainOnChanExpired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg) +s32 host_int_remain_on_channel(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, tWILCpfRemainOnChanExpired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the remainonchan Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_REMAIN_ON_CHAN; @@ -7031,10 +6938,9 @@ s32 host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID, u32 strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7057,29 +6963,27 @@ s32 host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID, u32 * @date * @version 1.0 */ -s32 host_int_ListenStateExpired(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID) +s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /*Stopping remain-on-channel timer*/ - WILC_TimerStop(&(pstrWFIDrv->hRemainOnChannel), NULL); + del_timer(&pstrWFIDrv->hRemainOnChannel); /* prepare the timer fire Message */ - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); strHostIFmsg.u16MsgId = HOST_IF_MSG_LISTEN_TIMER_FIRED; strHostIFmsg.drvHandler = hWFIDrv; strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7095,17 +6999,16 @@ s32 host_int_ListenStateExpired(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID) * @author * @date * @version 1.0*/ -s32 host_int_frame_register(WILC_WFIDrvHandle hWFIDrv, u16 u16FrameType, bool bReg) +s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_REGISTER_FRAME; @@ -7128,10 +7031,9 @@ s32 host_int_frame_register(WILC_WFIDrvHandle hWFIDrv, u16 u16FrameType, bool bR strHostIFmsg.uniHostIFmsgBody.strHostIfRegisterFrame.bReg = bReg; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7155,7 +7057,7 @@ s32 host_int_frame_register(WILC_WFIDrvHandle hWFIDrv, u16 u16FrameType, bool bR * @date * @version 1.0 */ -s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, +s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8Tail) @@ -7165,11 +7067,10 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, tstrHostIFmsg strHostIFmsg; tstrHostIFSetBeacon *pstrSetBeaconParam = &strHostIFmsg.uniHostIFmsgBody.strHostIFSetBeacon; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); @@ -7180,38 +7081,33 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, pstrSetBeaconParam->u32Interval = u32Interval; pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod; pstrSetBeaconParam->u32HeadLen = u32HeadLen; - pstrSetBeaconParam->pu8Head = (u8 *)WILC_MALLOC(u32HeadLen); - if (pstrSetBeaconParam->pu8Head == NULL) { + pstrSetBeaconParam->pu8Head = WILC_MALLOC(u32HeadLen); + if (pstrSetBeaconParam->pu8Head == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } - WILC_memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); + memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); pstrSetBeaconParam->u32TailLen = u32TailLen; /* Bug 4599 : if tail length = 0 skip allocating & copying */ if (u32TailLen > 0) { - pstrSetBeaconParam->pu8Tail = (u8 *)WILC_MALLOC(u32TailLen); - if (pstrSetBeaconParam->pu8Tail == NULL) { + pstrSetBeaconParam->pu8Tail = WILC_MALLOC(u32TailLen); + if (pstrSetBeaconParam->pu8Tail == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } - WILC_memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); + memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); } else { pstrSetBeaconParam->pu8Tail = NULL; } - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { - if (pstrSetBeaconParam->pu8Head != NULL) { - WILC_FREE(pstrSetBeaconParam->pu8Head); - } + if (pstrSetBeaconParam->pu8Head != NULL) + kfree(pstrSetBeaconParam->pu8Head); - if (pstrSetBeaconParam->pu8Tail != NULL) { - WILC_FREE(pstrSetBeaconParam->pu8Tail); - } + if (pstrSetBeaconParam->pu8Tail != NULL) + kfree(pstrSetBeaconParam->pu8Tail); } return s32Error; @@ -7228,22 +7124,21 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, * @date * @version 1.0 */ -s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv) +s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_BEACON; strHostIFmsg.drvHandler = hWFIDrv; PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); WILC_ERRORCHECK(s32Error); WILC_CATCH(s32Error) @@ -7262,7 +7157,7 @@ s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv) * @date * @version 1.0 */ -s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) +s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7270,11 +7165,10 @@ s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrSt tstrWILC_AddStaParam *pstrAddStationMsg = &strHostIFmsg.uniHostIFmsgBody.strAddStaParam; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); @@ -7283,20 +7177,20 @@ s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrSt strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_STATION; strHostIFmsg.drvHandler = hWFIDrv; - WILC_memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); + memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); if (pstrAddStationMsg->u8NumRates > 0) { u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates); + WILC_NULLCHECK(s32Error, rates); - WILC_memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); + memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); pstrAddStationMsg->pu8Rates = rates; } - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7313,18 +7207,17 @@ s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrSt * @date * @version 1.0 */ -s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr) +s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; tstrHostIFDelSta *pstrDelStationMsg = &strHostIFmsg.uniHostIFmsgBody.strDelStaParam; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); @@ -7336,14 +7229,13 @@ s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr) /*BugID_4795: Handling situation of deleting all stations*/ if (pu8MacAddr == NULL) - WILC_memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN); + memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN); else - WILC_memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); + memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7359,7 +7251,7 @@ s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr) * @date * @version 1.0 */ -s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]) +s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7370,11 +7262,10 @@ s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN] u8 u8AssocNumb = 0; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); @@ -7385,7 +7276,7 @@ s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN] /* Handling situation of deauthenticing all associated stations*/ for (i = 0; i < MAX_NUM_STA; i++) { if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { - WILC_memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN); + memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN); PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", pstrDelAllStationMsg->au8Sta_DelAllSta[i][0], pstrDelAllStationMsg->au8Sta_DelAllSta[i][1], pstrDelAllStationMsg->au8Sta_DelAllSta[i][2], pstrDelAllStationMsg->au8Sta_DelAllSta[i][3], pstrDelAllStationMsg->au8Sta_DelAllSta[i][4], pstrDelAllStationMsg->au8Sta_DelAllSta[i][5]); u8AssocNumb++; @@ -7397,13 +7288,12 @@ s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN] } pstrDelAllStationMsg->u8Num_AssocSta = u8AssocNumb; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); - if (s32Error) { + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7423,38 +7313,37 @@ s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN] * @date * @version 1.0 */ -s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) +s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; tstrWILC_AddStaParam *pstrAddStationMsg = &strHostIFmsg.uniHostIFmsgBody.strAddStaParam; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_EDIT_STATION; strHostIFmsg.drvHandler = hWFIDrv; - WILC_memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); + memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); if (pstrAddStationMsg->u8NumRates > 0) { u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates); + WILC_NULLCHECK(s32Error, rates); - WILC_memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); + memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); pstrAddStationMsg->pu8Rates = rates; } - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { } @@ -7463,22 +7352,21 @@ s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrS #endif /*WILC_AP_EXTERNAL_MLME*/ uint32_t wilc_get_chipid(uint8_t); -s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32Timeout) +s32 host_int_set_power_mgmt(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32Timeout) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; tstrHostIfPowerMgmtParam *pstrPowerMgmtParam = &strHostIFmsg.uniHostIFmsgBody.strPowerMgmtparam; - PRINT_INFO(HOSTINF_DBG, "\n\n>> Setting PS to %d << \n\n", bIsEnabled); + PRINT_INFO(HOSTINF_DBG, "\n\n>> Setting PS to %d <<\n\n", bIsEnabled); - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ @@ -7489,17 +7377,16 @@ s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32T pstrPowerMgmtParam->u32Timeout = u32Timeout; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { } return s32Error; } -s32 host_int_setup_multicast_filter(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32count) +s32 host_int_setup_multicast_filter(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32count) { s32 s32Error = WILC_SUCCESS; @@ -7508,13 +7395,12 @@ s32 host_int_setup_multicast_filter(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, tstrHostIFSetMulti *pstrMulticastFilterParam = &strHostIFmsg.uniHostIFmsgBody.strHostIfSetMulti; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ @@ -7524,10 +7410,9 @@ s32 host_int_setup_multicast_filter(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, pstrMulticastFilterParam->bIsEnabled = bIsEnabled; pstrMulticastFilterParam->u32count = u32count; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { } @@ -7568,17 +7453,17 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) pNewJoinBssParam = WILC_MALLOC(sizeof(tstrJoinBssParam)); if (pNewJoinBssParam != NULL) { - WILC_memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam)); + memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam)); pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; - WILC_memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); + memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); /*for(i=0; i<6;i++) * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/ - WILC_memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); + memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen; - WILC_memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); - WILC_memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); + memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); + memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); /*for(i=0; issidLen;i++) * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->ssid[i]);*/ @@ -7633,9 +7518,8 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) pNewJoinBssParam->wmm_cap = true; /* Check if Bit 7 is set indicating U-APSD capability */ - if (pu8IEs[index + 8] & (1 << 7)) { + if (pu8IEs[index + 8] & (1 << 7)) pNewJoinBssParam->uapsd_cap = true; - } index += pu8IEs[index + 1] + 2; continue; } @@ -7645,6 +7529,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) (pu8IEs[index + 4] == 0x9a) && /* OUI */ (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { /* OUI Type */ u16 u16P2P_count; + pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; pNewJoinBssParam->u8NoaEnbaled = 1; pNewJoinBssParam->u8Index = pu8IEs[index + 9]; @@ -7656,20 +7541,20 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) } else pNewJoinBssParam->u8OppEnable = 0; /* HOSTINF_DBG */ - PRINT_D(GENERIC_DBG, "P2P Dump \n"); + PRINT_D(GENERIC_DBG, "P2P Dump\n"); for (i = 0; i < pu8IEs[index + 7]; i++) - PRINT_D(GENERIC_DBG, " %x \n", pu8IEs[index + 9 + i]); + PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); pNewJoinBssParam->u8Count = pu8IEs[index + 11]; u16P2P_count = index + 12; - WILC_memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4); + memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4); u16P2P_count += 4; - WILC_memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4); + memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4); u16P2P_count += 4; - WILC_memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4); + memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4); index += pu8IEs[index + 1] + 2; continue; @@ -7698,7 +7583,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) rsnIndex += 7; /* skipping id, length, version(2B) and first 3 bytes of gcipher */ pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; rsnIndex++; - /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x \n",pNewJoinBssParam->rsn_grp_policy); */ + /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x\n",pNewJoinBssParam->rsn_grp_policy); */ /* initialize policies with invalid values */ jumpOffset = pu8IEs[rsnIndex] * 4; /* total no.of bytes of pcipher field (count*4) */ @@ -7709,7 +7594,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; rsnIndex += 2; /* jump 2 bytes of pcipher count */ - /* PRINT_D(HOSTINF_DBG,"\npcipher:%d \n",pcipherCount); */ + /* PRINT_D(HOSTINF_DBG,"\npcipher:%d\n",pcipherCount); */ for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) { /* each count corresponds to 4 bytes, only last byte is saved */ pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; @@ -7755,7 +7640,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) void host_int_freeJoinParams(void *pJoinParams) { if ((tstrJoinBssParam *)pJoinParams != NULL) - WILC_FREE((tstrJoinBssParam *)pJoinParams); + kfree((tstrJoinBssParam *)pJoinParams); else PRINT_ER("Unable to FREE null pointer\n"); } @@ -7771,7 +7656,7 @@ void host_int_freeJoinParams(void *pJoinParams) * @date * @version 1.0**/ -static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID, short int BufferSize, +static int host_int_addBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID, short int BufferSize, short int SessionTimeout, void *drvHandler) { s32 s32Error = WILC_SUCCESS; @@ -7779,11 +7664,10 @@ static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char T tstrHostIFmsg strHostIFmsg; tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_ADD_BA_SESSION; @@ -7794,10 +7678,9 @@ static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char T pBASessionInfo->u16SessionTimeout = SessionTimeout; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7807,18 +7690,17 @@ static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char T } -s32 host_int_delBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID) +s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_BA_SESSION; @@ -7827,10 +7709,9 @@ s32 host_int_delBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID) pBASessionInfo->u8Ted = TID; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7842,18 +7723,17 @@ s32 host_int_delBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID) return s32Error; } -s32 host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID) +s32 host_int_del_All_Rx_BASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; tstrHostIfBASessionInfo *pBASessionInfo = &strHostIFmsg.uniHostIFmsgBody.strHostIfBASessionInfo; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; @@ -7862,10 +7742,9 @@ s32 host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char pBASessionInfo->u8Ted = TID; strHostIFmsg.drvHandler = hWFIDrv; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7885,7 +7764,7 @@ s32 host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char * @author Abdelrahman Sobhy * @date * @version 1.0*/ -s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) +s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7894,11 +7773,10 @@ s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) /* TODO: Enable This feature on softap firmware */ return 0; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_IPADDRESS; @@ -7907,10 +7785,9 @@ s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) strHostIFmsg.drvHandler = hWFIDrv; strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { @@ -7929,29 +7806,27 @@ s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) * @author Abdelrahman Sobhy * @date * @version 1.0*/ -s32 host_int_get_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *u16ipadd, u8 idx) +s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) { s32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; tstrHostIFmsg strHostIFmsg; - if (pstrWFIDrv == NULL) { + if (pstrWFIDrv == NULL) WILC_ERRORREPORT(s32Error, WILC_INVALID_ARGUMENT); - } - WILC_memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); + memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg)); /* prepare the WiphyParams Message */ strHostIFmsg.u16MsgId = HOST_IF_MSG_GET_IPADDRESS; strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.au8IPAddr = u16ipadd; - strHostIFmsg.drvHandler=hWFIDrv; - strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx= idx; + strHostIFmsg.drvHandler = hWFIDrv; + strHostIFmsg.uniHostIFmsgBody.strHostIfSetIP.idx = idx; - s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL); - if (s32Error) { + s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg)); + if (s32Error) WILC_ERRORREPORT(s32Error, s32Error); - } WILC_CATCH(s32Error) { diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 38db74074..e66dee9af 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -11,7 +11,6 @@ #define HOST_INT_H #include "coreconfigurator.h" -#include "coreconfigsimulator.h" /*****************************************************************************/ /* Macros */ /*****************************************************************************/ @@ -368,10 +367,10 @@ typedef struct { struct semaphore hSemGetCHNL; struct semaphore hSemInactiveTime; /* timer handlers */ - WILC_TimerHandle hScanTimer; - WILC_TimerHandle hConnectTimer; + struct timer_list hScanTimer; + struct timer_list hConnectTimer; #ifdef WILC_P2P - WILC_TimerHandle hRemainOnChannel; + struct timer_list hRemainOnChannel; #endif bool IFC_UP; @@ -433,7 +432,7 @@ typedef struct { * @date 8 March 2012 * @version 1.0 */ -s32 host_int_remove_key(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8StaAddress); +s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress); /** * @brief removes WEP key * @details valid only in BSS STA mode if External Supplicant support is enabled. @@ -448,7 +447,7 @@ s32 host_int_remove_key(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8StaAddress); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv, u8 u8Index); +s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index); /** * @brief sets WEP deafault key * @details Sets the index of the WEP encryption key in use, @@ -461,7 +460,7 @@ s32 host_int_remove_wep_key(WILC_WFIDrvHandle hWFIDrv, u8 u8Index); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_WEPDefaultKeyID(WILC_WFIDrvHandle hWFIDrv, u8 u8Index); +s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index); /** * @brief sets WEP deafault key @@ -482,7 +481,7 @@ s32 host_int_set_WEPDefaultKeyID(WILC_WFIDrvHandle hWFIDrv, u8 u8Index); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx); +s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx); /** * @brief host_int_add_wep_key_bss_ap * @details valid only in AP mode if External Supplicant support is enabled. @@ -497,7 +496,7 @@ s32 host_int_add_wep_key_bss_sta(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, * @date 28 Feb 2013 * @version 1.0 */ -s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, AUTHTYPE_T tenuAuth_type); +s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, AUTHTYPE_T tenuAuth_type); /** * @brief adds ptk Key @@ -515,7 +514,7 @@ s32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8WepKey, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, +s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx); /** @@ -530,7 +529,7 @@ s32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen * @date 15 April 2013 * @version 1.0 */ -s32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); +s32 host_int_get_inactive_time(tstrWILC_WFIDrv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime); /** * @brief adds Rx GTk Key @@ -548,7 +547,7 @@ s32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, u32 *pu * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, +s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode); @@ -569,7 +568,7 @@ s32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkK * @date 8 March 2012 * @version 1.0 */ -s32 host_int_add_tx_gtk(WILC_WFIDrvHandle hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx); +s32 host_int_add_tx_gtk(tstrWILC_WFIDrv *hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 u8KeyIdx); /** * @brief caches the pmkid @@ -592,7 +591,7 @@ s32 host_int_add_tx_gtk(WILC_WFIDrvHandle hWFIDrv, u8 u8KeyLen, u8 *pu8TxGtk, u8 * @version 1.0 */ -s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray); +s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray); /** * @brief gets the cached the pmkid info * @details valid only in BSS STA mode if External Supplicant @@ -616,7 +615,7 @@ s32 host_int_set_pmkid_info(WILC_WFIDrvHandle hWFIDrv, tstrHostIFpmkidAttr *pu8P * @version 1.0 */ -s32 host_int_get_pmkid_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PmkidInfoArray, +s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray, u32 u32PmkidInfoLen); /** @@ -633,7 +632,7 @@ s32 host_int_get_pmkid_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PmkidInfoArray, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PassPhrase, +s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, u8 u8Psklength); /** * @brief gets the pass phrase @@ -649,7 +648,7 @@ s32 host_int_set_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, u8 *pu8PassP * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, +s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, u8 u8Psklength); /** @@ -663,7 +662,7 @@ s32 host_int_get_RSNAConfigPSKPassPhrase(WILC_WFIDrvHandle hWFIDrv, * @date 19 April 2012 * @version 1.0 */ -s32 host_int_get_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress); +s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress); /** * @brief sets mac address @@ -676,7 +675,7 @@ s32 host_int_get_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress); * @date 16 July 2012 * @version 1.0 */ -s32 host_int_set_MacAddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8MacAddress); +s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress); /** * @brief wait until msg q is empty @@ -721,7 +720,7 @@ s32 host_int_wait_msg_queue_idle(void); * @version 1.0 */ #ifndef CONNECT_DIRECT -s32 host_int_get_site_survey_results(WILC_WFIDrvHandle hWFIDrv, +s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv, u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], u32 u32MaxSiteSrvyFragLen); #endif @@ -742,7 +741,7 @@ s32 host_int_get_site_survey_results(WILC_WFIDrvHandle hWFIDrv, * @version 1.0 */ -s32 host_int_set_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 scanSource); +s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource); /** * @brief gets scan source of the last scan * @details @@ -758,7 +757,7 @@ s32 host_int_set_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 scanSource); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ScanSource); +s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource); /** * @brief sets a join request @@ -772,7 +771,7 @@ s32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ScanSource); * @version 1.0 */ -s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, +s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, const u8 *pu8ssid, size_t ssidLen, const u8 *pu8IEs, size_t IEsLen, tWILCpfConnectResult pfConnectResult, void *pvUserArg, @@ -792,7 +791,7 @@ s32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, u8 *pu8bssid, * @version 8.0 */ -s32 host_int_flush_join_req(WILC_WFIDrvHandle hWFIDrv); +s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv); /** @@ -806,7 +805,7 @@ s32 host_int_flush_join_req(WILC_WFIDrvHandle hWFIDrv); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_disconnect(WILC_WFIDrvHandle hWFIDrv, u16 u16ReasonCode); +s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode); /** * @brief disconnects a sta @@ -819,7 +818,7 @@ s32 host_int_disconnect(WILC_WFIDrvHandle hWFIDrv, u16 u16ReasonCode); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_disconnect_station(WILC_WFIDrvHandle hWFIDrv, u8 assoc_id); +s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id); /** * @brief gets a Association request info * @details @@ -846,7 +845,7 @@ s32 host_int_disconnect_station(WILC_WFIDrvHandle hWFIDrv, u8 assoc_id); * @version 1.0 */ -s32 host_int_get_assoc_req_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocReqInfo, +s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo, u32 u32AssocReqInfoLen); /** * @brief gets a Association Response info @@ -860,7 +859,7 @@ s32 host_int_get_assoc_req_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocReqInfo, * @version 1.0 */ -s32 host_int_get_assoc_res_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocRespInfo, +s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo, u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen); /** * @brief gets a Association Response info @@ -877,7 +876,7 @@ s32 host_int_get_assoc_res_info(WILC_WFIDrvHandle hWFIDrv, u8 *pu8AssocRespInfo, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_rx_power_level(WILC_WFIDrvHandle hWFIDrv, u8 *pu8RxPowerLevel, +s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel, u32 u32RxPowerLevelLen); /** @@ -895,7 +894,7 @@ s32 host_int_get_rx_power_level(WILC_WFIDrvHandle hWFIDrv, u8 *pu8RxPowerLevel, * @date 8 March 2012 * @version 1.0 */ -s32 host_int_set_mac_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 u8ChNum); +s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum); /** * @brief gets the current channel index @@ -912,7 +911,7 @@ s32 host_int_set_mac_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 u8ChNum); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_host_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ChNo); +s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo); /** * @brief gets the sta rssi * @details gets the currently maintained RSSI value for the station. @@ -926,8 +925,8 @@ s32 host_int_get_host_chnl_num(WILC_WFIDrvHandle hWFIDrv, u8 *pu8ChNo); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_get_rssi(WILC_WFIDrvHandle hWFIDrv, s8 *ps8Rssi); -s32 host_int_get_link_speed(WILC_WFIDrvHandle hWFIDrv, s8 *ps8lnkspd); +s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi); +s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd); /** * @brief scans a set of channels * @details @@ -945,7 +944,7 @@ s32 host_int_get_link_speed(WILC_WFIDrvHandle hWFIDrv, s8 *ps8lnkspd); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, +s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, u8 u8ScanType, u8 *pu8ChnlFreqList, u8 u8ChnlListLen, const u8 *pu8IEs, size_t IEsLen, tWILCpfScanResult ScanResult, @@ -961,7 +960,7 @@ s32 host_int_scan(WILC_WFIDrvHandle hWFIDrv, u8 u8ScanSource, * @date 8 March 2012 * @version 1.0 */ -s32 hif_set_cfg(WILC_WFIDrvHandle hWFIDrv, tstrCfgParamVal *pstrCfgParamVal); +s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal); /** * @brief gets configuration wids values @@ -975,7 +974,7 @@ s32 hif_set_cfg(WILC_WFIDrvHandle hWFIDrv, tstrCfgParamVal *pstrCfgParamVal); * @date 8 March 2012 * @version 1.0 */ -s32 hif_get_cfg(WILC_WFIDrvHandle hWFIDrv, u16 u16WID, u16 *pu16WID_Value); +s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value); /*****************************************************************************/ /* Notification Functions */ /*****************************************************************************/ @@ -1022,7 +1021,7 @@ void host_int_send_network_info_to_host * @date 8 March 2012 * @version 1.0 */ -s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv); +s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv); /** * @brief host interface initialization function @@ -1033,7 +1032,7 @@ s32 host_int_init(WILC_WFIDrvHandle *phWFIDrv); * @date 8 March 2012 * @version 1.0 */ -s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv); +s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv); /*! @@ -1058,7 +1057,7 @@ s32 host_int_deinit(WILC_WFIDrvHandle hWFIDrv); * @version 1.0 Description * */ -s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, +s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, u32 u32TailLen, u8 *pu8tail); @@ -1076,7 +1075,7 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, * @date 10 Julys 2012 * @version 1.0 Description */ -s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv); +s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv); /*! * @fn s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam strStaParams) @@ -1091,7 +1090,7 @@ s32 host_int_del_beacon(WILC_WFIDrvHandle hWFIDrv); * @date 12 July 2012 * @version 1.0 Description */ -s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrStaParams); +s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams); /*! * @fn s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, const u8* pu8MacAddr) @@ -1106,7 +1105,7 @@ s32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrSt * @date 09 April 2014 * @version 1.0 Description */ -s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]); +s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]); /*! * @fn s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr) @@ -1121,7 +1120,7 @@ s32 host_int_del_allstation(WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN] * @date 15 July 2012 * @version 1.0 Description */ -s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr); +s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr); /*! * @fn s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam strStaParams) @@ -1136,7 +1135,7 @@ s32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8MacAddr); * @date 15 July 2012 * @version 1.0 Description */ -s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrStaParams); +s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams); /*! * @fn s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32Timeout) @@ -1153,7 +1152,7 @@ s32 host_int_edit_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam *pstrS * @date 24 November 2012 * @version 1.0 Description */ -s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32Timeout); +s32 host_int_set_power_mgmt(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32Timeout); /* @param[in,out] hWFIDrv handle to the wifi driver * @param[in] bIsEnabled TRUE if enabled, FALSE otherwise * @param[in] u8count count of mac address entries in the filter table @@ -1165,7 +1164,7 @@ s32 host_int_set_power_mgmt(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32T * @date 24 November 2012 * @version 1.0 Description */ -s32 host_int_setup_multicast_filter(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, u32 u32count); +s32 host_int_setup_multicast_filter(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32count); /** * @brief host_int_setup_ipaddress * @details set IP address on firmware @@ -1175,7 +1174,7 @@ s32 host_int_setup_multicast_filter(WILC_WFIDrvHandle hWFIDrv, bool bIsEnabled, * @date * @version 1.0 */ -s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8IPAddr, u8 idx); +s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8IPAddr, u8 idx); /** @@ -1187,7 +1186,7 @@ s32 host_int_setup_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8IPAddr, u8 idx); * @date * @version 1.0 */ -s32 host_int_delBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID); +s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID); /** * @brief host_int_delBASession @@ -1198,7 +1197,7 @@ s32 host_int_delBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID); * @date * @version 1.0 */ -s32 host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID); +s32 host_int_del_All_Rx_BASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID); /** @@ -1210,7 +1209,7 @@ s32 host_int_del_All_Rx_BASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char * @date * @version 1.0 */ -s32 host_int_get_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8IPAddr, u8 idx); +s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8IPAddr, u8 idx); #ifdef WILC_P2P /** @@ -1222,7 +1221,7 @@ s32 host_int_get_ipaddress(WILC_WFIDrvHandle hWFIDrv, u8 *pu8IPAddr, u8 idx); * @date * @version 1.0 */ -s32 host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, tWILCpfRemainOnChanExpired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg); +s32 host_int_remain_on_channel(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, tWILCpfRemainOnChanExpired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg); /** * @brief host_int_ListenStateExpired @@ -1238,7 +1237,7 @@ s32 host_int_remain_on_channel(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID, u32 * @date * @version 1.0 */ -s32 host_int_ListenStateExpired(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID); +s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID); /** * @brief host_int_frame_register @@ -1249,7 +1248,7 @@ s32 host_int_ListenStateExpired(WILC_WFIDrvHandle hWFIDrv, u32 u32SessionID); * @date * @version 1.0 */ -s32 host_int_frame_register(WILC_WFIDrvHandle hWFIDrv, u16 u16FrameType, bool bReg); +s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg); #endif /** * @brief host_int_set_wfi_drv_handler @@ -1260,18 +1259,18 @@ s32 host_int_frame_register(WILC_WFIDrvHandle hWFIDrv, u16 u16FrameType, bool bR * @date * @version 1.0 */ -s32 host_int_set_wfi_drv_handler(u32 u32address); -s32 host_int_set_operation_mode(WILC_WFIDrvHandle hWFIDrv, u32 u32mode); +s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address); +s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode); -static s32 Handle_ScanDone(void *drvHandler, tenuScanEvent enuEvent); +static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent); -static int host_int_addBASession(WILC_WFIDrvHandle hWFIDrv, char *pBSSID, char TID, short int BufferSize, +static int host_int_addBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID, short int BufferSize, short int SessionTimeout, void *drvHandler); void host_int_freeJoinParams(void *pJoinParams); -s32 host_int_get_statistics(WILC_WFIDrvHandle hWFIDrv, tstrStatistics *pstrStatistics); +s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics); /*****************************************************************************/ /* */ diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index f5296f53a..b8d7d0484 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -6,20 +6,15 @@ * @date 01 MAR 2012 * @version 1.0 */ - -#ifndef SIMULATION #include "wilc_wfi_cfgoperations.h" #include "linux_wlan_common.h" #include "wilc_wlan_if.h" #include "wilc_wlan.h" -#endif + #ifdef WILC_FULLY_HOSTING_AP #include "wilc_host_ap.h" #endif #ifdef WILC_AP_EXTERNAL_MLME -#ifdef SIMULATION -#include "wilc_wfi_cfgoperations.h" -#endif struct wilc_wfi_radiotap_hdr { struct ieee80211_radiotap_header hdr; @@ -39,9 +34,7 @@ extern linux_wlan_t *g_linux_wlan; static struct net_device *wilc_wfi_mon; /* global monitor netdev */ -#ifdef SIMULATION -extern int WILC_WFI_Tx(struct sk_buff *skb, struct net_device *dev); -#elif USE_WIRELESS +#if USE_WIRELESS extern int mac_xmit(struct sk_buff *skb, struct net_device *dev); #endif @@ -237,14 +230,12 @@ static void mgmt_tx_complete(void *priv, int status) } static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) { - linux_wlan_t *nic; struct tx_complete_mon_data *mgmt_tx = NULL; if (dev == NULL) { PRINT_D(HOSTAPD_DBG, "ERROR: dev == NULL\n"); return WILC_FAIL; } - nic = netdev_priv(dev); netif_stop_queue(dev); mgmt_tx = kmalloc(sizeof(struct tx_complete_mon_data), GFP_ATOMIC); @@ -298,7 +289,6 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, struct net_device *dev) { - struct ieee80211_radiotap_header *rtap_hdr; u32 rtap_len, i, ret = 0; struct WILC_WFI_mon_priv *mon_priv; @@ -318,7 +308,6 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, return WILC_FAIL; } - rtap_hdr = (struct ieee80211_radiotap_header *)skb->data; rtap_len = ieee80211_get_radiotap_len(skb->data); if (skb->len < rtap_len) { @@ -378,9 +367,7 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb, PRINT_INFO(HOSTAPD_DBG, "SKB netdevice name = %s\n", skb->dev->name); PRINT_INFO(HOSTAPD_DBG, "MONITOR real dev name = %s\n", mon_priv->real_ndev->name); - #ifdef SIMULATION - ret = WILC_WFI_Tx(skb, mon_priv->real_ndev); - #elif USE_WIRELESS + #if USE_WIRELESS /* Identify if Ethernet or MAC header (data or mgmt) */ memcpy(srcAdd, &skb->data[10], 6); memcpy(bssid, &skb->data[16], 6); @@ -493,9 +480,9 @@ static void WILC_WFI_mon_setup(struct net_device *dev) /* dev->destructor = free_netdev; */ PRINT_INFO(CORECONFIG_DBG, "In Ethernet setup function\n"); ether_setup(dev); - dev->tx_queue_len = 0; + dev->priv_flags |= IFF_NO_QUEUE; dev->type = ARPHRD_IEEE80211_RADIOTAP; - memset(dev->dev_addr, 0, ETH_ALEN); + eth_zero_addr(dev->dev_addr); #ifdef USE_WIRELESS { @@ -571,7 +558,7 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_devi * @date 12 JUL 2012 * @version 1.0 */ -int WILC_WFI_deinit_mon_interface() +int WILC_WFI_deinit_mon_interface(void) { bool rollback_lock = false; diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index e52534ce1..7ba8e9efd 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1,4 +1,3 @@ -#ifndef SIMULATION #include "wilc_wfi_cfgoperations.h" #include "linux_wlan_common.h" #include "wilc_wlan_if.h" @@ -72,7 +71,7 @@ extern void resolve_disconnect_aberration(void *drvHandler); extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; void wilc1000_wlan_deinit(linux_wlan_t *nic); #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP -extern WILC_TimerHandle hDuringIpTimer; +extern struct timer_list hDuringIpTimer; #endif static int linux_wlan_device_power(int on_off) @@ -103,7 +102,6 @@ static int linux_wlan_device_detection(int on_off) return 0; } - #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr); @@ -116,7 +114,6 @@ static struct notifier_block g_dev_notifier = { if (g_linux_wlan->oup.wlan_cleanup != NULL) \ g_linux_wlan->oup.wlan_cleanup(); } - #ifndef STA_FIRMWARE #define STA_FIRMWARE "/*(DEBLOBBED)*/" #endif @@ -129,15 +126,12 @@ static struct notifier_block g_dev_notifier = { #define P2P_CONCURRENCY_FIRMWARE "/*(DEBLOBBED)*/" #endif - - typedef struct android_wifi_priv_cmd { char *buf; int used_len; int total_len; } android_wifi_priv_cmd; - #define IRQ_WAIT 1 #define IRQ_NO_WAIT 0 /* @@ -158,7 +152,6 @@ void linux_wlan_unlock(void *vp); extern void WILC_WFI_monitor_rx(uint8_t *buff, uint32_t size); extern void WILC_WFI_p2p_rx(struct net_device *dev, uint8_t *buff, uint32_t size); - static void *internal_alloc(uint32_t size, uint32_t flag); static void linux_wlan_tx_complete(void *priv, int status); void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset); @@ -170,8 +163,6 @@ static struct net_device_stats *mac_stats(struct net_device *dev); static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd); static void wilc_set_multicast_list(struct net_device *dev); - - /* * for now - in frmw_to_linux there should be private data to be passed to it * and this data should be pointer to net device @@ -200,22 +191,18 @@ volatile int WatchDogdebuggerCounter; char DebugBuffer[DEGUG_BUFFER_LENGTH + 20] = {0}; static char *ps8current = DebugBuffer; - - void printk_later(const char *format, ...) { va_list args; - va_start (args, format); - ps8current += vsprintf (ps8current, format, args); - va_end (args); - if ((ps8current - DebugBuffer) > DEGUG_BUFFER_LENGTH) { + va_start(args, format); + ps8current += vsprintf(ps8current, format, args); + va_end(args); + if ((ps8current - DebugBuffer) > DEGUG_BUFFER_LENGTH) ps8current = DebugBuffer; - } } - -void dump_logs() +void dump_logs(void) { if (DebugBuffer[0]) { DebugBuffer[DEGUG_BUFFER_LENGTH] = 0; @@ -229,7 +216,7 @@ void dump_logs() } } -void Reset_WatchDogdebugger() +void Reset_WatchDogdebugger(void) { WatchDogdebuggerCounter = 0; } @@ -246,11 +233,8 @@ static int DebuggingThreadTask(void *vp) WatchDogdebuggerCounter = 0; } } - - #endif - #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP static int dev_state_ev_handler(struct notifier_block *this, unsigned long event, void *ptr) { @@ -298,25 +282,22 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event PRINT_INFO(GENERIC_DBG, "\n ============== IP Address Obtained ===============\n\n"); - /*If we are in station mode or client mode*/ if (nic->iftype == STATION_MODE || nic->iftype == CLIENT_MODE) { pstrWFIDrv->IFC_UP = 1; g_obtainingIP = false; - WILC_TimerStop(&hDuringIpTimer, NULL); + del_timer(&hDuringIpTimer); PRINT_D(GENERIC_DBG, "IP obtained , enable scan\n"); } - - if (bEnablePS) - host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 1, 0); + host_int_set_power_mgmt(pstrWFIDrv, 1, 0); PRINT_D(GENERIC_DBG, "[%s] Up IP\n", dev_iface->ifa_label); pIP_Add_buff = (char *) (&(dev_iface->ifa_address)); - PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d \n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); - host_int_setup_ipaddress((WILC_WFIDrvHandle)pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx); + PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); + host_int_setup_ipaddress(pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx); break; @@ -330,17 +311,16 @@ static int dev_state_ev_handler(struct notifier_block *this, unsigned long event } if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0) - host_int_set_power_mgmt((WILC_WFIDrvHandle)pstrWFIDrv, 0, 0); + host_int_set_power_mgmt(pstrWFIDrv, 0, 0); resolve_disconnect_aberration(pstrWFIDrv); - PRINT_D(GENERIC_DBG, "[%s] Down IP\n", dev_iface->ifa_label); pIP_Add_buff = null_ip; - PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d \n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); + PRINT_D(GENERIC_DBG, "IP add=%d:%d:%d:%d\n", pIP_Add_buff[0], pIP_Add_buff[1], pIP_Add_buff[2], pIP_Add_buff[3]); - host_int_setup_ipaddress((WILC_WFIDrvHandle)pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx); + host_int_setup_ipaddress(pstrWFIDrv, pIP_Add_buff, nic->u8IfIdx); break; @@ -387,8 +367,6 @@ void linux_wlan_disable_irq(int wait) #if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) static irqreturn_t isr_uh_routine(int irq, void *user_data) { - - int_rcvdU++; #if (RX_BH_TYPE != RX_BH_THREADED_IRQ) linux_wlan_disable_irq(IRQ_NO_WAIT); @@ -440,19 +418,14 @@ static void isr_bh_routine(struct work_struct *work) #else return; #endif - - - } int_rcvdB++; PRINT_D(INT_DBG, "Interrupt received BH\n"); - if (g_linux_wlan->oup.wlan_handle_rx_isr != 0) { + if (g_linux_wlan->oup.wlan_handle_rx_isr != 0) g_linux_wlan->oup.wlan_handle_rx_isr(); - } else { + else PRINT_ER("wlan_handle_rx_isr() hasn't been initialized\n"); - } - #if (RX_BH_TYPE == RX_BH_THREADED_IRQ) return IRQ_HANDLED; @@ -476,18 +449,16 @@ static int isr_bh_routine(void *vp) } int_rcvdB++; PRINT_D(INT_DBG, "Interrupt received BH\n"); - if (g_linux_wlan->oup.wlan_handle_rx_isr != 0) { + if (g_linux_wlan->oup.wlan_handle_rx_isr != 0) g_linux_wlan->oup.wlan_handle_rx_isr(); - } else { + else PRINT_ER("wlan_handle_rx_isr() hasn't been initialized\n"); - } } return 0; } #endif - #if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO) static int init_irq(linux_wlan_t *p_nic) { @@ -504,9 +475,9 @@ static int init_irq(linux_wlan_t *p_nic) * * ex) nic->dev_irq_num = gpio_to_irq(GPIO_NUM); */ -#elif defined (NM73131_0_BOARD) +#elif defined(NM73131_0_BOARD) nic->dev_irq_num = IRQ_WILC1000; -#elif defined (PANDA_BOARD) +#elif defined(PANDA_BOARD) gpio_export(GPIO_NUM, 1); nic->dev_irq_num = OMAP_GPIO_IRQ(GPIO_NUM); irq_set_irq_type(nic->dev_irq_num, IRQ_TYPE_LEVEL_LOW); @@ -518,7 +489,6 @@ static int init_irq(linux_wlan_t *p_nic) PRINT_ER("could not obtain gpio for WILC_INTR\n"); } - #if (RX_BH_TYPE == RX_BH_THREADED_IRQ) if ((ret != -1) && (request_threaded_irq(nic->dev_irq_num, isr_uh_routine, isr_bh_routine, IRQF_TRIGGER_LOW | IRQF_ONESHOT, /*Without IRQF_ONESHOT the uh will remain kicked in and dont gave a chance to bh*/ @@ -554,7 +524,6 @@ static void deinit_irq(linux_wlan_t *nic) #endif } - /* * OS functions */ @@ -601,7 +570,6 @@ void linux_wlan_free(void *vp) } } - static void *internal_alloc(uint32_t size, uint32_t flag) { char *pntr = NULL; @@ -610,7 +578,6 @@ static void *internal_alloc(uint32_t size, uint32_t flag) return (void *)pntr; } - static void linux_wlan_init_lock(char *lockName, void *plock, int count) { sema_init((struct semaphore *)plock, count); @@ -638,25 +605,22 @@ static int linux_wlan_lock_timeout(void *vp, u32 timeout) { int error = -1; PRINT_D(LOCK_DBG, "Locking %p\n", vp); - if (vp != NULL) { + if (vp != NULL) error = down_timeout((struct semaphore *)vp, msecs_to_jiffies(timeout)); - } else { + else PRINT_ER("Failed, mutex is NULL\n"); - } return error; } void linux_wlan_unlock(void *vp) { PRINT_D(LOCK_DBG, "Unlocking %p\n", vp); - if (vp != NULL) { + if (vp != NULL) up((struct semaphore *)vp); - } else { + else PRINT_ER("Failed, mutex is NULL\n"); - } } - static void linux_wlan_init_mutex(char *lockName, void *plock, int count) { mutex_init((struct mutex *)plock); @@ -702,7 +666,6 @@ static void linux_wlan_unlock_mutex(void *vp) } } - /*Added by Amr - BugID_4720*/ static void linux_wlan_init_spin_lock(char *lockName, void *plock, int count) { @@ -780,9 +743,8 @@ struct net_device *GetIfHandler(uint8_t *pMacHeader) } } PRINT_INFO(INIT_DBG, "Invalide handle\n"); - for (i = 0; i < 25; i++) { + for (i = 0; i < 25; i++) PRINT_D(INIT_DBG, "%02x ", pMacHeader[i]); - } Bssid = pMacHeader + 18; Bssid1 = pMacHeader + 12; for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) { @@ -822,9 +784,8 @@ int linux_wlan_get_num_conn_ifcs(void) uint8_t ret_val = 0; for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) { - if (memcmp(g_linux_wlan->strInterfaceInfo[i].aBSSID, null_bssid, 6)) { + if (memcmp(g_linux_wlan->strInterfaceInfo[i].aBSSID, null_bssid, 6)) ret_val++; - } } return ret_val; } @@ -868,7 +829,6 @@ static int linux_wlan_txq_task(void *vp) #define TX_BACKOFF_WEIGHT_MIN (0) #define TX_BACKOFF_WEIGHT_UNIT_MS (10) int backoff_weight = TX_BACKOFF_WEIGHT_MIN; - signed long timeout; #endif /* inform wilc1000_wlan_init that TXQ task is started. */ @@ -906,7 +866,6 @@ static int linux_wlan_txq_task(void *vp) } if (ret == WILC_TX_ERR_NO_BUF) { /* failed to allocate buffers in chip. */ - timeout = msecs_to_jiffies(TX_BACKOFF_WEIGHT_UNIT_MS << backoff_weight); do { /* Back off from sending packets for some time. */ /* schedule_timeout will allow RX task to run and free buffers.*/ @@ -915,15 +874,13 @@ static int linux_wlan_txq_task(void *vp) msleep(TX_BACKOFF_WEIGHT_UNIT_MS << backoff_weight); } while (/*timeout*/ 0); backoff_weight += TX_BACKOFF_WEIGHT_INCR_STEP; - if (backoff_weight > TX_BACKOFF_WEIGHT_MAX) { + if (backoff_weight > TX_BACKOFF_WEIGHT_MAX) backoff_weight = TX_BACKOFF_WEIGHT_MAX; - } } else { if (backoff_weight > TX_BACKOFF_WEIGHT_MIN) { backoff_weight -= TX_BACKOFF_WEIGHT_DECR_STEP; - if (backoff_weight < TX_BACKOFF_WEIGHT_MIN) { + if (backoff_weight < TX_BACKOFF_WEIGHT_MIN) backoff_weight = TX_BACKOFF_WEIGHT_MIN; - } } } /*TODO: drop packets after a certain time/number of retry count. */ @@ -946,7 +903,6 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic) const struct firmware *wilc_firmware; char *firmware; - if (nic->iftype == AP_MODE) firmware = AP_FIRMWARE; else if (nic->iftype == STATION_MODE) @@ -958,8 +914,6 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic) firmware = P2P_CONCURRENCY_FIRMWARE; } - - if (nic == NULL) { PRINT_ER("NIC is NULL\n"); goto _fail_; @@ -970,7 +924,6 @@ int linux_wlan_get_firmware(perInterface_wlan_t *p_nic) goto _fail_; } - /* the firmare should be located in /lib/firmware in * root file system with the name specified above */ @@ -1054,9 +1007,8 @@ static int linux_wlan_firmware_download(linux_wlan_t *p_nic) **/ PRINT_D(INIT_DBG, "Downloading Firmware ...\n"); ret = g_linux_wlan->oup.wlan_firmware_download(g_linux_wlan->wilc_firmware->data, g_linux_wlan->wilc_firmware->size); - if (ret < 0) { + if (ret < 0) goto _FAIL_; - } /* Freeing FW buffer */ PRINT_D(INIT_DBG, "Freeing FW buffer ...\n"); @@ -1064,13 +1016,12 @@ static int linux_wlan_firmware_download(linux_wlan_t *p_nic) release_firmware(g_linux_wlan->wilc_firmware); g_linux_wlan->wilc_firmware = NULL; - PRINT_D(INIT_DBG, "Download Succeeded \n"); + PRINT_D(INIT_DBG, "Download Succeeded\n"); _FAIL_: return ret; } - /* startup configuration - could be changed later using iconfig*/ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_nic) { @@ -1096,7 +1047,6 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n PRINT_D(INIT_DBG, "MAC address is : %02x-%02x-%02x-%02x-%02x-%02x\n", mac_add[0], mac_add[1], mac_add[2], mac_add[3], mac_add[4], mac_add[5]); wilc_get_chipid(0); - if (g_linux_wlan->oup.wlan_cfg_set == NULL) { PRINT_D(INIT_DBG, "Null p[ointer\n"); goto _fail_; @@ -1116,7 +1066,6 @@ static int linux_wlan_init_test_config(struct net_device *dev, linux_wlan_t *p_n if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0)) goto _fail_; - /* c_val[0] = RATE_AUTO; / * bug 4275: Enable autorate and limit it to 24Mbps * / */ c_val[0] = RATE_AUTO; if (!g_linux_wlan->oup.wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0)) @@ -1351,7 +1300,6 @@ _fail_: return -1; } - /**************************/ void wilc1000_wlan_deinit(linux_wlan_t *nic) { @@ -1385,16 +1333,12 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic) #endif #endif - /* not sure if the following unlocks are needed or not*/ - if (&g_linux_wlan->rxq_event != NULL) { + if (&g_linux_wlan->rxq_event != NULL) linux_wlan_unlock(&g_linux_wlan->rxq_event); - } - if (&g_linux_wlan->txq_event != NULL) { + if (&g_linux_wlan->txq_event != NULL) linux_wlan_unlock(&g_linux_wlan->txq_event); - } - #if (RX_BH_TYPE == RX_BH_WORK_QUEUE) /*Removing the work struct from the linux kernel workqueue*/ @@ -1412,7 +1356,6 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic) PRINT_D(INIT_DBG, "Deinitializing IRQ\n"); deinit_irq(g_linux_wlan); - if (&g_linux_wlan->oup != NULL) { if (g_linux_wlan->oup.wlan_stop != NULL) g_linux_wlan->oup.wlan_stop(); @@ -1442,7 +1385,6 @@ void wilc1000_wlan_deinit(linux_wlan_t *nic) } else { PRINT_D(INIT_DBG, "wilc1000 is not initialized\n"); } - return; } int wlan_init_locks(linux_wlan_t *p_nic) @@ -1536,7 +1478,7 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic) nwi->os_context.txq_wait_event = (void *)&g_linux_wlan->txq_event; -#if defined (MEMORY_STATIC) +#if defined(MEMORY_STATIC) nwi->os_context.rx_buffer_size = LINUX_RX_SIZE; #endif nwi->os_context.rxq_critical_section = (void *)&g_linux_wlan->rxq_cs; @@ -1673,17 +1615,14 @@ static void wlan_deinitialize_threads(linux_wlan_t *nic) if (&g_linux_wlan->rxq_event != NULL) linux_wlan_unlock(&g_linux_wlan->rxq_event); - if (g_linux_wlan->rxq_thread != NULL) { kthread_stop(g_linux_wlan->rxq_thread); g_linux_wlan->rxq_thread = NULL; } - if (&g_linux_wlan->txq_event != NULL) linux_wlan_unlock(&g_linux_wlan->txq_event); - if (g_linux_wlan->txq_thread != NULL) { kthread_stop(g_linux_wlan->txq_thread); g_linux_wlan->txq_thread = NULL; @@ -1747,14 +1686,12 @@ static int linux_wlan_read_mac_addr(void *vp) } } - if (index == array_size) { + if (index == array_size) PRINT_ER("random MAC\n"); - } exit: - if (fp && !IS_ERR(fp)) { + if (fp && !IS_ERR(fp)) filp_close(fp, NULL); - } set_fs(old_fs); @@ -1786,9 +1723,8 @@ uint8_t wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, wilc_wlan_oup_t *nwo, li sdio_register_driver(&wilc_bus); - while (!probe) { + while (!probe) msleep(100); - } probe = 0; g_linux_wlan->wilc_sdio_func = local_sdio_func; linux_to_wlan(nwi, nic); @@ -1820,9 +1756,8 @@ int repeat_power_cycle(perInterface_wlan_t *nic) sdio_register_driver(&wilc_bus); /* msleep(1000); */ - while (!probe) { + while (!probe) msleep(100); - } probe = 0; g_linux_wlan->wilc_sdio_func = local_sdio_func; linux_to_wlan(&nwi, g_linux_wlan); @@ -1834,7 +1769,7 @@ int repeat_power_cycle(perInterface_wlan_t *nic) #endif if (linux_wlan_get_firmware(nic)) { - PRINT_ER("Can't get firmware \n"); + PRINT_ER("Can't get firmware\n"); ret = -1; goto __fail__; } @@ -1847,9 +1782,8 @@ int repeat_power_cycle(perInterface_wlan_t *nic) } /* Start firmware*/ ret = linux_wlan_start_firmware(nic); - if (ret < 0) { + if (ret < 0) PRINT_ER("Failed to start firmware\n"); - } __fail__: return ret; } @@ -1871,9 +1805,8 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) #ifdef STATIC_MACADDRESS wilc_mac_thread = kthread_run(linux_wlan_read_mac_addr, NULL, "wilc_mac_thread"); - if (wilc_mac_thread < 0) { + if (wilc_mac_thread < 0) PRINT_ER("couldn't create Mac addr thread\n"); - } #endif linux_to_wlan(&nwi, g_linux_wlan); @@ -1889,7 +1822,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) /*Save the oup structre into global pointer*/ gpstrWlanOps = &g_linux_wlan->oup; - ret = wlan_initialize_threads(nic); if (ret < 0) { PRINT_ER("Initializing Threads FAILED\n"); @@ -1922,12 +1854,11 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) #endif if (linux_wlan_get_firmware(nic)) { - PRINT_ER("Can't get firmware \n"); + PRINT_ER("Can't get firmware\n"); ret = -EIO; goto _fail_irq_enable_; } - /*Download firmware*/ ret = linux_wlan_firmware_download(g_linux_wlan); if (ret < 0) { @@ -1967,7 +1898,6 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) g_linux_wlan->wilc1000_initialized = 1; return 0; /*success*/ - _fail_fw_start_: if (&g_linux_wlan->oup != NULL) { if (g_linux_wlan->oup.wlan_stop != NULL) @@ -1996,12 +1926,11 @@ _fail_locks_: return ret; } - /* * - this function will be called automatically by OS when module inserted. */ -#if !defined (NM73131_0_BOARD) +#if !defined(NM73131_0_BOARD) int mac_init_fn(struct net_device *ndev) { @@ -2028,12 +1957,11 @@ int mac_init_fn(struct net_device *ndev) } #endif - void WILC_WFI_frame_register(struct wiphy *wiphy, struct net_device *dev, u16 frame_type, bool reg); /* This fn is called, when this device is setup using ifconfig */ -#if !defined (NM73131_0_BOARD) +#if !defined(NM73131_0_BOARD) int mac_open(struct net_device *ndev) { perInterface_wlan_t *nic; @@ -2078,7 +2006,7 @@ int mac_open(struct net_device *ndev) for (i = 0; i < g_linux_wlan->u8NoIfcs; i++) { if (ndev == g_linux_wlan->strInterfaceInfo[i].wilc_netdev) { memcpy(g_linux_wlan->strInterfaceInfo[i].aSrcAddress, mac_add, ETH_ALEN); - g_linux_wlan->strInterfaceInfo[i].drvHandler = (u32)priv->hWILCWFIDrv; + g_linux_wlan->strInterfaceInfo[i].drvHandler = priv->hWILCWFIDrv; break; } } @@ -2092,7 +2020,6 @@ int mac_open(struct net_device *ndev) goto _err_; } - WILC_WFI_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev, nic->g_struct_frame_reg[0].frame_type, nic->g_struct_frame_reg[0].reg); WILC_WFI_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, nic->wilc_netdev, @@ -2131,7 +2058,6 @@ struct net_device_stats *mac_stats(struct net_device *dev) { perInterface_wlan_t *nic = netdev_priv(dev); - return &nic->netstats; } @@ -2146,17 +2072,16 @@ static void wilc_set_multicast_list(struct net_device *dev) priv = wiphy_priv(dev->ieee80211_ptr->wiphy); pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv; - if (!dev) return; - PRINT_D(INIT_DBG, "Setting Multicast List with count = %d. \n", dev->mc.count); + PRINT_D(INIT_DBG, "Setting Multicast List with count = %d.\n", dev->mc.count); if (dev->flags & IFF_PROMISC) { /* Normally, we should configure the chip to retrive all packets * but we don't wanna support this right now */ /* TODO: add promiscuous mode support */ - PRINT_D(INIT_DBG, "Set promiscuous mode ON, retrive all packets \n"); + PRINT_D(INIT_DBG, "Set promiscuous mode ON, retrive all packets\n"); return; } @@ -2165,27 +2090,27 @@ static void wilc_set_multicast_list(struct net_device *dev) if ((dev->flags & IFF_ALLMULTI) || (dev->mc.count) > WILC_MULTICAST_TABLE_SIZE) { PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n"); /* get all multicast packets */ - host_int_setup_multicast_filter((WILC_WFIDrvHandle)pstrWFIDrv, false, 0); + host_int_setup_multicast_filter(pstrWFIDrv, false, 0); return; } /* No multicast? Just get our own stuff */ if ((dev->mc.count) == 0) { PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n"); - host_int_setup_multicast_filter((WILC_WFIDrvHandle)pstrWFIDrv, true, 0); + host_int_setup_multicast_filter(pstrWFIDrv, true, 0); return; } /* Store all of the multicast addresses in the hardware filter */ netdev_for_each_mc_addr(ha, dev) { - WILC_memcpy(gau8MulticastMacAddrList[i], ha->addr, ETH_ALEN); + memcpy(gau8MulticastMacAddrList[i], ha->addr, ETH_ALEN); PRINT_D(INIT_DBG, "Entry[%d]: %x:%x:%x:%x:%x:%x\n", i, gau8MulticastMacAddrList[i][0], gau8MulticastMacAddrList[i][1], gau8MulticastMacAddrList[i][2], gau8MulticastMacAddrList[i][3], gau8MulticastMacAddrList[i][4], gau8MulticastMacAddrList[i][5]); i++; } - host_int_setup_multicast_filter((WILC_WFIDrvHandle)pstrWFIDrv, true, (dev->mc.count)); + host_int_setup_multicast_filter(pstrWFIDrv, true, (dev->mc.count)); return; @@ -2195,11 +2120,10 @@ static void linux_wlan_tx_complete(void *priv, int status) { struct tx_complete_data *pv_data = (struct tx_complete_data *)priv; - if (status == 1) { + if (status == 1) PRINT_D(TX_DBG, "Packet sent successfully - Size = %d - Address = %p - SKB = %p\n", pv_data->size, pv_data->buff, pv_data->skb); - } else { + else PRINT_D(TX_DBG, "Couldn't send packet - Size = %d - Address = %p - SKB = %p\n", pv_data->size, pv_data->buff, pv_data->skb); - } /* Free the SK Buffer, its work is done */ dev_kfree_skb(pv_data->skb); linux_wlan_free(pv_data); @@ -2215,7 +2139,7 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) struct ethhdr *eth_h; nic = netdev_priv(ndev); - PRINT_D(INT_DBG, "\n========\n IntUH: %d - IntBH: %d - IntCld: %d \n========\n", int_rcvdU, int_rcvdB, int_clrd); + PRINT_D(INT_DBG, "\n========\n IntUH: %d - IntBH: %d - IntCld: %d\n========\n", int_rcvdU, int_rcvdB, int_clrd); PRINT_D(TX_DBG, "Sending packet just received from TCP/IP\n"); /* Stop the network interface queue */ @@ -2237,18 +2161,16 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) tx_data->skb = skb; eth_h = (struct ethhdr *)(skb->data); - if (eth_h->h_proto == 0x8e88) { + if (eth_h->h_proto == 0x8e88) PRINT_D(INIT_DBG, "EAPOL transmitted\n"); - } /*get source and dest ip addresses*/ ih = (struct iphdr *)(skb->data + sizeof(struct ethhdr)); pu8UdpBuffer = (char *)ih + sizeof(struct iphdr); - if ((pu8UdpBuffer[1] == 68 && pu8UdpBuffer[3] == 67) || (pu8UdpBuffer[1] == 67 && pu8UdpBuffer[3] == 68)) { + if ((pu8UdpBuffer[1] == 68 && pu8UdpBuffer[3] == 67) || (pu8UdpBuffer[1] == 67 && pu8UdpBuffer[3] == 68)) PRINT_D(GENERIC_DBG, "DHCP Message transmitted, type:%x %x %x\n", pu8UdpBuffer[248], pu8UdpBuffer[249], pu8UdpBuffer[250]); - } PRINT_D(TX_DBG, "Sending packet - Size = %d - Address = %p - SKB = %p\n", tx_data->size, tx_data->buff, tx_data->skb); /* Send packet to MAC HW - for now the tx_complete function will be just status @@ -2269,7 +2191,6 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) QueueCount = WILC_Xmit_data((void *)tx_data, HOST_TO_WLAN); #endif /* WILC_FULLY_HOSTING_AP */ - if (QueueCount > FLOW_CONTROL_UPPER_THRESHOLD) { netif_stop_queue(g_linux_wlan->strInterfaceInfo[0].wilc_netdev); netif_stop_queue(g_linux_wlan->strInterfaceInfo[1].wilc_netdev); @@ -2278,7 +2199,6 @@ int mac_xmit(struct sk_buff *skb, struct net_device *ndev) return 0; } - int mac_close(struct net_device *ndev) { struct WILC_WFI_priv *priv; @@ -2301,8 +2221,6 @@ int mac_close(struct net_device *ndev) pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv; - - PRINT_D(GENERIC_DBG, "Mac close\n"); if (g_linux_wlan == NULL) { @@ -2348,7 +2266,6 @@ int mac_close(struct net_device *ndev) return 0; } - int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) { @@ -2359,8 +2276,6 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) struct WILC_WFI_priv *priv; s32 s32Error = WILC_SUCCESS; - - /* struct iwreq *wrq = (struct iwreq *) req; // tony moved to case SIOCSIWPRIV */ #ifdef USE_WIRELESS nic = netdev_priv(ndev); @@ -2422,9 +2337,7 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) done: - if (buff != NULL) { - kfree(buff); - } + kfree(buff); return s32Error; } @@ -2455,7 +2368,6 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset) frame_len = size; buff_to_send = buff; - /* Need to send the packet up to the host, allocate a skb buffer */ skb = dev_alloc_skb(frame_len); if (skb == NULL) { @@ -2465,14 +2377,12 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset) skb_reserve(skb, (unsigned int)skb->data & 0x3); - if (g_linux_wlan == NULL || wilc_netdev == NULL) { + if (g_linux_wlan == NULL || wilc_netdev == NULL) PRINT_ER("wilc_netdev in g_linux_wlan is NULL"); - } skb->dev = wilc_netdev; - if (skb->dev == NULL) { + if (skb->dev == NULL) PRINT_ER("skb->dev is NULL\n"); - } /* * for(i=0;i<40;i++) @@ -2502,9 +2412,8 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset) ih = (struct iphdr *)(skb->data + sizeof(struct ethhdr)); pu8UdpBuffer = (char *)ih + sizeof(struct iphdr); - if (buff_to_send[35] == 67 && buff_to_send[37] == 68) { + if (buff_to_send[35] == 67 && buff_to_send[37] == 68) PRINT_D(RX_DBG, "DHCP Message received\n"); - } if (buff_to_send[12] == 0x88 && buff_to_send[13] == 0x8e) PRINT_D(GENERIC_DBG, "eapol received\n"); #endif @@ -2516,9 +2425,8 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset) PRINT_D(RX_DBG, "netif_rx ret value is: %d\n", stats); } #ifndef TCP_ENHANCEMENTS - else { + else PRINT_ER("Discard sending packet with len = %d\n", size); - } #endif } @@ -2541,9 +2449,8 @@ void WILC_WFI_mgmt_rx(uint8_t *buff, uint32_t size) #ifdef WILC_P2P nic = netdev_priv(g_linux_wlan->strInterfaceInfo[1].wilc_netdev); /* p2p0 */ if ((buff[0] == nic->g_struct_frame_reg[0].frame_type && nic->g_struct_frame_reg[0].reg) || - (buff[0] == nic->g_struct_frame_reg[1].frame_type && nic->g_struct_frame_reg[1].reg)) { + (buff[0] == nic->g_struct_frame_reg[1].frame_type && nic->g_struct_frame_reg[1].reg)) WILC_WFI_p2p_rx(g_linux_wlan->strInterfaceInfo[1].wilc_netdev, buff, size); - } #endif } @@ -2557,7 +2464,7 @@ int wilc_netdev_init(void) linux_wlan_init_lock("close_exit_sync", &close_exit_sync, 0); /*create the common structure*/ - g_linux_wlan = (linux_wlan_t *)WILC_MALLOC(sizeof(linux_wlan_t)); + g_linux_wlan = WILC_MALLOC(sizeof(linux_wlan_t)); memset(g_linux_wlan, 0, sizeof(linux_wlan_t)); /*Reset interrupt count debug*/ @@ -2625,7 +2532,6 @@ int wilc_netdev_init(void) } #endif - if (register_netdev(ndev)) { PRINT_ER("Device couldn't be registered - %s\n", ndev->name); return -1; /* ERROR */ @@ -2638,7 +2544,7 @@ int wilc_netdev_init(void) #ifndef WILC_SDIO if (!linux_spi_init(&g_linux_wlan->wilc_spidev)) { - PRINT_ER("Can't initialize SPI \n"); + PRINT_ER("Can't initialize SPI\n"); return -1; /* ERROR */ } g_linux_wlan->wilc_spidev = wilc_spi_dev; @@ -2649,13 +2555,10 @@ int wilc_netdev_init(void) return 0; } - /*The 1st function called after module inserted*/ static int __init init_wilc_driver(void) { - - -#if defined (WILC_DEBUGFS) +#if defined(WILC_DEBUGFS) if (wilc_debugfs_init() < 0) { PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc driver\n"); return -1; @@ -2674,17 +2577,15 @@ static int __init init_wilc_driver(void) int ret; ret = sdio_register_driver(&wilc_bus); - if (ret < 0) { + if (ret < 0) PRINT_D(INIT_DBG, "init_wilc_driver: Failed register sdio driver\n"); - } return ret; } #else PRINT_D(INIT_DBG, "Initializing netdev\n"); - if (wilc_netdev_init()) { + if (wilc_netdev_init()) PRINT_ER("Couldn't initialize netdev\n"); - } return 0; #endif } @@ -2702,18 +2603,15 @@ static void __exit exit_wilc_driver(void) unregister_inetaddr_notifier(&g_dev_notifier); #endif - for (i = 0; i < NUM_CONCURRENT_IFC; i++) { + for (i = 0; i < NUM_CONCURRENT_IFC; i++) nic[i] = netdev_priv(g_linux_wlan->strInterfaceInfo[i].wilc_netdev); - } } - if ((g_linux_wlan != NULL) && g_linux_wlan->wilc_firmware != NULL) { release_firmware(g_linux_wlan->wilc_firmware); g_linux_wlan->wilc_firmware = NULL; } - if ((g_linux_wlan != NULL) && (((g_linux_wlan->strInterfaceInfo[0].wilc_netdev) != NULL) || ((g_linux_wlan->strInterfaceInfo[1].wilc_netdev) != NULL))) { PRINT_D(INIT_DBG, "Waiting for mac_close ....\n"); @@ -2723,17 +2621,15 @@ static void __exit exit_wilc_driver(void) else PRINT_D(INIT_DBG, "mac_closed\n"); - for (i = 0; i < NUM_CONCURRENT_IFC; i++) { /* close all opened interfaces */ if (g_linux_wlan->strInterfaceInfo[i].wilc_netdev != NULL) { - if (nic[i]->mac_opened) { + if (nic[i]->mac_opened) mac_close(g_linux_wlan->strInterfaceInfo[i].wilc_netdev); - } } } for (i = 0; i < NUM_CONCURRENT_IFC; i++) { - PRINT_D(INIT_DBG, "Unregistering netdev %p \n", g_linux_wlan->strInterfaceInfo[i].wilc_netdev); + PRINT_D(INIT_DBG, "Unregistering netdev %p\n", g_linux_wlan->strInterfaceInfo[i].wilc_netdev); unregister_netdev(g_linux_wlan->strInterfaceInfo[i].wilc_netdev); #ifdef USE_WIRELESS PRINT_D(INIT_DBG, "Freeing Wiphy...\n"); @@ -2744,7 +2640,6 @@ static void __exit exit_wilc_driver(void) } } - #ifdef USE_WIRELESS #ifdef WILC_AP_EXTERNAL_MLME /* Bug 4600 : WILC_WFI_deinit_mon_interface was already called at mac_close */ @@ -2764,12 +2659,12 @@ static void __exit exit_wilc_driver(void) linux_wlan_deinit_lock(&close_exit_sync); if (g_linux_wlan != NULL) { - WILC_FREE(g_linux_wlan); + kfree(g_linux_wlan); g_linux_wlan = NULL; } printk("Module_exit Done.\n"); -#if defined (WILC_DEBUGFS) +#if defined(WILC_DEBUGFS) wilc_debugfs_remove(); #endif @@ -2780,4 +2675,3 @@ static void __exit exit_wilc_driver(void) module_exit(exit_wilc_driver); MODULE_LICENSE("GPL"); -#endif diff --git a/drivers/staging/wilc1000/linux_wlan_common.h b/drivers/staging/wilc1000/linux_wlan_common.h index 2476bfda1..e6ebf3e89 100644 --- a/drivers/staging/wilc1000/linux_wlan_common.h +++ b/drivers/staging/wilc1000/linux_wlan_common.h @@ -39,8 +39,8 @@ enum debug_region { #define FIRM_DBG (1 << Firmware_debug) #if defined (WILC_DEBUGFS) -extern int wilc_debugfs_init(void); -extern void wilc_debugfs_remove(void); +int wilc_debugfs_init(void); +void wilc_debugfs_remove(void); extern atomic_t REGION; extern atomic_t DEBUG_LEVEL; diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c b/drivers/staging/wilc1000/linux_wlan_sdio.c index 858e3a191..37f31f455 100644 --- a/drivers/staging/wilc1000/linux_wlan_sdio.c +++ b/drivers/staging/wilc1000/linux_wlan_sdio.c @@ -31,7 +31,6 @@ struct sdio_func *local_sdio_func; extern linux_wlan_t *g_linux_wlan; extern int wilc_netdev_init(void); -extern int sdio_clear_int(void); extern void wilc_handle_isr(void); static unsigned int sdio_default_speed; diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c index c328208cd..ae111862e 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c +++ b/drivers/staging/wilc1000/wilc_debugfs.c @@ -48,38 +48,28 @@ static ssize_t wilc_debug_level_read(struct file *file, char __user *userbuf, si return simple_read_from_buffer(userbuf, count, ppos, buf, res); } -static ssize_t wilc_debug_level_write(struct file *filp, const char *buf, size_t count, loff_t *ppos) +static ssize_t wilc_debug_level_write(struct file *filp, const char __user *buf, + size_t count, loff_t *ppos) { - char buffer[128] = {}; int flag = 0; + int ret; - if (count > sizeof(buffer)) - return -EINVAL; - - if (copy_from_user(buffer, buf, count)) { - return -EFAULT; - } - - flag = buffer[0] - '0'; - - if (flag > 0) { - flag = DEBUG | ERR; - } else if (flag < 0) { - flag = 100; - } + ret = kstrtouint_from_user(buf, count, 16, &flag); + if (ret) + return ret; if (flag > DBG_LEVEL_ALL) { printk("%s, value (0x%08x) is out of range, stay previous flag (0x%08x)\n", __func__, flag, atomic_read(&DEBUG_LEVEL)); - return -EFAULT; + return -EINVAL; } atomic_set(&DEBUG_LEVEL, (int)flag); - if (flag == 0) { + if (flag == 0) printk("Debug-level disabled\n"); - } else { + else printk("Debug-level enabled\n"); - } + return count; } diff --git a/drivers/staging/wilc1000/wilc_exported_buf.c b/drivers/staging/wilc1000/wilc_exported_buf.c index 529457816..c3f6a0a1c 100644 --- a/drivers/staging/wilc1000/wilc_exported_buf.c +++ b/drivers/staging/wilc1000/wilc_exported_buf.c @@ -8,9 +8,6 @@ #define LINUX_TX_SIZE (64 * 1024) #define WILC1000_FW_SIZE (4 * 1024) -#define DECLARE_WILC_BUFFER(name) \ - void *exported_ ## name = NULL; - #define MALLOC_WILC_BUFFER(name, size) \ exported_ ## name = kmalloc(size, GFP_KERNEL); \ if (!exported_ ## name) { \ @@ -24,9 +21,9 @@ /* * Add necessary buffer pointers */ -DECLARE_WILC_BUFFER(g_tx_buf) -DECLARE_WILC_BUFFER(g_rx_buf) -DECLARE_WILC_BUFFER(g_fw_buf) +void *exported_g_tx_buf; +void *exported_g_rx_buf; +void *exported_g_fw_buf; void *get_tx_buffer(void) { @@ -65,12 +62,10 @@ static void __exit wilc_module_deinit(void) FREE_WILC_BUFFER(g_tx_buf) FREE_WILC_BUFFER(g_rx_buf) FREE_WILC_BUFFER(g_fw_buf) - - return; } MODULE_LICENSE("Dual BSD/GPL"); MODULE_AUTHOR("Tony Cho"); MODULE_DESCRIPTION("WILC1xxx Memory Manager"); pure_initcall(wilc_module_init); -module_exit(wilc_module_deinit); \ No newline at end of file +module_exit(wilc_module_deinit); diff --git a/drivers/staging/wilc1000/wilc_log.h b/drivers/staging/wilc1000/wilc_log.h deleted file mode 100644 index 2269ebdec..000000000 --- a/drivers/staging/wilc1000/wilc_log.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef __WILC_LOG_H__ -#define __WILC_LOG_H__ - -/* Errors will always get printed */ -#define WILC_ERROR(...) do { WILC_PRINTF("(ERR)(%s:%d) ", __WILC_FUNCTION__, __WILC_LINE__); \ - WILC_PRINTF(__VA_ARGS__); \ - } while (0) - -/* Wraning only printed if verbosity is 1 or more */ -#if (WILC_LOG_VERBOSITY_LEVEL > 0) -#define WILC_WARN(...) do { WILC_PRINTF("(WRN)"); \ - WILC_PRINTF(__VA_ARGS__); \ - } while (0) -#else -#define WILC_WARN(...) (0) -#endif - -/* Info only printed if verbosity is 2 or more */ -#if (WILC_LOG_VERBOSITY_LEVEL > 1) -#define WILC_INFO(...) do { WILC_PRINTF("(INF)"); \ - WILC_PRINTF(__VA_ARGS__); \ - } while (0) -#else -#define WILC_INFO(...) (0) -#endif - -/* Debug is only printed if verbosity is 3 or more */ -#if (WILC_LOG_VERBOSITY_LEVEL > 2) -#define WILC_DBG(...) do { WILC_PRINTF("(DBG)(%s:%d) ", __WILC_FUNCTION__, __WILC_LINE__); \ - WILC_PRINTF(__VA_ARGS__); \ - } while (0) - -#else -#define WILC_DBG(...) (0) -#endif - -/* Function In/Out is only printed if verbosity is 4 or more */ -#if (WILC_LOG_VERBOSITY_LEVEL > 3) -#define WILC_FN_IN do { WILC_PRINTF("(FIN) (%s:%d) \n", __WILC_FUNCTION__, __WILC_LINE__); } while (0) -#define WILC_FN_OUT(ret) do { WILC_PRINTF("(FOUT) (%s:%d) %d.\n", __WILC_FUNCTION__, __WILC_LINE__, (ret)); } while (0) -#else -#define WILC_FN_IN (0) -#define WILC_FN_OUT(ret) (0) -#endif - - -#endif \ No newline at end of file diff --git a/drivers/staging/wilc1000/wilc_memory.c b/drivers/staging/wilc1000/wilc_memory.c index c70707fef..e90a95705 100644 --- a/drivers/staging/wilc1000/wilc_memory.c +++ b/drivers/staging/wilc1000/wilc_memory.c @@ -9,50 +9,8 @@ void *WILC_MemoryAlloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, char *pcFileName, u32 u32LineNo) { - if (u32Size > 0) { + if (u32Size > 0) return kmalloc(u32Size, GFP_ATOMIC); - } else { + else return NULL; - } -} - -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void *WILC_MemoryCalloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, - char *pcFileName, u32 u32LineNo) -{ - return kcalloc(u32Size, 1, GFP_KERNEL); -} - -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void *WILC_MemoryRealloc(void *pvOldBlock, u32 u32NewSize, - tstrWILC_MemoryAttrs *strAttrs, char *pcFileName, u32 u32LineNo) -{ - if (u32NewSize == 0) { - kfree(pvOldBlock); - return NULL; - } else if (pvOldBlock == NULL) { - return kmalloc(u32NewSize, GFP_KERNEL); - } else { - return krealloc(pvOldBlock, u32NewSize, GFP_KERNEL); - } - -} - -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, - char *pcFileName, u32 u32LineNo) -{ - kfree(pvBlock); } diff --git a/drivers/staging/wilc1000/wilc_memory.h b/drivers/staging/wilc1000/wilc_memory.h index 372d7053e..f19cec11a 100644 --- a/drivers/staging/wilc1000/wilc_memory.h +++ b/drivers/staging/wilc1000/wilc_memory.h @@ -38,8 +38,6 @@ typedef struct { * @sa sttrWILC_MemoryAttrs * @sa WILC_MALLOC * @sa WILC_MALLOC_EX - * @sa WILC_NEW - * @sa WILC_NEW_EX * @author syounan * @date 16 Aug 2010 * @version 1.0 @@ -47,78 +45,6 @@ typedef struct { void *WILC_MemoryAlloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, char *pcFileName, u32 u32LineNo); -/*! - * @brief Allocates a given size of bytes and zero filling it - * @param[in] u32Size size of memory in bytes to be allocated - * @param[in] strAttrs Optional attributes, NULL for default - * if not NULL, pAllocationPool should point to the pool to use for - * this allocation. if NULL memory will be allocated directly from - * the system - * @param[in] pcFileName file name of the calling code for debugging - * @param[in] u32LineNo line number of the calling code for debugging - * @return The new allocated block, NULL if allocation fails - * @note It is recommended to use of of the wrapper macros instead of - * calling this function directly - * @sa sttrWILC_MemoryAttrs - * @sa WILC_CALLOC - * @sa WILC_CALLOC_EX - * @sa WILC_NEW_0 - * @sa WILC_NEW_0_EX - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -void *WILC_MemoryCalloc(u32 u32Size, tstrWILC_MemoryAttrs *strAttrs, - char *pcFileName, u32 u32LineNo); - -/*! - * @brief Reallocates a given block to a new size - * @param[in] pvOldBlock the old memory block, if NULL then this function - * behaves as a new allocation function - * @param[in] u32NewSize size of the new memory block in bytes, if zero then - * this function behaves as a free function - * @param[in] strAttrs Optional attributes, NULL for default - * if pAllocationPool!=NULL and pvOldBlock==NULL, pAllocationPool - * should point to the pool to use for this allocation. - * if pAllocationPool==NULL and pvOldBlock==NULL memory will be - * allocated directly from the system - * if and pvOldBlock!=NULL, pAllocationPool will not be inspected - * and reallocation is done from the same pool as the original block - * @param[in] pcFileName file name of the calling code for debugging - * @param[in] u32LineNo line number of the calling code for debugging - * @return The new allocated block, possibly same as pvOldBlock - * @note It is recommended to use of of the wrapper macros instead of - * calling this function directly - * @sa sttrWILC_MemoryAttrs - * @sa WILC_REALLOC - * @sa WILC_REALLOC_EX - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -void *WILC_MemoryRealloc(void *pvOldBlock, u32 u32NewSize, - tstrWILC_MemoryAttrs *strAttrs, char *pcFileName, u32 u32LineNo); - -/*! - * @brief Frees given block - * @param[in] pvBlock the memory block to be freed - * @param[in] strAttrs Optional attributes, NULL for default - * @param[in] pcFileName file name of the calling code for debugging - * @param[in] u32LineNo line number of the calling code for debugging - * @note It is recommended to use of of the wrapper macros instead of - * calling this function directly - * @sa sttrWILC_MemoryAttrs - * @sa WILC_FREE - * @sa WILC_FREE_EX - * @sa WILC_FREE_SET_NULL - * @sa WILC_FREE_IF_TRUE - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, - char *pcFileName, u32 u32LineNo); - /*! * @brief standrad malloc wrapper with custom attributes */ @@ -126,62 +52,6 @@ void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, (WILC_MemoryAlloc( \ (__size__), __attrs__, NULL, 0)) -/*! - * @brief standrad calloc wrapper with custom attributes - */ - #define WILC_CALLOC_EX(__size__, __attrs__) \ - (WILC_MemoryCalloc( \ - (__size__), __attrs__, NULL, 0)) - -/*! - * @brief standrad realloc wrapper with custom attributes - */ - #define WILC_REALLOC_EX(__ptr__, __new_size__, __attrs__) \ - (WILC_MemoryRealloc( \ - (__ptr__), (__new_size__), __attrs__, NULL, 0)) -/*! - * @brief standrad free wrapper with custom attributes - */ - #define WILC_FREE_EX(__ptr__, __attrs__) \ - (WILC_MemoryFree( \ - (__ptr__), __attrs__, NULL, 0)) - -/*! - * @brief Allocates a block (with custom attributes) of given type and number of - * elements - */ -#define WILC_NEW_EX(__struct_type__, __n_structs__, __attrs__) \ - ((__struct_type__ *)WILC_MALLOC_EX( \ - sizeof(__struct_type__) * (u32)(__n_structs__), __attrs__)) - -/*! - * @brief Allocates a block (with custom attributes) of given type and number of - * elements and Zero-fills it - */ -#define WILC_NEW_0_EX(__struct_type__, __n_structs__, __attrs__) \ - ((__struct_type__ *)WILC_CALLOC_EX( \ - sizeof(__struct_type__) * (u32)(__n_structs__), __attrs__)) - -/*! - * @brief Frees a block (with custom attributes), also setting the original pointer - * to NULL - */ -#define WILC_FREE_SET_NULL_EX(__ptr__, __attrs__) do { \ - if (__ptr__ != NULL) { \ - WILC_FREE_EX(__ptr__, __attrs__); \ - __ptr__ = NULL; \ - } \ -} while (0) - -/*! - * @brief Frees a block (with custom attributes) if the pointer expression evaluates - * to true - */ -#define WILC_FREE_IF_TRUE_EX(__ptr__, __attrs__) do { \ - if (__ptr__ != NULL) { \ - WILC_FREE_EX(__ptr__, __attrs__); \ - } \ -} while (0) /*! * @brief standrad malloc wrapper with default attributes @@ -189,51 +59,8 @@ void WILC_MemoryFree(const void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, #define WILC_MALLOC(__size__) \ WILC_MALLOC_EX(__size__, NULL) -/*! - * @brief standrad calloc wrapper with default attributes - */ -#define WILC_CALLOC(__size__) \ - WILC_CALLOC_EX(__size__, NULL) - -/*! - * @brief standrad realloc wrapper with default attributes - */ -#define WILC_REALLOC(__ptr__, __new_size__) \ - WILC_REALLOC_EX(__ptr__, __new_size__, NULL) -/*! - * @brief standrad free wrapper with default attributes - */ -#define WILC_FREE(__ptr__) \ - WILC_FREE_EX(__ptr__, NULL) -/*! - * @brief Allocates a block (with default attributes) of given type and number of - * elements - */ -#define WILC_NEW(__struct_type__, __n_structs__) \ - WILC_NEW_EX(__struct_type__, __n_structs__, NULL) - -/*! - * @brief Allocates a block (with default attributes) of given type and number of - * elements and Zero-fills it - */ -#define WILC_NEW_0(__struct_type__, __n_structs__) \ - WILC_NEW_O_EX(__struct_type__, __n_structs__, NULL) - -/*! - * @brief Frees a block (with default attributes), also setting the original pointer - * to NULL - */ -#define WILC_FREE_SET_NULL(__ptr__) \ - WILC_FREE_SET_NULL_EX(__ptr__, NULL) - -/*! - * @brief Frees a block (with default attributes) if the pointer expression evaluates - * to true - */ -#define WILC_FREE_IF_TRUE(__ptr__) \ - WILC_FREE_IF_TRUE_EX(__ptr__, NULL) #endif diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c index 16bcef4b5..70e4fa6a0 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.c +++ b/drivers/staging/wilc1000/wilc_msgqueue.c @@ -8,8 +8,7 @@ * @note copied from FLO glue implementatuion * @version 1.0 */ -WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle, - tstrWILC_MsgQueueAttrs *pstrAttrs) +WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle) { spin_lock_init(&pHandle->strCriticalSection); sema_init(&pHandle->hSem, 0); @@ -25,8 +24,7 @@ WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle, * @note copied from FLO glue implementatuion * @version 1.0 */ -WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle, - tstrWILC_MsgQueueAttrs *pstrAttrs) +WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle) { pHandle->bExiting = true; @@ -39,7 +37,7 @@ WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle, while (pHandle->pstrMessageList != NULL) { Message *pstrMessge = pHandle->pstrMessageList->pstrNext; - WILC_FREE(pHandle->pstrMessageList); + kfree(pHandle->pstrMessageList); pHandle->pstrMessageList = pstrMessge; } @@ -53,8 +51,7 @@ WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle, * @version 1.0 */ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, - const void *pvSendBuffer, u32 u32SendBufferSize, - tstrWILC_MsgQueueAttrs *pstrAttrs) + const void *pvSendBuffer, u32 u32SendBufferSize) { WILC_ErrNo s32RetStatus = WILC_SUCCESS; unsigned long flags; @@ -71,13 +68,13 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, spin_lock_irqsave(&pHandle->strCriticalSection, flags); /* construct a new message */ - pstrMessage = WILC_NEW(Message, 1); + pstrMessage = kmalloc(sizeof(Message), GFP_ATOMIC); WILC_NULLCHECK(s32RetStatus, pstrMessage); pstrMessage->u32Length = u32SendBufferSize; pstrMessage->pstrNext = NULL; pstrMessage->pvBuffer = WILC_MALLOC(u32SendBufferSize); WILC_NULLCHECK(s32RetStatus, pstrMessage->pvBuffer); - WILC_memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize); + memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize); /* add it to the message queue */ @@ -100,9 +97,9 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, /* error occured, free any allocations */ if (pstrMessage != NULL) { if (pstrMessage->pvBuffer != NULL) { - WILC_FREE(pstrMessage->pvBuffer); + kfree(pstrMessage->pvBuffer); } - WILC_FREE(pstrMessage); + kfree(pstrMessage); } } @@ -119,8 +116,7 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, */ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle, void *pvRecvBuffer, u32 u32RecvBufferSize, - u32 *pu32ReceivedLength, - tstrWILC_MsgQueueAttrs *pstrAttrs) + u32 *pu32ReceivedLength) { Message *pstrMessage; @@ -170,13 +166,13 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle, /* consume the message */ pHandle->u32ReceiversCount--; - WILC_memcpy(pvRecvBuffer, pstrMessage->pvBuffer, pstrMessage->u32Length); + memcpy(pvRecvBuffer, pstrMessage->pvBuffer, pstrMessage->u32Length); *pu32ReceivedLength = pstrMessage->u32Length; pHandle->pstrMessageList = pstrMessage->pstrNext; - WILC_FREE(pstrMessage->pvBuffer); - WILC_FREE(pstrMessage); + kfree(pstrMessage->pvBuffer); + kfree(pstrMessage); spin_unlock_irqrestore(&pHandle->strCriticalSection, flags); diff --git a/drivers/staging/wilc1000/wilc_msgqueue.h b/drivers/staging/wilc1000/wilc_msgqueue.h index 35b10019e..ef1d2fa20 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.h +++ b/drivers/staging/wilc1000/wilc_msgqueue.h @@ -13,20 +13,6 @@ #include "wilc_platform.h" #include "wilc_errorsupport.h" #include "wilc_memory.h" -#include "wilc_strutils.h" - -/*! - * @struct tstrWILC_MsgQueueAttrs - * @brief Message Queue API options - * @author syounan - * @date 30 Aug 2010 - * @version 1.0 - */ -typedef struct { - /* a dummy member to avoid compiler errors*/ - u8 dummy; - -} tstrWILC_MsgQueueAttrs; /*! * @brief Creates a new Message queue @@ -37,14 +23,11 @@ typedef struct { * @param[in,out] pHandle handle to the message queue object * @param[in] pstrAttrs Optional attributes, NULL for default * @return Error code indicating sucess/failure - * @sa tstrWILC_MsgQueueAttrs * @author syounan * @date 30 Aug 2010 * @version 1.0 */ -WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle, - tstrWILC_MsgQueueAttrs *pstrAttrs); - +WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle); /*! * @brief Sends a message @@ -57,15 +40,12 @@ WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle, * @param[in] u32SendBufferSize the size of the data to send * @param[in] pstrAttrs Optional attributes, NULL for default * @return Error code indicating sucess/failure - * @sa tstrWILC_MsgQueueAttrs * @author syounan * @date 30 Aug 2010 * @version 1.0 */ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, - const void *pvSendBuffer, u32 u32SendBufferSize, - tstrWILC_MsgQueueAttrs *pstrAttrs); - + const void *pvSendBuffer, u32 u32SendBufferSize); /*! * @brief Receives a message @@ -79,30 +59,23 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, * @param[out] pu32ReceivedLength the length of received data * @param[in] pstrAttrs Optional attributes, NULL for default * @return Error code indicating sucess/failure - * @sa tstrWILC_MsgQueueAttrs * @author syounan * @date 30 Aug 2010 * @version 1.0 */ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle, void *pvRecvBuffer, u32 u32RecvBufferSize, - u32 *pu32ReceivedLength, - tstrWILC_MsgQueueAttrs *pstrAttrs); - + u32 *pu32ReceivedLength); /*! * @brief Destroys an existing Message queue * @param[in] pHandle handle to the message queue object * @param[in] pstrAttrs Optional attributes, NULL for default * @return Error code indicating sucess/failure - * @sa tstrWILC_MsgQueueAttrs * @author syounan * @date 30 Aug 2010 * @version 1.0 */ -WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle, - tstrWILC_MsgQueueAttrs *pstrAttrs); - - +WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle); #endif diff --git a/drivers/staging/wilc1000/wilc_osconfig.h b/drivers/staging/wilc1000/wilc_osconfig.h deleted file mode 100644 index f9c251403..000000000 --- a/drivers/staging/wilc1000/wilc_osconfig.h +++ /dev/null @@ -1,9 +0,0 @@ -/* Logs options */ -#define WILC_LOGS_NOTHING 0 -#define WILC_LOGS_WARN 1 -#define WILC_LOGS_WARN_INFO 2 -#define WILC_LOGS_WARN_INFO_DBG 3 -#define WILC_LOGS_WARN_INFO_DBG_FN 4 -#define WILC_LOGS_ALL 5 - -#define WILC_LOG_VERBOSITY_LEVEL WILC_LOGS_ALL diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index e97aa9600..cb483253e 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -14,26 +14,14 @@ #define WILC_OSW_INTERFACE_VER 2 /* Os Configuration File */ -#include "wilc_osconfig.h" #include "wilc_platform.h" -/* Logging Functions */ -#include "wilc_log.h" - /* Error reporting and handling support */ #include "wilc_errorsupport.h" -/* Sleep support */ -#include "wilc_sleep.h" - -/* Timer support */ -#include "wilc_timer.h" - /* Memory support */ #include "wilc_memory.h" -/* String Utilities */ -#include "wilc_strutils.h" /* Message Queue */ #include "wilc_msgqueue.h" diff --git a/drivers/staging/wilc1000/wilc_platform.h b/drivers/staging/wilc1000/wilc_platform.h index d03532cc3..1e56973f2 100644 --- a/drivers/staging/wilc1000/wilc_platform.h +++ b/drivers/staging/wilc1000/wilc_platform.h @@ -1,5 +1,5 @@ -#ifndef __WILC_platfrom_H__ -#define __WILC_platfrom_H__ +#ifndef __WILC_platform_H__ +#define __WILC_platform_H__ #include #include @@ -16,10 +16,6 @@ * OS specific types *******************************************************************/ -typedef struct timer_list WILC_TimerHandle; - - - /* Message Queue type is a structure */ typedef struct __Message_struct { void *pvBuffer; diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c index 897e47e31..5a18148a5 100644 --- a/drivers/staging/wilc1000/wilc_sdio.c +++ b/drivers/staging/wilc1000/wilc_sdio.c @@ -10,17 +10,7 @@ #include "wilc_wlan_if.h" #include "wilc_wlan.h" - -#ifdef WILC1000_SINGLE_TRANSFER -#define WILC_SDIO_BLOCK_SIZE 256 -#else - #if defined(PLAT_AML8726_M3) /* johnny */ - #define WILC_SDIO_BLOCK_SIZE 512 - #define MAX_SEG_SIZE (1 << 12) /* 4096 */ - #else - #define WILC_SDIO_BLOCK_SIZE 512 - #endif -#endif +#define WILC_SDIO_BLOCK_SIZE 512 typedef struct { void *os_context; @@ -90,7 +80,6 @@ static int sdio_set_func0_csa_address_byte0(uint32_t adr) { sdio_cmd52_t cmd; - /** * Review: BIG ENDIAN **/ @@ -108,6 +97,7 @@ static int sdio_set_func0_csa_address_byte0(uint32_t adr) _fail_: return 0; } + static int sdio_set_func0_block_size(uint32_t block_size) { sdio_cmd52_t cmd; @@ -170,6 +160,7 @@ static int sdio_clear_int(void) #ifndef WILC_SDIO_IRQ_GPIO /* uint32_t sts; */ sdio_cmd52_t cmd; + cmd.read_write = 0; cmd.function = 1; cmd.raw = 0; @@ -181,6 +172,7 @@ static int sdio_clear_int(void) return cmd.data; #else uint32_t reg; + if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) { g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0); return 0; @@ -197,6 +189,7 @@ uint32_t sdio_xfer_cnt(void) { uint32_t cnt = 0; sdio_cmd52_t cmd; + cmd.read_write = 0; cmd.function = 1; cmd.raw = 0; @@ -222,8 +215,6 @@ uint32_t sdio_xfer_cnt(void) cnt |= (cmd.data << 16); return cnt; - - } /******************************************** @@ -263,6 +254,7 @@ static int sdio_write_reg(uint32_t addr, uint32_t data) if ((addr >= 0xf0) && (addr <= 0xff)) { sdio_cmd52_t cmd; + cmd.read_write = 1; cmd.function = 0; cmd.raw = 0; @@ -325,16 +317,6 @@ static int sdio_write(uint32_t addr, uint8_t *buf, uint32_t size) cmd.function = 0; cmd.address = 0x10f; } else { -#ifdef WILC1000_SINGLE_TRANSFER - /** - * has to be block aligned... - **/ - nleft = size % block_size; - if (nleft > 0) { - size += block_size; - size &= ~(block_size - 1); - } -#else /** * has to be word aligned... **/ @@ -342,7 +324,6 @@ static int sdio_write(uint32_t addr, uint8_t *buf, uint32_t size) size += 4; size &= ~0x3; } -#endif /** * func 1 access @@ -355,89 +336,6 @@ static int sdio_write(uint32_t addr, uint8_t *buf, uint32_t size) nleft = size % block_size; if (nblk > 0) { - -#if defined(PLAT_AML8726_M3_BACKUP) /* johnny */ - int i; - - for (i = 0; i < nblk; i++) { - cmd.block_mode = 0; /* 1; */ - cmd.increment = 1; - cmd.count = block_size; /* nblk; */ - cmd.buffer = buf; - cmd.block_size = block_size; - if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) - goto _fail_; - } - if (!g_sdio.sdio_cmd53(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block send...\n", addr); - goto _fail_; - } - - if (addr > 0) - addr += block_size; /* addr += nblk*block_size; */ - - buf += block_size; /* buf += nblk*block_size; */ - } - -#elif defined(PLAT_AML8726_M3) /* johnny */ - - int i; - int rest; - int seg_cnt; - - seg_cnt = (nblk * block_size) / MAX_SEG_SIZE; - rest = (nblk * block_size) & (MAX_SEG_SIZE - 1); - - for (i = 0; i < seg_cnt; i++) { - cmd.block_mode = 1; - cmd.increment = 1; - cmd.count = MAX_SEG_SIZE / block_size; - cmd.buffer = buf; - cmd.block_size = block_size; - - if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) - goto _fail_; - } - if (!g_sdio.sdio_cmd53(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block send...\n", addr); - goto _fail_; - } - - if (addr > 0) - addr += MAX_SEG_SIZE; - - buf += MAX_SEG_SIZE; - - } - - - if (rest > 0) { - cmd.block_mode = 1; - cmd.increment = 1; - cmd.count = rest / block_size; - cmd.buffer = buf; - cmd.block_size = block_size; /* johnny : prevent it from setting unexpected value */ - - if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) - goto _fail_; - } - if (!g_sdio.sdio_cmd53(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], bytes send...\n", addr); - goto _fail_; - } - - if (addr > 0) - addr += rest; - - buf += rest; - - } - -#else - cmd.block_mode = 1; cmd.increment = 1; cmd.count = nblk; @@ -454,11 +352,8 @@ static int sdio_write(uint32_t addr, uint8_t *buf, uint32_t size) if (addr > 0) addr += nblk * block_size; buf += nblk * block_size; - -#endif /* platform */ } - if (nleft > 0) { cmd.block_mode = 0; cmd.increment = 1; @@ -488,6 +383,7 @@ static int sdio_read_reg(uint32_t addr, uint32_t *data) { if ((addr >= 0xf0) && (addr <= 0xff)) { sdio_cmd52_t cmd; + cmd.read_write = 0; cmd.function = 0; cmd.raw = 0; @@ -552,16 +448,6 @@ static int sdio_read(uint32_t addr, uint8_t *buf, uint32_t size) cmd.function = 0; cmd.address = 0x10f; } else { -#ifdef WILC1000_SINGLE_TRANSFER - /** - * has to be block aligned... - **/ - nleft = size % block_size; - if (nleft > 0) { - size += block_size; - size &= ~(block_size - 1); - } -#else /** * has to be word aligned... **/ @@ -569,7 +455,6 @@ static int sdio_read(uint32_t addr, uint8_t *buf, uint32_t size) size += 4; size &= ~0x3; } -#endif /** * func 1 access @@ -582,89 +467,6 @@ static int sdio_read(uint32_t addr, uint8_t *buf, uint32_t size) nleft = size % block_size; if (nblk > 0) { - -#if defined(PLAT_AML8726_M3_BACKUP) /* johnny */ - - int i; - - for (i = 0; i < nblk; i++) { - cmd.block_mode = 0; /* 1; */ - cmd.increment = 1; - cmd.count = block_size; /* nblk; */ - cmd.buffer = buf; - cmd.block_size = block_size; - if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) - goto _fail_; - } - if (!g_sdio.sdio_cmd53(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr); - goto _fail_; - } - if (addr > 0) - addr += block_size; /* addr += nblk*block_size; */ - buf += block_size; /* buf += nblk*block_size; */ - } - -#elif defined(PLAT_AML8726_M3) /* johnny */ - - int i; - int rest; - int seg_cnt; - - seg_cnt = (nblk * block_size) / MAX_SEG_SIZE; - rest = (nblk * block_size) & (MAX_SEG_SIZE - 1); - - for (i = 0; i < seg_cnt; i++) { - cmd.block_mode = 1; - cmd.increment = 1; - cmd.count = MAX_SEG_SIZE / block_size; - cmd.buffer = buf; - cmd.block_size = block_size; - - - if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) - goto _fail_; - } - if (!g_sdio.sdio_cmd53(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr); - goto _fail_; - } - - if (addr > 0) - addr += MAX_SEG_SIZE; - - buf += MAX_SEG_SIZE; - - } - - - if (rest > 0) { - cmd.block_mode = 1; - cmd.increment = 1; - cmd.count = rest / block_size; - cmd.buffer = buf; - cmd.block_size = block_size; /* johnny : prevent it from setting unexpected value */ - - if (addr > 0) { - if (!sdio_set_func0_csa_address(addr)) - goto _fail_; - } - if (!g_sdio.sdio_cmd53(&cmd)) { - g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed cmd53 [%x], block read...\n", addr); - goto _fail_; - } - - if (addr > 0) - addr += rest; - - buf += rest; - - } - -#else - cmd.block_mode = 1; cmd.increment = 1; cmd.count = nblk; @@ -681,8 +483,6 @@ static int sdio_read(uint32_t addr, uint8_t *buf, uint32_t size) if (addr > 0) addr += nblk * block_size; buf += nblk * block_size; - -#endif /* platform */ } /* if (nblk > 0) */ if (nleft > 0) { @@ -784,6 +584,7 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) sdio_cmd52_t cmd; int loop; uint32_t chipid; + memset(&g_sdio, 0, sizeof(wilc_sdio_t)); g_sdio.dPrint = func; @@ -891,14 +692,12 @@ static int sdio_init(wilc_wlan_inp_t *inp, wilc_debug_func func) goto _fail_; } g_sdio.dPrint(N_ERR, "[wilc sdio]: chipid (%08x)\n", chipid); - if ((chipid & 0xfff) > 0x2a0) { + if ((chipid & 0xfff) > 0x2a0) g_sdio.has_thrpt_enh3 = 1; - } else { + else g_sdio.has_thrpt_enh3 = 0; - } g_sdio.dPrint(N_ERR, "[wilc sdio]: has_thrpt_enh3 = %d...\n", g_sdio.has_thrpt_enh3); - return 1; _fail_: @@ -925,23 +724,21 @@ static int sdio_read_size(uint32_t *size) /** * Read DMA count in words **/ - { - cmd.read_write = 0; - cmd.function = 0; - cmd.raw = 0; - cmd.address = 0xf2; - cmd.data = 0; - g_sdio.sdio_cmd52(&cmd); - tmp = cmd.data; + cmd.read_write = 0; + cmd.function = 0; + cmd.raw = 0; + cmd.address = 0xf2; + cmd.data = 0; + g_sdio.sdio_cmd52(&cmd); + tmp = cmd.data; - /* cmd.read_write = 0; */ - /* cmd.function = 0; */ - /* cmd.raw = 0; */ - cmd.address = 0xf3; - cmd.data = 0; - g_sdio.sdio_cmd52(&cmd); - tmp |= (cmd.data << 8); - } + /* cmd.read_write = 0; */ + /* cmd.function = 0; */ + /* cmd.raw = 0; */ + cmd.address = 0xf3; + cmd.data = 0; + g_sdio.sdio_cmd52(&cmd); + tmp |= (cmd.data << 8); *size = tmp; return 1; @@ -966,26 +763,21 @@ static int sdio_read_int(uint32_t *int_status) cmd.data = 0; g_sdio.sdio_cmd52(&cmd); - if (cmd.data & (1 << 0)) { + if (cmd.data & (1 << 0)) tmp |= INT_0; - } - if (cmd.data & (1 << 2)) { + if (cmd.data & (1 << 2)) tmp |= INT_1; - } - if (cmd.data & (1 << 3)) { + if (cmd.data & (1 << 3)) tmp |= INT_2; - } - if (cmd.data & (1 << 4)) { + if (cmd.data & (1 << 4)) tmp |= INT_3; - } - if (cmd.data & (1 << 5)) { + if (cmd.data & (1 << 5)) tmp |= INT_4; - } - if (cmd.data & (1 << 6)) { + if (cmd.data & (1 << 6)) tmp |= INT_5; - } { int i; + for (i = g_sdio.nint; i < MAX_NUM_INT; i++) { if ((tmp >> (IRG_FLAGS_OFFSET + i)) & 0x1) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Unexpected interrupt (1) : tmp=%x, data=%x\n", tmp, cmd.data); @@ -1024,6 +816,7 @@ static int sdio_clear_int_ext(uint32_t val) #ifdef WILC_SDIO_IRQ_GPIO { uint32_t flags; + flags = val & ((1 << MAX_NUN_INT_THRPT_ENH2) - 1); reg = flags; } @@ -1041,6 +834,7 @@ static int sdio_clear_int_ext(uint32_t val) reg |= (1 << 7); if (reg) { sdio_cmd52_t cmd; + cmd.read_write = 1; cmd.function = 0; cmd.raw = 0; @@ -1060,6 +854,7 @@ static int sdio_clear_int_ext(uint32_t val) /* see below. has_thrpt_enh2 uses register 0xf8 to clear interrupts. */ /* Cannot clear multiple interrupts. Must clear each interrupt individually */ uint32_t flags; + flags = val & ((1 << MAX_NUM_INT) - 1); if (flags) { int i; @@ -1068,6 +863,7 @@ static int sdio_clear_int_ext(uint32_t val) for (i = 0; i < g_sdio.nint; i++) { if (flags & 1) { sdio_cmd52_t cmd; + cmd.read_write = 1; cmd.function = 0; cmd.raw = 0; @@ -1085,9 +881,8 @@ static int sdio_clear_int_ext(uint32_t val) break; flags >>= 1; } - if (!ret) { + if (!ret) goto _fail_; - } for (i = g_sdio.nint; i < MAX_NUM_INT; i++) { if (flags & 1) g_sdio.dPrint(N_ERR, "[wilc sdio]: Unexpected interrupt cleared %d...\n", i); @@ -1097,7 +892,6 @@ static int sdio_clear_int_ext(uint32_t val) } #endif /* WILC_SDIO_IRQ_GPIO */ - { uint32_t vmm_ctl; @@ -1138,7 +932,6 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) { uint32_t reg; - if (nint > MAX_NUM_INT) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Too many interupts (%d)...\n", nint); return 0; @@ -1148,7 +941,6 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) return 0; } - g_sdio.nint = nint; /** @@ -1170,7 +962,6 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) uint32_t reg; int ret, i; - /** * interrupt pin mux select **/ @@ -1195,9 +986,8 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) return 0; } - for (i = 0; (i < 5) && (nint > 0); i++, nint--) { + for (i = 0; (i < 5) && (nint > 0); i++, nint--) reg |= (1 << (27 + i)); - } ret = sdio_write_reg(WILC_INTR_ENABLE, reg); if (!ret) { g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); @@ -1210,9 +1000,8 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) return 0; } - for (i = 0; (i < 3) && (nint > 0); i++, nint--) { + for (i = 0; (i < 3) && (nint > 0); i++, nint--) reg |= (1 << i); - } ret = sdio_read_reg(WILC_INTR2_ENABLE, ®); if (!ret) { @@ -1225,7 +1014,6 @@ static int sdio_sync_ext(int nint /* how mant interrupts to enable. */) return 1; } - /******************************************** * * Global sdio HIF function table diff --git a/drivers/staging/wilc1000/wilc_sleep.c b/drivers/staging/wilc1000/wilc_sleep.c deleted file mode 100644 index adab3cac6..000000000 --- a/drivers/staging/wilc1000/wilc_sleep.c +++ /dev/null @@ -1,18 +0,0 @@ - -#include "wilc_sleep.h" - -/* - * @author mdaftedar - * @date 10 Aug 2010 - * @version 1.0 - */ -void WILC_Sleep(u32 u32TimeMilliSec) -{ - if (u32TimeMilliSec <= 4000000) { - u32 u32Temp = u32TimeMilliSec * 1000; - usleep_range(u32Temp, u32Temp); - } else { - msleep(u32TimeMilliSec); - } - -} diff --git a/drivers/staging/wilc1000/wilc_sleep.h b/drivers/staging/wilc1000/wilc_sleep.h deleted file mode 100644 index cf9047f70..000000000 --- a/drivers/staging/wilc1000/wilc_sleep.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __WILC_SLEEP_H__ -#define __WILC_SLEEP_H__ - -#include -#include - -/*! - * @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 - * @author syounan - * @date 10 Aug 2010 - * @version 1.0 - * @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(u32 u32TimeMilliSec); - -#endif diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index abea5df65..1bf7d314a 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -374,11 +374,10 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, uint8_t *b, uint32_t sz, return result; } - if (!g_spi.crc_off) { + if (!g_spi.crc_off) wb[len - 1] = (crc7(0x7f, (const uint8_t *)&wb[0], len - 1)) << 1; - } else { + else len -= 1; - } #define NUM_SKIP_BYTES (1) #define NUM_RSP_BYTES (2) @@ -522,11 +521,10 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, uint8_t *b, uint32_t sz, if (sz > 0) { int nbytes; - if (sz <= (DATA_PKT_SZ - ix)) { + if (sz <= (DATA_PKT_SZ - ix)) nbytes = sz; - } else { + else nbytes = DATA_PKT_SZ - ix; - } /** * Read bytes @@ -557,11 +555,10 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, uint8_t *b, uint32_t sz, while (sz > 0) { int nbytes; - if (sz <= DATA_PKT_SZ) { + if (sz <= DATA_PKT_SZ) nbytes = sz; - } else { + else nbytes = DATA_PKT_SZ; - } /** * read data response only on the next DMA cycles not diff --git a/drivers/staging/wilc1000/wilc_strutils.c b/drivers/staging/wilc1000/wilc_strutils.c deleted file mode 100644 index e0145953c..000000000 --- a/drivers/staging/wilc1000/wilc_strutils.c +++ /dev/null @@ -1,80 +0,0 @@ - -#define _CRT_SECURE_NO_DEPRECATE - -#include "wilc_strutils.h" - - -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -s32 WILC_memcmp(const void *pvArg1, const void *pvArg2, u32 u32Count) -{ - return memcmp(pvArg1, pvArg2, u32Count); -} - - -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void WILC_memcpy_INTERNAL(void *pvTarget, const void *pvSource, u32 u32Count) -{ - memcpy(pvTarget, pvSource, u32Count); -} - -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void *WILC_memset(void *pvTarget, u8 u8SetValue, u32 u32Count) -{ - return memset(pvTarget, u8SetValue, u32Count); -} - -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -char *WILC_strncpy(char *pcTarget, const char *pcSource, - u32 u32Count) -{ - return strncpy(pcTarget, pcSource, u32Count); -} - -s32 WILC_strncmp(const char *pcStr1, const char *pcStr2, - u32 u32Count) -{ - s32 s32Result; - - if (pcStr1 == NULL && pcStr2 == NULL) { - s32Result = 0; - } else if (pcStr1 == NULL) { - s32Result = -1; - } else if (pcStr2 == NULL) { - s32Result = 1; - } else { - s32Result = strncmp(pcStr1, pcStr2, u32Count); - if (s32Result < 0) { - s32Result = -1; - } else if (s32Result > 0) { - s32Result = 1; - } - } - - return s32Result; -} - -/*! - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -u32 WILC_strlen(const char *pcStr) -{ - return (u32)strlen(pcStr); -} diff --git a/drivers/staging/wilc1000/wilc_strutils.h b/drivers/staging/wilc1000/wilc_strutils.h deleted file mode 100644 index d1445575a..000000000 --- a/drivers/staging/wilc1000/wilc_strutils.h +++ /dev/null @@ -1,134 +0,0 @@ -#ifndef __WILC_STRUTILS_H__ -#define __WILC_STRUTILS_H__ - -/*! - * @file wilc_strutils.h - * @brief Basic string utilities - * @author syounan - * @sa wilc_oswrapper.h top level OS wrapper file - * @date 16 Aug 2010 - * @version 1.0 - */ - -#include -#include -#include "wilc_errorsupport.h" - -/*! - * @brief Compares two memory buffers - * @param[in] pvArg1 pointer to the first memory location - * @param[in] pvArg2 pointer to the second memory location - * @param[in] u32Count the size of the memory buffers - * @return 0 if the 2 buffers are equal, 1 if pvArg1 is bigger than pvArg2, - * -1 if pvArg1 smaller than pvArg2 - * @note this function repeats the functionality of standard memcmp - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -s32 WILC_memcmp(const void *pvArg1, const void *pvArg2, u32 u32Count); - -/*! - * @brief Internal implementation for memory copy - * @param[in] pvTarget the target buffer to which the data is copied into - * @param[in] pvSource pointer to the second memory location - * @param[in] u32Count the size of the data to copy - * @note this function should not be used directly, use WILC_memcpy instead - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void WILC_memcpy_INTERNAL(void *pvTarget, const void *pvSource, u32 u32Count); - -/*! - * @brief Copies the contents of a memory buffer into another - * @param[in] pvTarget the target buffer to which the data is copied into - * @param[in] pvSource pointer to the second memory location - * @param[in] u32Count the size of the data to copy - * @return WILC_SUCCESS if copy is successfully handeled - * WILC_FAIL if copy failed - * @note this function repeats the functionality of standard memcpy, - * however memcpy is undefined if the two buffers overlap but this - * implementation will check for overlap and report error - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -static WILC_ErrNo WILC_memcpy(void *pvTarget, const void *pvSource, u32 u32Count) -{ - if ( - (((u8 *)pvTarget <= (u8 *)pvSource) - && (((u8 *)pvTarget + u32Count) > (u8 *)pvSource)) - - || (((u8 *)pvSource <= (u8 *)pvTarget) - && (((u8 *)pvSource + u32Count) > (u8 *)pvTarget)) - ) { - /* ovelapped memory, return Error */ - return WILC_FAIL; - } else { - WILC_memcpy_INTERNAL(pvTarget, pvSource, u32Count); - return WILC_SUCCESS; - } -} - -/*! - * @brief Sets the contents of a memory buffer with the given value - * @param[in] pvTarget the target buffer which contsnts will be set - * @param[in] u8SetValue the value to be used - * @param[in] u32Count the size of the memory buffer - * @return value of pvTarget - * @note this function repeats the functionality of standard memset - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -void *WILC_memset(void *pvTarget, u8 u8SetValue, u32 u32Count); - -/*! - * @brief copies the contents of source string into the target string - * @param[in] pcTarget the target string buffer - * @param[in] pcSource the source string the will be copied - * @param[in] u32Count copying will proceed until a null character in pcSource - * is encountered or u32Count of bytes copied - * @return value of pcTarget - * @note this function repeats the functionality of standard strncpy - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -char *WILC_strncpy(char *pcTarget, const char *pcSource, - u32 u32Count); - -/*! - * @brief Compares two strings up to u32Count characters - * @details Compares 2 strings reporting which is bigger, NULL is considered - * the smallest string, then a zero length string then all other - * strings depending on thier ascii characters order with small case - * converted to uppder case - * @param[in] pcStr1 the first string, NULL is valid and considered smaller - * than any other non-NULL string (incliding zero lenght strings) - * @param[in] pcStr2 the second string, NULL is valid and considered smaller - * than any other non-NULL string (incliding zero lenght strings) - * @param[in] u32Count copying will proceed until a null character in pcStr1 or - * pcStr2 is encountered or u32Count of bytes copied - * @return 0 if the 2 strings are equal, 1 if pcStr1 is bigger than pcStr2, - * -1 if pcStr1 smaller than pcStr2 - * @author aabozaeid - * @date 7 Dec 2010 - * @version 1.0 - */ -s32 WILC_strncmp(const char *pcStr1, const char *pcStr2, - u32 u32Count); - -/*! - * @brief gets the length of a string - * @param[in] pcStr the string - * @return the length - * @note this function repeats the functionality of standard strlen - * @author syounan - * @date 18 Aug 2010 - * @version 1.0 - */ -u32 WILC_strlen(const char *pcStr); - -#endif diff --git a/drivers/staging/wilc1000/wilc_timer.c b/drivers/staging/wilc1000/wilc_timer.c deleted file mode 100644 index dc71157f9..000000000 --- a/drivers/staging/wilc1000/wilc_timer.c +++ /dev/null @@ -1,45 +0,0 @@ - -#include "wilc_timer.h" - -WILC_ErrNo WILC_TimerCreate(WILC_TimerHandle *pHandle, - tpfWILC_TimerFunction pfCallback, tstrWILC_TimerAttrs *pstrAttrs) -{ - WILC_ErrNo s32RetStatus = WILC_SUCCESS; - setup_timer(pHandle, (void(*)(unsigned long))pfCallback, 0); - - return s32RetStatus; -} - -WILC_ErrNo WILC_TimerDestroy(WILC_TimerHandle *pHandle, - tstrWILC_TimerAttrs *pstrAttrs) -{ - WILC_ErrNo s32RetStatus = WILC_FAIL; - if (pHandle != NULL) { - s32RetStatus = del_timer_sync(pHandle); - pHandle = NULL; - } - - return s32RetStatus; -} - - -WILC_ErrNo WILC_TimerStart(WILC_TimerHandle *pHandle, u32 u32Timeout, - void *pvArg, tstrWILC_TimerAttrs *pstrAttrs) -{ - WILC_ErrNo s32RetStatus = WILC_FAIL; - if (pHandle != NULL) { - pHandle->data = (unsigned long)pvArg; - s32RetStatus = mod_timer(pHandle, (jiffies + msecs_to_jiffies(u32Timeout))); - } - return s32RetStatus; -} - -WILC_ErrNo WILC_TimerStop(WILC_TimerHandle *pHandle, - tstrWILC_TimerAttrs *pstrAttrs) -{ - WILC_ErrNo s32RetStatus = WILC_FAIL; - if (pHandle != NULL) - s32RetStatus = del_timer(pHandle); - - return s32RetStatus; -} diff --git a/drivers/staging/wilc1000/wilc_timer.h b/drivers/staging/wilc1000/wilc_timer.h deleted file mode 100644 index 931269db3..000000000 --- a/drivers/staging/wilc1000/wilc_timer.h +++ /dev/null @@ -1,129 +0,0 @@ -#ifndef __WILC_TIMER_H__ -#define __WILC_TIMER_H__ - -/*! - * @file wilc_timer.h - * @brief Timer (One Shot and Periodic) OS wrapper functionality - * @author syounan - * @sa wilc_oswrapper.h top level OS wrapper file - * @date 16 Aug 2010 - * @version 1.0 - */ - -#include "wilc_platform.h" -#include "wilc_errorsupport.h" - -typedef void (*tpfWILC_TimerFunction)(void *); - -/*! - * @struct tstrWILC_TimerAttrs - * @brief Timer API options - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -typedef struct { - /* a dummy member to avoid compiler errors*/ - u8 dummy; -} tstrWILC_TimerAttrs; - -/*! - * @brief Creates a new timer - * @details Timers are a useful utility to execute some callback function - * in the future. - * A timer object has 3 states : IDLE, PENDING and EXECUTING - * IDLE : initial timer state after creation, no execution for the - * callback function is planned - * PENDING : a request to execute the callback function is made - * using WILC_TimerStart. - * EXECUTING : the timer has expired and its callback is now - * executing, when execution is done the timer returns to PENDING - * if the feature CONFIG_WILC_TIMER_PERIODIC is enabled and - * the flag tstrWILC_TimerAttrs.bPeriodicTimer is set. otherwise the - * timer will return to IDLE - * @param[out] pHandle handle to the newly created timer object - * @param[in] pfEntry pointer to the callback function to be called when the - * timer expires - * the underlaying OS may put many restrictions on what can be - * called inside a timer's callback, as a general rule no blocking - * operations (IO or semaphore Acquision) should be perfomred - * It is recommended that the callback will be as short as possible - * and only flags other threads to do the actual work - * also it should be noted that the underlaying OS maynot give any - * guarentees on which contect this callback will execute in - * @param[in] pstrAttrs Optional attributes, NULL for default - * @return Error code indicating sucess/failure - * @sa WILC_TimerAttrs - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -WILC_ErrNo WILC_TimerCreate(WILC_TimerHandle *pHandle, - tpfWILC_TimerFunction pfCallback, tstrWILC_TimerAttrs *pstrAttrs); - - -/*! - * @brief Destroys a given timer - * @details This will destroy a given timer freeing any resources used by it - * if the timer was PENDING Then must be cancelled as well(i.e. - * goes to IDLE, same effect as calling WILC_TimerCancel first) - * if the timer was EXECUTING then the callback will be allowed to - * finish first then all resources are freed - * @param[in] pHandle handle to the timer object - * @param[in] pstrAttrs Optional attributes, NULL for default - * @return Error code indicating sucess/failure - * @sa WILC_TimerAttrs - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -WILC_ErrNo WILC_TimerDestroy(WILC_TimerHandle *pHandle, - tstrWILC_TimerAttrs *pstrAttrs); - -/*! - * @brief Starts a given timer - * @details This function will move the timer to the PENDING state until the - * given time expires (in msec) then the callback function will be - * executed (timer in EXECUTING state) after execution is dene the - * timer either goes to IDLE (if bPeriodicTimer==false) or - * PENDING with same timeout value (if bPeriodicTimer==true) - * @param[in] pHandle handle to the timer object - * @param[in] u32Timeout timeout value in msec after witch the callback - * function will be executed. Timeout value of 0 is not allowed for - * periodic timers - * @param[in] pstrAttrs Optional attributes, NULL for default, - * set bPeriodicTimer to run this timer as a periodic timer - * @return Error code indicating sucess/failure - * @sa WILC_TimerAttrs - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -WILC_ErrNo WILC_TimerStart(WILC_TimerHandle *pHandle, u32 u32Timeout, void *pvArg, - tstrWILC_TimerAttrs *pstrAttrs); - - -/*! - * @brief Stops a given timer - * @details This function will move the timer to the IDLE state cancelling - * any sheduled callback execution. - * if this function is called on a timer already in the IDLE state - * it will have no effect. - * if this function is called on a timer in EXECUTING state - * (callback has already started) it will wait until executing is - * done then move the timer to the IDLE state (which is trivial - * work if the timer is non periodic) - * @param[in] pHandle handle to the timer object - * @param[in] pstrAttrs Optional attributes, NULL for default, - * @return Error code indicating sucess/failure - * @sa WILC_TimerAttrs - * @author syounan - * @date 16 Aug 2010 - * @version 1.0 - */ -WILC_ErrNo WILC_TimerStop(WILC_TimerHandle *pHandle, - tstrWILC_TimerAttrs *pstrAttrs); - - - -#endif diff --git a/drivers/staging/wilc1000/wilc_type.h b/drivers/staging/wilc1000/wilc_type.h deleted file mode 100644 index 5f36e7f92..000000000 --- a/drivers/staging/wilc1000/wilc_type.h +++ /dev/null @@ -1,34 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////// */ -/* */ -/* Copyright (c) Atmel Corporation. All rights reserved. */ -/* */ -/* Module Name: wilc_type.h */ -/* */ -/* */ -/* //////////////////////////////////////////////////////////////////////////// */ -#ifndef WILC_TYPE_H -#define WILC_TYPE_H - -/******************************************** - * - * Type Defines - * - ********************************************/ -#ifdef WIN32 -typedef char int8_t; -typedef short int16_t; -typedef long int32_t; -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned long uint32_t; -#else -#ifdef _linux_ -/*typedef unsigned char uint8_t; - * typedef unsigned short uint16_t; - * typedef unsigned long uint32_t;*/ -#include -#else -#include "wilc_oswrapper.h" -#endif -#endif -#endif diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 92064db9e..a6edc973f 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -22,7 +22,6 @@ #define IS_MGMT_STATUS_SUCCES 0x040 #define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff) -extern void linux_wlan_free(void *vp); extern int linux_wlan_get_firmware(perInterface_wlan_t *p_nic); extern void linux_wlan_unlock(void *vp); extern u16 Set_machw_change_vir_if(bool bValue); @@ -33,9 +32,9 @@ extern int mac_close(struct net_device *ndev); tstrNetworkInfo astrLastScannedNtwrksShadow[MAX_NUM_SCANNED_NETWORKS_SHADOW]; u32 u32LastScannedNtwrksCountShadow; #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP -WILC_TimerHandle hDuringIpTimer; +struct timer_list hDuringIpTimer; #endif -WILC_TimerHandle hAgingTimer; +struct timer_list hAgingTimer; static u8 op_ifcs; extern u8 u8ConnectedSSID[6]; @@ -112,7 +111,7 @@ u8 u8P2P_oui[] = {0x50, 0x6f, 0x9A, 0x09}; u8 u8P2Plocalrandom = 0x01; u8 u8P2Precvrandom = 0x00; u8 u8P2P_vendorspec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; -bool bWilc_ie = false; +bool bWilc_ie; #endif static struct ieee80211_supported_band WILC_WFI_band_2ghz = { @@ -135,25 +134,23 @@ struct add_key_params g_add_ptk_key_params; struct wilc_wfi_key g_key_ptk_params; struct wilc_wfi_wep_key g_key_wep_params; u8 g_flushing_in_progress; -bool g_ptk_keys_saved = false; -bool g_gtk_keys_saved = false; -bool g_wep_keys_saved = false; +bool g_ptk_keys_saved; +bool g_gtk_keys_saved; +bool g_wep_keys_saved; #define AGING_TIME (9 * 1000) #define duringIP_TIME 15000 void clear_shadow_scan(void *pUserVoid) { - struct WILC_WFI_priv *priv; int i; - priv = (struct WILC_WFI_priv *)pUserVoid; if (op_ifcs == 0) { - WILC_TimerDestroy(&hAgingTimer, NULL); + del_timer_sync(&hAgingTimer); PRINT_INFO(CORECONFIG_DBG, "destroy aging timer\n"); for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { if (astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs != NULL) { - WILC_FREE(astrLastScannedNtwrksShadow[i].pu8IEs); + kfree(astrLastScannedNtwrksShadow[i].pu8IEs); astrLastScannedNtwrksShadow[u32LastScannedNtwrksCountShadow].pu8IEs = NULL; } @@ -204,7 +201,7 @@ void refresh_scan(void *pUserVoid, uint8_t all, bool bDirectScan) channel = ieee80211_get_channel(wiphy, s32Freq); rssi = get_rssi_avg(pstrNetworkInfo); - if (WILC_memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7) || bDirectScan) { + if (memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7) || bDirectScan) { bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, pstrNetworkInfo->au8bssid, pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo, pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs, (size_t)pstrNetworkInfo->u16IEsLen, (((s32)rssi) * 100), GFP_KERNEL); @@ -219,9 +216,7 @@ void refresh_scan(void *pUserVoid, uint8_t all, bool bDirectScan) void reset_shadow_found(void *pUserVoid) { - struct WILC_WFI_priv *priv; int i; - priv = (struct WILC_WFI_priv *)pUserVoid; for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { astrLastScannedNtwrksShadow[i].u8Found = 0; @@ -230,28 +225,24 @@ void reset_shadow_found(void *pUserVoid) void update_scan_time(void *pUserVoid) { - struct WILC_WFI_priv *priv; int i; - priv = (struct WILC_WFI_priv *)pUserVoid; for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan = jiffies; } } -void remove_network_from_shadow(void *pUserVoid) +static void remove_network_from_shadow(unsigned long arg) { - struct WILC_WFI_priv *priv; unsigned long now = jiffies; int i, j; - priv = (struct WILC_WFI_priv *)pUserVoid; for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { if (time_after(now, astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan + (unsigned long)(SCAN_RESULT_EXPIRE))) { - PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: %s \n", astrLastScannedNtwrksShadow[i].au8ssid); + PRINT_D(CFG80211_DBG, "Network expired in ScanShadow: %s\n", astrLastScannedNtwrksShadow[i].au8ssid); if (astrLastScannedNtwrksShadow[i].pu8IEs != NULL) { - WILC_FREE(astrLastScannedNtwrksShadow[i].pu8IEs); + kfree(astrLastScannedNtwrksShadow[i].pu8IEs); astrLastScannedNtwrksShadow[i].pu8IEs = NULL; } @@ -265,14 +256,16 @@ void remove_network_from_shadow(void *pUserVoid) } PRINT_D(CFG80211_DBG, "Number of cached networks: %d\n", u32LastScannedNtwrksCountShadow); - if (u32LastScannedNtwrksCountShadow != 0) - WILC_TimerStart(&(hAgingTimer), AGING_TIME, pUserVoid, NULL); - else + if (u32LastScannedNtwrksCountShadow != 0) { + hAgingTimer.data = arg; + mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME)); + } else { PRINT_D(CFG80211_DBG, "No need to restart Aging timer\n"); + } } #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP -void clear_duringIP(void *pUserVoid) +static void clear_duringIP(unsigned long arg) { PRINT_D(GENERIC_DBG, "GO:IP Obtained , enable scan\n"); g_obtainingIP = false; @@ -281,19 +274,18 @@ void clear_duringIP(void *pUserVoid) int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid) { - struct WILC_WFI_priv *priv; int8_t state = -1; int i; - priv = (struct WILC_WFI_priv *)pUserVoid; if (u32LastScannedNtwrksCountShadow == 0) { PRINT_D(CFG80211_DBG, "Starting Aging timer\n"); - WILC_TimerStart(&(hAgingTimer), AGING_TIME, pUserVoid, NULL); + hAgingTimer.data = (unsigned long)pUserVoid; + mod_timer(&hAgingTimer, jiffies + msecs_to_jiffies(AGING_TIME)); state = -1; } else { /* Linear search for now */ for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { - if (WILC_memcmp(astrLastScannedNtwrksShadow[i].au8bssid, + if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { state = i; break; @@ -305,11 +297,9 @@ int8_t is_network_in_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid) void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, void *pJoinParams) { - struct WILC_WFI_priv *priv; int8_t ap_found = is_network_in_shadow(pstrNetworkInfo, pUserVoid); uint32_t ap_index = 0; uint8_t rssi_index = 0; - priv = (struct WILC_WFI_priv *)pUserVoid; if (u32LastScannedNtwrksCountShadow >= MAX_NUM_SCANNED_NETWORKS_SHADOW) { PRINT_D(CFG80211_DBG, "Shadow network reached its maximum limit\n"); @@ -334,10 +324,10 @@ void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, vo astrLastScannedNtwrksShadow[ap_index].u16CapInfo = pstrNetworkInfo->u16CapInfo; astrLastScannedNtwrksShadow[ap_index].u8SsidLen = pstrNetworkInfo->u8SsidLen; - WILC_memcpy(astrLastScannedNtwrksShadow[ap_index].au8ssid, + memcpy(astrLastScannedNtwrksShadow[ap_index].au8ssid, pstrNetworkInfo->au8ssid, pstrNetworkInfo->u8SsidLen); - WILC_memcpy(astrLastScannedNtwrksShadow[ap_index].au8bssid, + memcpy(astrLastScannedNtwrksShadow[ap_index].au8bssid, pstrNetworkInfo->au8bssid, ETH_ALEN); astrLastScannedNtwrksShadow[ap_index].u16BeaconPeriod = pstrNetworkInfo->u16BeaconPeriod; @@ -347,10 +337,10 @@ void add_network_to_shadow(tstrNetworkInfo *pstrNetworkInfo, void *pUserVoid, vo astrLastScannedNtwrksShadow[ap_index].u16IEsLen = pstrNetworkInfo->u16IEsLen; astrLastScannedNtwrksShadow[ap_index].u64Tsf = pstrNetworkInfo->u64Tsf; if (ap_found != -1) - WILC_FREE(astrLastScannedNtwrksShadow[ap_index].pu8IEs); + kfree(astrLastScannedNtwrksShadow[ap_index].pu8IEs); astrLastScannedNtwrksShadow[ap_index].pu8IEs = - (u8 *)WILC_MALLOC(pstrNetworkInfo->u16IEsLen); /* will be deallocated by the WILC_WFI_CfgScan() function */ - WILC_memcpy(astrLastScannedNtwrksShadow[ap_index].pu8IEs, + WILC_MALLOC(pstrNetworkInfo->u16IEsLen); /* will be deallocated by the WILC_WFI_CfgScan() function */ + memcpy(astrLastScannedNtwrksShadow[ap_index].pu8IEs, pstrNetworkInfo->pu8IEs, pstrNetworkInfo->u16IEsLen); astrLastScannedNtwrksShadow[ap_index].u32TimeRcvdInScan = jiffies; @@ -406,7 +396,7 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo WILC_NULLCHECK(s32Error, channel); PRINT_INFO(CFG80211_DBG, "Network Info:: CHANNEL Frequency: %d, RSSI: %d, CapabilityInfo: %d," - "BeaconPeriod: %d \n", channel->center_freq, (((s32)pstrNetworkInfo->s8rssi) * 100), + "BeaconPeriod: %d\n", channel->center_freq, (((s32)pstrNetworkInfo->s8rssi) * 100), pstrNetworkInfo->u16CapInfo, pstrNetworkInfo->u16BeaconPeriod); if (pstrNetworkInfo->bNewNetwork == true) { @@ -426,7 +416,7 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo /*P2P peers are sent to WPA supplicant and added to shadow table*/ - if (!(WILC_memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7))) { + if (!(memcmp("DIRECT-", pstrNetworkInfo->au8ssid, 7))) { bss = cfg80211_inform_bss(wiphy, channel, CFG80211_BSS_FTYPE_UNKNOWN, pstrNetworkInfo->au8bssid, pstrNetworkInfo->u64Tsf, pstrNetworkInfo->u16CapInfo, pstrNetworkInfo->u16BeaconPeriod, (const u8 *)pstrNetworkInfo->pu8IEs, (size_t)pstrNetworkInfo->u16IEsLen, (((s32)pstrNetworkInfo->s8rssi) * 100), GFP_KERNEL); @@ -441,8 +431,8 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo u32 i; /* So this network is discovered before, we'll just update its RSSI */ for (i = 0; i < priv->u32RcvdChCount; i++) { - if (WILC_memcmp(astrLastScannedNtwrksShadow[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { - PRINT_D(CFG80211_DBG, "Update RSSI of %s \n", astrLastScannedNtwrksShadow[i].au8ssid); + if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, pstrNetworkInfo->au8bssid, 6) == 0) { + PRINT_D(CFG80211_DBG, "Update RSSI of %s\n", astrLastScannedNtwrksShadow[i].au8ssid); astrLastScannedNtwrksShadow[i].s8rssi = pstrNetworkInfo->s8rssi; astrLastScannedNtwrksShadow[i].u32TimeRcvdInScan = jiffies; @@ -452,15 +442,14 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo } } } else if (enuScanEvent == SCAN_EVENT_DONE) { - PRINT_D(CFG80211_DBG, "Scan Done[%p] \n", priv->dev); - PRINT_D(CFG80211_DBG, "Refreshing Scan ... \n"); + PRINT_D(CFG80211_DBG, "Scan Done[%p]\n", priv->dev); + PRINT_D(CFG80211_DBG, "Refreshing Scan ...\n"); refresh_scan(priv, 1, false); - if (priv->u32RcvdChCount > 0) { - PRINT_D(CFG80211_DBG, "%d Network(s) found \n", priv->u32RcvdChCount); - } else { - PRINT_D(CFG80211_DBG, "No networks found \n"); - } + if (priv->u32RcvdChCount > 0) + PRINT_D(CFG80211_DBG, "%d Network(s) found\n", priv->u32RcvdChCount); + else + PRINT_D(CFG80211_DBG, "No networks found\n"); down(&(priv->hSemScanReq)); @@ -477,7 +466,7 @@ static void CfgScanResult(tenuScanEvent enuScanEvent, tstrNetworkInfo *pstrNetwo else if (enuScanEvent == SCAN_EVENT_ABORTED) { down(&(priv->hSemScanReq)); - PRINT_D(CFG80211_DBG, "Scan Aborted \n"); + PRINT_D(CFG80211_DBG, "Scan Aborted\n"); if (priv->pstrScanReq != NULL) { update_scan_time(priv); @@ -515,7 +504,7 @@ int WILC_WFI_Set_PMKSA(u8 *bssid, struct WILC_WFI_priv *priv) for (i = 0; i < priv->pmkid_list.numpmkid; i++) { - if (!WILC_memcmp(bssid, priv->pmkid_list.pmkidlist[i].bssid, + if (!memcmp(bssid, priv->pmkid_list.pmkidlist[i].bssid, ETH_ALEN)) { PRINT_D(CFG80211_DBG, "PMKID successful comparison"); @@ -586,7 +575,7 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent, * = SUCCESSFUL_STATUSCODE, while mac status is MAC_DISCONNECTED (which means something wrong happened) */ u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE; linux_wlan_set_bssid(priv->dev, NullBssid); - WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); + memset(u8ConnectedSSID, 0, ETH_ALEN); /*BugID_5457*/ /*Invalidate u8WLANChannel value on wlan0 disconnect*/ @@ -595,7 +584,7 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent, u8WLANChannel = INVALID_CHANNEL; #endif - PRINT_ER("Unspecified failure: Connection status %d : MAC status = %d \n", u16ConnectStatus, u8MacStatus); + PRINT_ER("Unspecified failure: Connection status %d : MAC status = %d\n", u16ConnectStatus, u8MacStatus); } if (u16ConnectStatus == WLAN_STATUS_SUCCESS) { @@ -604,14 +593,14 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent, PRINT_INFO(CFG80211_DBG, "Connection Successful:: BSSID: %x%x%x%x%x%x\n", pstrConnectInfo->au8bssid[0], pstrConnectInfo->au8bssid[1], pstrConnectInfo->au8bssid[2], pstrConnectInfo->au8bssid[3], pstrConnectInfo->au8bssid[4], pstrConnectInfo->au8bssid[5]); - WILC_memcpy(priv->au8AssociatedBss, pstrConnectInfo->au8bssid, ETH_ALEN); + memcpy(priv->au8AssociatedBss, pstrConnectInfo->au8bssid, ETH_ALEN); /* BugID_4209: if this network has expired in the scan results in the above nl80211 layer, refresh them here by calling * cfg80211_inform_bss() with the last Scan results before calling cfg80211_connect_result() to avoid * Linux kernel warning generated at the nl80211 layer */ for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { - if (WILC_memcmp(astrLastScannedNtwrksShadow[i].au8bssid, + if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, pstrConnectInfo->au8bssid, ETH_ALEN) == 0) { unsigned long now = jiffies; @@ -652,9 +641,9 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent, u8P2Plocalrandom = 0x01; u8P2Precvrandom = 0x00; bWilc_ie = false; - WILC_memset(priv->au8AssociatedBss, 0, ETH_ALEN); + memset(priv->au8AssociatedBss, 0, ETH_ALEN); linux_wlan_set_bssid(priv->dev, NullBssid); - WILC_memset(u8ConnectedSSID, 0, ETH_ALEN); + memset(u8ConnectedSSID, 0, ETH_ALEN); /*BugID_5457*/ /*Invalidate u8WLANChannel value on wlan0 disconnect*/ @@ -675,7 +664,8 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent, pstrDisconnectNotifInfo->u16reason = 1; } cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, pstrDisconnectNotifInfo->ie, - pstrDisconnectNotifInfo->ie_len, GFP_KERNEL); + pstrDisconnectNotifInfo->ie_len, false, + GFP_KERNEL); } @@ -747,7 +737,7 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *r priv->u32RcvdChCount = 0; - host_int_set_wfi_drv_handler((u32)priv->hWILCWFIDrv); + host_int_set_wfi_drv_handler(priv->hWILCWFIDrv); reset_shadow_found(priv); @@ -777,20 +767,20 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *r if (request->ssids[i].ssid != NULL && request->ssids[i].ssid_len != 0) { strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid = WILC_MALLOC(request->ssids[i].ssid_len); - WILC_memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, request->ssids[i].ssid, request->ssids[i].ssid_len); + memcpy(strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, request->ssids[i].ssid, request->ssids[i].ssid_len); strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen = request->ssids[i].ssid_len; } else { - PRINT_D(CFG80211_DBG, "Received one NULL SSID \n"); + PRINT_D(CFG80211_DBG, "Received one NULL SSID\n"); strHiddenNetwork.u8ssidnum -= 1; } } - PRINT_D(CFG80211_DBG, "Trigger Scan Request \n"); + PRINT_D(CFG80211_DBG, "Trigger Scan Request\n"); s32Error = host_int_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, au8ScanChanList, request->n_channels, (const u8 *)request->ie, request->ie_len, CfgScanResult, (void *)priv, &strHiddenNetwork); } else { - PRINT_D(CFG80211_DBG, "Trigger Scan Request \n"); + PRINT_D(CFG80211_DBG, "Trigger Scan Request\n"); s32Error = host_int_scan(priv->hWILCWFIDrv, USER_SCAN, ACTIVE_SCAN, au8ScanChanList, request->n_channels, (const u8 *)request->ie, request->ie_len, @@ -799,7 +789,7 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct cfg80211_scan_request *r } else { PRINT_ER("Requested num of scanned channels is greater than the max, supported" - " channels \n"); + " channels\n"); } if (s32Error != WILC_SUCCESS) { @@ -842,21 +832,21 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, priv = wiphy_priv(wiphy); pstrWFIDrv = (tstrWILC_WFIDrv *)(priv->hWILCWFIDrv); - host_int_set_wfi_drv_handler((u32)priv->hWILCWFIDrv); + host_int_set_wfi_drv_handler(priv->hWILCWFIDrv); PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if [%p]\n", sme->ssid, dev, priv->hWILCWFIDrv); #ifdef WILC_P2P - if (!(WILC_strncmp(sme->ssid, "DIRECT-", 7))) { + if (!(strncmp(sme->ssid, "DIRECT-", 7))) { PRINT_D(CFG80211_DBG, "Connected to Direct network,OBSS disabled\n"); pstrWFIDrv->u8P2PConnect = 1; } else pstrWFIDrv->u8P2PConnect = 0; #endif - PRINT_INFO(CFG80211_DBG, "Required SSID = %s\n , AuthType = %d \n", sme->ssid, sme->auth_type); + PRINT_INFO(CFG80211_DBG, "Required SSID = %s\n , AuthType = %d\n", sme->ssid, sme->auth_type); for (i = 0; i < u32LastScannedNtwrksCountShadow; i++) { if ((sme->ssid_len == astrLastScannedNtwrksShadow[i].u8SsidLen) && - WILC_memcmp(astrLastScannedNtwrksShadow[i].au8ssid, + memcmp(astrLastScannedNtwrksShadow[i].au8ssid, sme->ssid, sme->ssid_len) == 0) { PRINT_INFO(CFG80211_DBG, "Network with required SSID is found %s\n", sme->ssid); @@ -868,7 +858,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, } else { /* BSSID is also passed from the user, so decision of matching * should consider also this passed BSSID */ - if (WILC_memcmp(astrLastScannedNtwrksShadow[i].au8bssid, + if (memcmp(astrLastScannedNtwrksShadow[i].au8bssid, sme->bssid, ETH_ALEN) == 0) { PRINT_INFO(CFG80211_DBG, "BSSID is passed from the user and matched\n"); @@ -898,8 +888,8 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, } priv->WILC_WFI_wep_default = 0; - WILC_memset(priv->WILC_WFI_wep_key, 0, sizeof(priv->WILC_WFI_wep_key)); - WILC_memset(priv->WILC_WFI_wep_key_len, 0, sizeof(priv->WILC_WFI_wep_key_len)); + memset(priv->WILC_WFI_wep_key, 0, sizeof(priv->WILC_WFI_wep_key)); + memset(priv->WILC_WFI_wep_key_len, 0, sizeof(priv->WILC_WFI_wep_key_len)); PRINT_INFO(CFG80211_DBG, "sme->crypto.wpa_versions=%x\n", sme->crypto.wpa_versions); PRINT_INFO(CFG80211_DBG, "sme->crypto.cipher_group=%x\n", sme->crypto.cipher_group); @@ -928,7 +918,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, } priv->WILC_WFI_wep_default = sme->key_idx; priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len; - WILC_memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len); + memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len); /*BugID_5137*/ g_key_wep_params.key_len = sme->key_len; @@ -946,7 +936,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, priv->WILC_WFI_wep_default = sme->key_idx; priv->WILC_WFI_wep_key_len[sme->key_idx] = sme->key_len; - WILC_memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len); + memcpy(priv->WILC_WFI_wep_key[sme->key_idx], sme->key, sme->key_len); /*BugID_5137*/ g_key_wep_params.key_len = sme->key_len; @@ -1057,7 +1047,7 @@ static int WILC_WFI_CfgConnect(struct wiphy *wiphy, struct net_device *dev, tenuAuth_type, pstrNetworkInfo->u8channel, pstrNetworkInfo->pJoinParams); if (s32Error != WILC_SUCCESS) { - PRINT_ER("host_int_set_join_req(): Error(%d) \n", s32Error); + PRINT_ER("host_int_set_join_req(): Error(%d)\n", s32Error); s32Error = -ENOENT; goto done; } @@ -1162,7 +1152,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k priv->WILC_WFI_wep_default = key_index; priv->WILC_WFI_wep_key_len[key_index] = params->key_len; - WILC_memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len); + memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len); PRINT_D(CFG80211_DBG, "Adding AP WEP Default key Idx = %d\n", key_index); PRINT_D(CFG80211_DBG, "Adding AP WEP Key len= %d\n", params->key_len); @@ -1181,10 +1171,10 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k break; } #endif - if (WILC_memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) { + if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], params->key_len)) { priv->WILC_WFI_wep_default = key_index; priv->WILC_WFI_wep_key_len[key_index] = params->key_len; - WILC_memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len); + memcpy(priv->WILC_WFI_wep_key[key_index], params->key, params->key_len); PRINT_D(CFG80211_DBG, "Adding WEP Default key Idx = %d\n", key_index); PRINT_D(CFG80211_DBG, "Adding WEP Key length = %d\n", params->key_len); @@ -1203,21 +1193,20 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k if (priv->wdev->iftype == NL80211_IFTYPE_AP || priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) { if (priv->wilc_gtk[key_index] == NULL) { - priv->wilc_gtk[key_index] = (struct wilc_wfi_key *)WILC_MALLOC(sizeof(struct wilc_wfi_key)); + priv->wilc_gtk[key_index] = WILC_MALLOC(sizeof(struct wilc_wfi_key)); priv->wilc_gtk[key_index]->key = NULL; priv->wilc_gtk[key_index]->seq = NULL; } if (priv->wilc_ptk[key_index] == NULL) { - priv->wilc_ptk[key_index] = (struct wilc_wfi_key *)WILC_MALLOC(sizeof(struct wilc_wfi_key)); + priv->wilc_ptk[key_index] = WILC_MALLOC(sizeof(struct wilc_wfi_key)); priv->wilc_ptk[key_index]->key = NULL; priv->wilc_ptk[key_index]->seq = NULL; } - if (!pairwise) - { + if (!pairwise) { if (params->cipher == WLAN_CIPHER_SUITE_TKIP) u8gmode = ENCRYPT_ENABLED | WPA | TKIP; else @@ -1233,18 +1222,18 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k } /* if there has been previous allocation for the same index through its key, free that memory and allocate again*/ if (priv->wilc_gtk[key_index]->key) - WILC_FREE(priv->wilc_gtk[key_index]->key); + kfree(priv->wilc_gtk[key_index]->key); - priv->wilc_gtk[key_index]->key = (u8 *)WILC_MALLOC(params->key_len); - WILC_memcpy(priv->wilc_gtk[key_index]->key, params->key, params->key_len); + priv->wilc_gtk[key_index]->key = WILC_MALLOC(params->key_len); + memcpy(priv->wilc_gtk[key_index]->key, params->key, params->key_len); /* if there has been previous allocation for the same index through its seq, free that memory and allocate again*/ if (priv->wilc_gtk[key_index]->seq) - WILC_FREE(priv->wilc_gtk[key_index]->seq); + kfree(priv->wilc_gtk[key_index]->seq); if ((params->seq_len) > 0) { - priv->wilc_gtk[key_index]->seq = (u8 *)WILC_MALLOC(params->seq_len); - WILC_memcpy(priv->wilc_gtk[key_index]->seq, params->seq, params->seq_len); + priv->wilc_gtk[key_index]->seq = WILC_MALLOC(params->seq_len); + memcpy(priv->wilc_gtk[key_index]->seq, params->seq, params->seq_len); } priv->wilc_gtk[key_index]->cipher = params->cipher; @@ -1279,15 +1268,15 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k } if (priv->wilc_ptk[key_index]->key) - WILC_FREE(priv->wilc_ptk[key_index]->key); + kfree(priv->wilc_ptk[key_index]->key); - priv->wilc_ptk[key_index]->key = (u8 *)WILC_MALLOC(params->key_len); + priv->wilc_ptk[key_index]->key = WILC_MALLOC(params->key_len); if (priv->wilc_ptk[key_index]->seq) - WILC_FREE(priv->wilc_ptk[key_index]->seq); + kfree(priv->wilc_ptk[key_index]->seq); if ((params->seq_len) > 0) - priv->wilc_ptk[key_index]->seq = (u8 *)WILC_MALLOC(params->seq_len); + priv->wilc_ptk[key_index]->seq = WILC_MALLOC(params->seq_len); if (INFO) { for (i = 0; i < params->key_len; i++) @@ -1297,10 +1286,10 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k PRINT_INFO(CFG80211_DBG, "Adding group seq value[%d] = %x\n", i, params->seq[i]); } - WILC_memcpy(priv->wilc_ptk[key_index]->key, params->key, params->key_len); + memcpy(priv->wilc_ptk[key_index]->key, params->key, params->key_len); if ((params->seq_len) > 0) - WILC_memcpy(priv->wilc_ptk[key_index]->seq, params->seq, params->seq_len); + memcpy(priv->wilc_ptk[key_index]->seq, params->seq, params->seq_len); priv->wilc_ptk[key_index]->cipher = params->cipher; priv->wilc_ptk[key_index]->key_len = params->key_len; @@ -1315,8 +1304,7 @@ static int WILC_WFI_add_key(struct wiphy *wiphy, struct net_device *netdev, u8 k { u8mode = 0; - if (!pairwise) - { + if (!pairwise) { if (params->key_len > 16 && params->cipher == WLAN_CIPHER_SUITE_TKIP) { /* swap the tx mic by rx mic */ pu8RxMic = params->key + 24; @@ -1437,7 +1425,7 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev, /*Delete saved WEP keys params, if any*/ if (g_key_wep_params.key != NULL) { - WILC_FREE(g_key_wep_params.key); + kfree(g_key_wep_params.key); g_key_wep_params.key = NULL; } @@ -1448,16 +1436,16 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev, if (priv->wilc_gtk[key_index]->key != NULL) { - WILC_FREE(priv->wilc_gtk[key_index]->key); + kfree(priv->wilc_gtk[key_index]->key); priv->wilc_gtk[key_index]->key = NULL; } if (priv->wilc_gtk[key_index]->seq) { - WILC_FREE(priv->wilc_gtk[key_index]->seq); + kfree(priv->wilc_gtk[key_index]->seq); priv->wilc_gtk[key_index]->seq = NULL; } - WILC_FREE(priv->wilc_gtk[key_index]); + kfree(priv->wilc_gtk[key_index]); priv->wilc_gtk[key_index] = NULL; } @@ -1466,35 +1454,35 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev, if (priv->wilc_ptk[key_index]->key) { - WILC_FREE(priv->wilc_ptk[key_index]->key); + kfree(priv->wilc_ptk[key_index]->key); priv->wilc_ptk[key_index]->key = NULL; } if (priv->wilc_ptk[key_index]->seq) { - WILC_FREE(priv->wilc_ptk[key_index]->seq); + kfree(priv->wilc_ptk[key_index]->seq); priv->wilc_ptk[key_index]->seq = NULL; } - WILC_FREE(priv->wilc_ptk[key_index]); + kfree(priv->wilc_ptk[key_index]); priv->wilc_ptk[key_index] = NULL; } #endif /*Delete saved PTK and GTK keys params, if any*/ if (g_key_ptk_params.key != NULL) { - WILC_FREE(g_key_ptk_params.key); + kfree(g_key_ptk_params.key); g_key_ptk_params.key = NULL; } if (g_key_ptk_params.seq != NULL) { - WILC_FREE(g_key_ptk_params.seq); + kfree(g_key_ptk_params.seq); g_key_ptk_params.seq = NULL; } if (g_key_gtk_params.key != NULL) { - WILC_FREE(g_key_gtk_params.key); + kfree(g_key_gtk_params.key); g_key_gtk_params.key = NULL; } if (g_key_gtk_params.seq != NULL) { - WILC_FREE(g_key_gtk_params.seq); + kfree(g_key_gtk_params.seq); g_key_gtk_params.seq = NULL; } @@ -1503,7 +1491,7 @@ static int WILC_WFI_del_key(struct wiphy *wiphy, struct net_device *netdev, } if (key_index >= 0 && key_index <= 3) { - WILC_memset(priv->WILC_WFI_wep_key[key_index], 0, priv->WILC_WFI_wep_key_len[key_index]); + memset(priv->WILC_WFI_wep_key[key_index], 0, priv->WILC_WFI_wep_key_len[key_index]); priv->WILC_WFI_wep_key_len[key_index] = 0; PRINT_D(CFG80211_DBG, "Removing WEP key with index = %d\n", key_index); @@ -1588,7 +1576,7 @@ static int WILC_WFI_set_default_key(struct wiphy *wiphy, struct net_device *netd priv = wiphy_priv(wiphy); - PRINT_D(CFG80211_DBG, "Setting default key with idx = %d \n", key_index); + PRINT_D(CFG80211_DBG, "Setting default key with idx = %d\n", key_index); if (key_index != priv->WILC_WFI_wep_default) { @@ -1633,7 +1621,6 @@ static int WILC_WFI_dump_survey(struct wiphy *wiphy, struct net_device *netdev, * @version 1.0 */ -extern uint32_t Statisitcs_totalAcks, Statisitcs_DroppedAcks; static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_info *sinfo) { @@ -1689,7 +1676,7 @@ static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev, * kernel version 3.0.0 */ sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) | - BIT( NL80211_STA_INFO_RX_PACKETS) | + BIT(NL80211_STA_INFO_RX_PACKETS) | BIT(NL80211_STA_INFO_TX_PACKETS) | BIT(NL80211_STA_INFO_TX_FAILED) | BIT(NL80211_STA_INFO_TX_BITRATE); @@ -1701,11 +1688,10 @@ static int WILC_WFI_get_station(struct wiphy *wiphy, struct net_device *dev, sinfo->txrate.legacy = strStatistics.u8LinkSpeed * 10; #ifdef TCP_ENHANCEMENTS - if ((strStatistics.u8LinkSpeed > TCP_ACK_FILTER_LINK_SPEED_THRESH) && (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED)) { + if ((strStatistics.u8LinkSpeed > TCP_ACK_FILTER_LINK_SPEED_THRESH) && (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED)) Enable_TCP_ACK_Filter(true); - } else if (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED) { + else if (strStatistics.u8LinkSpeed != DEFAULT_LINK_SPEED) Enable_TCP_ACK_Filter(false); - } #endif PRINT_D(CORECONFIG_DBG, "*** stats[%d][%d][%d][%d][%d]\n", sinfo->signal, sinfo->rx_packets, sinfo->tx_packets, @@ -1826,7 +1812,7 @@ static int WILC_WFI_set_wiphy_params(struct wiphy *wiphy, u32 changed) priv = wiphy_priv(wiphy); pstrCfgParamVal.u32SetCfgFlag = 0; - PRINT_D(CFG80211_DBG, "Setting Wiphy params \n"); + PRINT_D(CFG80211_DBG, "Setting Wiphy params\n"); if (changed & WIPHY_PARAM_RETRY_SHORT) { PRINT_D(CFG80211_DBG, "Setting WIPHY_PARAM_RETRY_SHORT %d\n", @@ -1909,7 +1895,7 @@ static int WILC_WFI_set_pmksa(struct wiphy *wiphy, struct net_device *netdev, for (i = 0; i < priv->pmkid_list.numpmkid; i++) { - if (!WILC_memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, + if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, ETH_ALEN)) { /*If bssid already exists and pmkid value needs to reset*/ flag = PMKID_FOUND; @@ -1919,9 +1905,9 @@ static int WILC_WFI_set_pmksa(struct wiphy *wiphy, struct net_device *netdev, } if (i < WILC_MAX_NUM_PMKIDS) { PRINT_D(CFG80211_DBG, "Setting PMKID in private structure\n"); - WILC_memcpy(priv->pmkid_list.pmkidlist[i].bssid, pmksa->bssid, + memcpy(priv->pmkid_list.pmkidlist[i].bssid, pmksa->bssid, ETH_ALEN); - WILC_memcpy(priv->pmkid_list.pmkidlist[i].pmkid, pmksa->pmkid, + memcpy(priv->pmkid_list.pmkidlist[i].pmkid, pmksa->pmkid, PMKID_LEN); if (!(flag == PMKID_FOUND)) priv->pmkid_list.numpmkid++; @@ -1959,11 +1945,11 @@ static int WILC_WFI_del_pmksa(struct wiphy *wiphy, struct net_device *netdev, PRINT_D(CFG80211_DBG, "Deleting PMKSA keys\n"); for (i = 0; i < priv->pmkid_list.numpmkid; i++) { - if (!WILC_memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, + if (!memcmp(pmksa->bssid, priv->pmkid_list.pmkidlist[i].bssid, ETH_ALEN)) { /*If bssid is found, reset the values*/ PRINT_D(CFG80211_DBG, "Reseting PMKID values\n"); - WILC_memset(&priv->pmkid_list.pmkidlist[i], 0, sizeof(tstrHostIFpmkid)); + memset(&priv->pmkid_list.pmkidlist[i], 0, sizeof(tstrHostIFpmkid)); flag = PMKID_FOUND; break; } @@ -1971,10 +1957,10 @@ static int WILC_WFI_del_pmksa(struct wiphy *wiphy, struct net_device *netdev, if (i < priv->pmkid_list.numpmkid && priv->pmkid_list.numpmkid > 0) { for (; i < (priv->pmkid_list.numpmkid - 1); i++) { - WILC_memcpy(priv->pmkid_list.pmkidlist[i].bssid, + memcpy(priv->pmkid_list.pmkidlist[i].bssid, priv->pmkid_list.pmkidlist[i + 1].bssid, ETH_ALEN); - WILC_memcpy(priv->pmkid_list.pmkidlist[i].pmkid, + memcpy(priv->pmkid_list.pmkidlist[i].pmkid, priv->pmkid_list.pmkidlist[i].pmkid, PMKID_LEN); } @@ -2002,7 +1988,7 @@ static int WILC_WFI_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) PRINT_D(CFG80211_DBG, "Flushing PMKID key values\n"); /*Get cashed Pmkids and set all with zeros*/ - WILC_memset(&priv->pmkid_list, 0, sizeof(tstrHostIFpmkidAttr)); + memset(&priv->pmkid_list, 0, sizeof(tstrHostIFpmkidAttr)); return 0; } @@ -2074,11 +2060,10 @@ void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) } #endif /* USE_SUPPLICANT_GO_INTENT */ - if (buf[index] == CHANLIST_ATTR_ID) { + if (buf[index] == CHANLIST_ATTR_ID) channel_list_attr_index = index; - } else if (buf[index] == OPERCHAN_ATTR_ID) { + else if (buf[index] == OPERCHAN_ATTR_ID) op_channel_attr_index = index; - } index += buf[index + 1] + 3; /* ID,Length byte */ } @@ -2160,11 +2145,10 @@ void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftype) } #endif - if (buf[index] == CHANLIST_ATTR_ID) { + if (buf[index] == CHANLIST_ATTR_ID) channel_list_attr_index = index; - } else if (buf[index] == OPERCHAN_ATTR_ID) { + else if (buf[index] == OPERCHAN_ATTR_ID) op_channel_attr_index = index; - } index += buf[index + 1] + 3; /* ID,Length byte */ } @@ -2218,7 +2202,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, uint8_t *buff, uint32_t size) pstrWFIDrv = (tstrWILC_WFIDrv *)priv->hWILCWFIDrv; /* Get WILC header */ - WILC_memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET); + memcpy(&header, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET); /* The packet offset field conain info about what type of managment frame */ /* we are dealing with and ack status */ @@ -2270,11 +2254,11 @@ void WILC_WFI_p2p_rx (struct net_device *dev, uint8_t *buff, uint32_t size) case PUBLIC_ACT_VENDORSPEC: /*Now we have a public action vendor specific action frame, check if its a p2p public action frame * based on the standard its should have the p2p_oui attribute with the following values 50 6f 9A 09*/ - if (!WILC_memcmp(u8P2P_oui, &buff[ACTION_SUBTYPE_ID + 1], 4)) { + if (!memcmp(u8P2P_oui, &buff[ACTION_SUBTYPE_ID + 1], 4)) { if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) { if (!bWilc_ie) { for (i = P2P_PUB_ACTION_SUBTYPE; i < size; i++) { - if (!WILC_memcmp(u8P2P_vendorspec, &buff[i], 6)) { + if (!memcmp(u8P2P_vendorspec, &buff[i], 6)) { u8P2Precvrandom = buff[i + 6]; bWilc_ie = true; PRINT_D(GENERIC_DBG, "WILC Vendor specific IE:%02x\n", u8P2Precvrandom); @@ -2287,7 +2271,7 @@ void WILC_WFI_p2p_rx (struct net_device *dev, uint8_t *buff, uint32_t size) if ((buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP)) { for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) { - if (buff[i] == P2PELEM_ATTR_ID && !(WILC_memcmp(u8P2P_oui, &buff[i + 2], 4))) { + if (buff[i] == P2PELEM_ATTR_ID && !(memcmp(u8P2P_oui, &buff[i + 2], 4))) { WILC_WFI_CfgParseRxAction(&buff[i + 6], size - (i + 6)); break; } @@ -2351,7 +2335,7 @@ static void WILC_WFI_RemainOnChannelReady(void *pUserVoid) struct WILC_WFI_priv *priv; priv = (struct WILC_WFI_priv *)pUserVoid; - PRINT_D(HOSTINF_DBG, "Remain on channel ready \n"); + PRINT_D(HOSTINF_DBG, "Remain on channel ready\n"); priv->bInP2PlistenState = true; @@ -2379,7 +2363,7 @@ static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID) /*BugID_5477*/ if (u32SessionID == priv->strRemainOnChanParams.u32ListenSessionID) { - PRINT_D(GENERIC_DBG, "Remain on channel expired \n"); + PRINT_D(GENERIC_DBG, "Remain on channel expired\n"); priv->bInP2PlistenState = false; @@ -2485,7 +2469,7 @@ static int WILC_WFI_cancel_remain_on_channel(struct wiphy *wiphy, */ void WILC_WFI_add_wilcvendorspec(u8 *buff) { - WILC_memcpy(buff, u8P2P_vendorspec, sizeof(u8P2P_vendorspec)); + memcpy(buff, u8P2P_vendorspec, sizeof(u8P2P_vendorspec)); } /** * @brief WILC_WFI_mgmt_tx_frame @@ -2528,17 +2512,17 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy, if (ieee80211_is_mgmt(mgmt->frame_control)) { /*mgmt frame allocation*/ - mgmt_tx = (struct p2p_mgmt_data *)WILC_MALLOC(sizeof(struct p2p_mgmt_data)); + mgmt_tx = WILC_MALLOC(sizeof(struct p2p_mgmt_data)); if (mgmt_tx == NULL) { PRINT_ER("Failed to allocate memory for mgmt_tx structure\n"); return WILC_FAIL; } - mgmt_tx->buff = (char *)WILC_MALLOC(buf_len); + mgmt_tx->buff = WILC_MALLOC(buf_len); if (mgmt_tx->buff == NULL) { PRINT_ER("Failed to allocate memory for mgmt_tx buff\n"); return WILC_FAIL; } - WILC_memcpy(mgmt_tx->buff, buf, len); + memcpy(mgmt_tx->buff, buf, len); mgmt_tx->size = len; @@ -2583,7 +2567,7 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy, { /*Now we have a public action vendor specific action frame, check if its a p2p public action frame * based on the standard its should have the p2p_oui attribute with the following values 50 6f 9A 09*/ - if (!WILC_memcmp(u8P2P_oui, &buf[ACTION_SUBTYPE_ID + 1], 4)) { + if (!memcmp(u8P2P_oui, &buf[ACTION_SUBTYPE_ID + 1], 4)) { /*For the connection of two WILC's connection generate a rand number to determine who will be a GO*/ if ((buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == GO_NEG_RSP)) { if (u8P2Plocalrandom == 1 && u8P2Precvrandom < u8P2Plocalrandom) { @@ -2600,7 +2584,7 @@ int WILC_WFI_mgmt_tx(struct wiphy *wiphy, /*Search for the p2p information information element , after the Public action subtype theres a byte for teh dialog token, skip that*/ for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) { - if (buf[i] == P2PELEM_ATTR_ID && !(WILC_memcmp(u8P2P_oui, &buf[i + 2], 4))) { + if (buf[i] == P2PELEM_ATTR_ID && !(memcmp(u8P2P_oui, &buf[i + 2], 4))) { if (buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buf[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_RSP) WILC_WFI_CfgParseTxAction(&mgmt_tx->buff[i + 6], len - (i + 6), true, nic->iftype); @@ -2862,7 +2846,7 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP g_obtainingIP = false; - WILC_TimerStop(&hDuringIpTimer, NULL); + del_timer(&hDuringIpTimer); PRINT_D(GENERIC_DBG, "Changing virtual interface, enable scan\n"); #endif /*BugID_5137*/ @@ -2886,7 +2870,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev /*Remove the enteries of the previously connected clients*/ memset(priv->assoc_stainfo.au8Sta_AssociatedBss, 0, MAX_NUM_STA * ETH_ALEN); - #ifndef SIMULATION #ifdef WILC_P2P interface_type = nic->iftype; nic->iftype = STATION_MODE; @@ -2907,15 +2890,15 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev /*Setting interface 1 drv handler and mac address in newly downloaded FW*/ host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler); - host_int_set_MacAddress((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_linux_wlan->strInterfaceInfo[0].aSrcAddress); host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { - host_int_set_WEPDefaultKeyID((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_key_wep_params.key_idx); - host_int_add_wep_key_bss_sta((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -2964,7 +2947,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev host_int_set_power_mgmt(priv->hWILCWFIDrv, 1, 0); } #endif - #endif break; case NL80211_IFTYPE_P2P_CLIENT: @@ -2979,7 +2961,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev priv->wdev->iftype = type; nic->monitor_flag = 0; - #ifndef SIMULATION #ifdef WILC_P2P PRINT_D(HOSTAPD_DBG, "Downloading P2P_CONCURRENCY_FIRMWARE\n"); @@ -2995,15 +2976,15 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev g_wilc_initialized = 1; host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler); - host_int_set_MacAddress((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_linux_wlan->strInterfaceInfo[0].aSrcAddress); host_int_set_operation_mode(priv->hWILCWFIDrv, STATION_MODE); /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { - host_int_set_WEPDefaultKeyID((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_key_wep_params.key_idx); - host_int_add_wep_key_bss_sta((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -3053,7 +3034,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev } } #endif - #endif break; case NL80211_IFTYPE_AP: @@ -3064,7 +3044,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev nic->iftype = AP_MODE; PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv); - #ifndef SIMULATION PRINT_D(HOSTAPD_DBG, "Downloading AP firmware\n"); linux_wlan_get_firmware(nic); #ifdef WILC_P2P @@ -3086,7 +3065,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev } } #endif - #endif break; case NL80211_IFTYPE_P2P_GO: @@ -3094,7 +3072,7 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP g_obtainingIP = true; - WILC_TimerStart(&hDuringIpTimer, duringIP_TIME, NULL, NULL); + mod_timer(&hDuringIpTimer, jiffies + msecs_to_jiffies(duringIP_TIME)); #endif host_int_set_power_mgmt(priv->hWILCWFIDrv, 0, 0); /*BugID_5222*/ @@ -3110,7 +3088,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev PRINT_D(CORECONFIG_DBG, "priv->hWILCWFIDrv[%p]\n", priv->hWILCWFIDrv); - #ifndef SIMULATION #ifdef WILC_P2P PRINT_D(HOSTAPD_DBG, "Downloading P2P_CONCURRENCY_FIRMWARE\n"); @@ -3127,15 +3104,15 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev /*Setting interface 1 drv handler and mac address in newly downloaded FW*/ host_int_set_wfi_drv_handler(g_linux_wlan->strInterfaceInfo[0].drvHandler); - host_int_set_MacAddress((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_set_MacAddress(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_linux_wlan->strInterfaceInfo[0].aSrcAddress); host_int_set_operation_mode(priv->hWILCWFIDrv, AP_MODE); /*Add saved WEP keys, if any*/ if (g_wep_keys_saved) { - host_int_set_WEPDefaultKeyID((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_set_WEPDefaultKeyID(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_key_wep_params.key_idx); - host_int_add_wep_key_bss_sta((WILC_WFIDrvHandle)(g_linux_wlan->strInterfaceInfo[0].drvHandler), + host_int_add_wep_key_bss_sta(g_linux_wlan->strInterfaceInfo[0].drvHandler, g_key_wep_params.key, g_key_wep_params.key_len, g_key_wep_params.key_idx); @@ -3185,7 +3162,6 @@ static int WILC_WFI_change_virt_intf(struct wiphy *wiphy, struct net_device *dev } } #endif - #endif break; default: @@ -3234,7 +3210,7 @@ static int WILC_WFI_start_ap(struct wiphy *wiphy, struct net_device *dev, priv = wiphy_priv(wiphy); PRINT_D(HOSTAPD_DBG, "Starting ap\n"); - PRINT_D(HOSTAPD_DBG, "Interval = %d \n DTIM period = %d\n Head length = %zu Tail length = %zu\n", + PRINT_D(HOSTAPD_DBG, "Interval = %d\n DTIM period = %d\n Head length = %zu Tail length = %zu\n", settings->beacon_interval, settings->dtim_period, beacon->head_len, beacon->tail_len); s32Error = WILC_WFI_CfgSetChannel(wiphy, &settings->chandef); @@ -3353,7 +3329,7 @@ static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev, { s32 s32Error = WILC_SUCCESS; struct WILC_WFI_priv *priv; - tstrWILC_AddStaParam strStaParams = {{0}}; + tstrWILC_AddStaParam strStaParams = { {0} }; perInterface_wlan_t *nic; @@ -3365,8 +3341,8 @@ static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev, if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { #ifndef WILC_FULLY_HOSTING_AP - WILC_memcpy(strStaParams.au8BSSID, mac, ETH_ALEN); - WILC_memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); + memcpy(strStaParams.au8BSSID, mac, ETH_ALEN); + memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); strStaParams.u16AssocID = params->aid; strStaParams.u8NumRates = params->supported_rates_len; strStaParams.pu8Rates = params->supported_rates; @@ -3384,7 +3360,7 @@ static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.bIsHTSupported = true; strStaParams.u16HTCapInfo = params->ht_capa->cap_info; strStaParams.u8AmpduParams = params->ht_capa->ampdu_params_info; - WILC_memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); + memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); strStaParams.u16HTExtParams = params->ht_capa->extended_ht_cap_info; strStaParams.u32TxBeamformingCap = params->ht_capa->tx_BF_cap_info; strStaParams.u8ASELCap = params->ht_capa->antenna_selection_info; @@ -3407,7 +3383,7 @@ static int WILC_WFI_add_station(struct wiphy *wiphy, struct net_device *dev, #else PRINT_D(CFG80211_DBG, "Adding station parameters %d\n", params->aid); - WILC_memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); + memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], mac, ETH_ALEN); PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][0], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][1], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][2], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][3], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][4], priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid][5]); @@ -3450,7 +3426,7 @@ static int WILC_WFI_del_station(struct wiphy *wiphy, struct net_device *dev, if (mac == NULL) { - PRINT_D(HOSTAPD_DBG, "All associated stations \n"); + PRINT_D(HOSTAPD_DBG, "All associated stations\n"); s32Error = host_int_del_allstation(priv->hWILCWFIDrv, priv->assoc_stainfo.au8Sta_AssociatedBss); } else { PRINT_D(HOSTAPD_DBG, "With mac address: %x%x%x%x%x%x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); @@ -3484,7 +3460,7 @@ static int WILC_WFI_change_station(struct wiphy *wiphy, struct net_device *dev, { s32 s32Error = WILC_SUCCESS; struct WILC_WFI_priv *priv; - tstrWILC_AddStaParam strStaParams = {{0}}; + tstrWILC_AddStaParam strStaParams = { {0} }; perInterface_wlan_t *nic; @@ -3498,7 +3474,7 @@ static int WILC_WFI_change_station(struct wiphy *wiphy, struct net_device *dev, if (nic->iftype == AP_MODE || nic->iftype == GO_MODE) { #ifndef WILC_FULLY_HOSTING_AP - WILC_memcpy(strStaParams.au8BSSID, mac, ETH_ALEN); + memcpy(strStaParams.au8BSSID, mac, ETH_ALEN); strStaParams.u16AssocID = params->aid; strStaParams.u8NumRates = params->supported_rates_len; strStaParams.pu8Rates = params->supported_rates; @@ -3514,7 +3490,7 @@ static int WILC_WFI_change_station(struct wiphy *wiphy, struct net_device *dev, strStaParams.bIsHTSupported = true; strStaParams.u16HTCapInfo = params->ht_capa->cap_info; strStaParams.u8AmpduParams = params->ht_capa->ampdu_params_info; - WILC_memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); + memcpy(strStaParams.au8SuppMCsSet, ¶ms->ht_capa->mcs, WILC_SUPP_MCS_SET_SIZE); strStaParams.u16HTExtParams = params->ht_capa->extended_ht_cap_info; strStaParams.u32TxBeamformingCap = params->ht_capa->tx_BF_cap_info; strStaParams.u8ASELCap = params->ht_capa->antenna_selection_info; @@ -3581,13 +3557,8 @@ struct wireless_dev *WILC_WFI_add_virt_intf(struct wiphy *wiphy, const char *nam new_ifc = WILC_WFI_init_mon_interface(name, nic->wilc_netdev); if (new_ifc != NULL) { PRINT_D(HOSTAPD_DBG, "Setting monitor flag in private structure\n"); - #ifdef SIMULATION - priv = netdev_priv(priv->wdev->netdev); - priv->monitor_flag = 1; - #else nic = netdev_priv(priv->wdev->netdev); nic->monitor_flag = 1; - #endif } else PRINT_ER("Error in initializing monitor interface\n "); } @@ -3856,9 +3827,9 @@ int WILC_WFI_InitHostInt(struct net_device *net) PRINT_D(INIT_DBG, "Host[%p][%p]\n", net, net->ieee80211_ptr); priv = wdev_priv(net->ieee80211_ptr); if (op_ifcs == 0) { - s32Error = WILC_TimerCreate(&(hAgingTimer), remove_network_from_shadow, NULL); + setup_timer(&hAgingTimer, remove_network_from_shadow, 0); #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP - s32Error = WILC_TimerCreate(&(hDuringIpTimer), clear_duringIP, NULL); + setup_timer(&hDuringIpTimer, clear_duringIP, 0); #endif } op_ifcs++; @@ -3908,7 +3879,7 @@ int WILC_WFI_DeInitHostInt(struct net_device *net) #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP if (op_ifcs == 0) { PRINT_D(CORECONFIG_DBG, "destroy during ip\n"); - WILC_TimerDestroy(&hDuringIpTimer, NULL); + del_timer_sync(&hDuringIpTimer); } #endif diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h index c25350cb5..97b663b7f 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h @@ -123,7 +123,7 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_devi #ifdef TCP_ENHANCEMENTS #define TCP_ACK_FILTER_LINK_SPEED_THRESH 54 #define DEFAULT_LINK_SPEED 72 -extern void Enable_TCP_ACK_Filter(bool value); +void Enable_TCP_ACK_Filter(bool value); #endif #endif diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.c b/drivers/staging/wilc1000/wilc_wfi_netdevice.c deleted file mode 100644 index ab66ce4bd..000000000 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.c +++ /dev/null @@ -1,951 +0,0 @@ -/*! - * @file wilc_wfi_netdevice.c - * @brief File Operations OS wrapper functionality - * @author mdaftedar - * @sa wilc_wfi_netdevice.h - * @date 01 MAR 2012 - * @version 1.0 - */ - -#ifdef SIMULATION - -#include "wilc_wfi_cfgoperations.h" -#include "host_interface.h" - - -MODULE_AUTHOR("Mai Daftedar"); -MODULE_LICENSE("Dual BSD/GPL"); - - -struct net_device *WILC_WFI_devs[2]; - -/* - * Transmitter lockup simulation, normally disabled. - */ -static int lockup; -module_param(lockup, int, 0); - -static int timeout = WILC_WFI_TIMEOUT; -module_param(timeout, int, 0); - -/* - * Do we run in NAPI mode? - */ -static int use_napi ; -module_param(use_napi, int, 0); - - -/* - * A structure representing an in-flight packet. - */ -struct WILC_WFI_packet { - struct WILC_WFI_packet *next; - struct net_device *dev; - int datalen; - u8 data[ETH_DATA_LEN]; -}; - - - -int pool_size = 8; -module_param(pool_size, int, 0); - - -static void WILC_WFI_TxTimeout(struct net_device *dev); -static void (*WILC_WFI_Interrupt)(int, void *, struct pt_regs *); - -/** - * @brief WILC_WFI_SetupPool - * @details Set up a device's packet pool. - * @param[in] struct net_device *dev : Network Device Pointer - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_SetupPool(struct net_device *dev) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - int i; - struct WILC_WFI_packet *pkt; - - priv->ppool = NULL; - for (i = 0; i < pool_size; i++) { - pkt = kmalloc (sizeof (struct WILC_WFI_packet), GFP_KERNEL); - if (pkt == NULL) { - PRINT_D(RX_DBG, "Ran out of memory allocating packet pool\n"); - return; - } - pkt->dev = dev; - pkt->next = priv->ppool; - priv->ppool = pkt; - } -} - -/** - * @brief WILC_WFI_TearDownPool - * @details Internal cleanup function that's called after the network device - * driver is unregistered - * @param[in] struct net_device *dev : Network Device Driver - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_TearDownPool(struct net_device *dev) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - struct WILC_WFI_packet *pkt; - - while ((pkt = priv->ppool)) { - priv->ppool = pkt->next; - kfree (pkt); - /* FIXME - in-flight packets ? */ - } -} - -/** - * @brief WILC_WFI_GetTxBuffer - * @details Buffer/pool management - * @param[in] net_device *dev : Network Device Driver Structure - * @return struct WILC_WFI_packet - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -struct WILC_WFI_packet *WILC_WFI_GetTxBuffer(struct net_device *dev) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - unsigned long flags; - struct WILC_WFI_packet *pkt; - - spin_lock_irqsave(&priv->lock, flags); - pkt = priv->ppool; - priv->ppool = pkt->next; - if (priv->ppool == NULL) { - PRINT_INFO(RX_DBG, "Pool empty\n"); - netif_stop_queue(dev); - } - spin_unlock_irqrestore(&priv->lock, flags); - return pkt; -} -/** - * @brief WILC_WFI_ReleaseBuffer - * @details Buffer/pool management - * @param[in] WILC_WFI_packet *pkt : Structure holding in-flight packet - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_ReleaseBuffer(struct WILC_WFI_packet *pkt) -{ - unsigned long flags; - struct WILC_WFI_priv *priv = netdev_priv(pkt->dev); - - spin_lock_irqsave(&priv->lock, flags); - pkt->next = priv->ppool; - priv->ppool = pkt; - spin_unlock_irqrestore(&priv->lock, flags); - if (netif_queue_stopped(pkt->dev) && pkt->next == NULL) - netif_wake_queue(pkt->dev); -} - -/** - * @brief WILC_WFI_EnqueueBuf - * @details Enqueuing packets in an RX buffer queue - * @param[in] WILC_WFI_packet *pkt : Structure holding in-flight packet - * @param[in] net_device *dev : Network Device Driver Structure - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_EnqueueBuf(struct net_device *dev, struct WILC_WFI_packet *pkt) -{ - unsigned long flags; - struct WILC_WFI_priv *priv = netdev_priv(dev); - - spin_lock_irqsave(&priv->lock, flags); - pkt->next = priv->rx_queue; /* FIXME - misorders packets */ - priv->rx_queue = pkt; - spin_unlock_irqrestore(&priv->lock, flags); -} - -/** - * @brief WILC_WFI_DequeueBuf - * @details Dequeuing packets from the RX buffer queue - * @param[in] net_device *dev : Network Device Driver Structure - * @return WILC_WFI_packet *pkt : Structure holding in-flight pac - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -struct WILC_WFI_packet *WILC_WFI_DequeueBuf(struct net_device *dev) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - struct WILC_WFI_packet *pkt; - unsigned long flags; - - spin_lock_irqsave(&priv->lock, flags); - pkt = priv->rx_queue; - if (pkt != NULL) - priv->rx_queue = pkt->next; - spin_unlock_irqrestore(&priv->lock, flags); - return pkt; -} -/** - * @brief WILC_WFI_RxInts - * @details Enable and disable receive interrupts. - * @param[in] net_device *dev : Network Device Driver Structure - * @param[in] enable : Enable/Disable flag - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -static void WILC_WFI_RxInts(struct net_device *dev, int enable) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - priv->rx_int_enabled = enable; -} - -/** - * @brief WILC_WFI_Open - * @details Open Network Device Driver, called when the network - * interface is opened. It starts the interface's transmit queue. - * @param[in] net_device *dev : Network Device Driver Structure - * @param[in] enable : Enable/Disable flag - * @return int : Returns 0 upon success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Open(struct net_device *dev) -{ - /* request_region(), request_irq(), .... (like fops->open) */ - /* - * Assign the hardware address of the board: use "\0SNULx", where - * x is 0 or 1. The first byte is '\0' to avoid being a multicast - * address (the first byte of multicast addrs is odd). - */ - memcpy(dev->dev_addr, "\0WLAN0", ETH_ALEN); - if (dev == WILC_WFI_devs[1]) - dev->dev_addr[ETH_ALEN - 1]++; /* \0SNUL1 */ - - WILC_WFI_InitHostInt(dev); - netif_start_queue(dev); - return 0; -} -/** - * @brief WILC_WFI_Release - * @details Release Network Device Driver, called when the network - * interface is stopped or brought down. This function marks - * the network driver as not being able to transmit - * @param[in] net_device *dev : Network Device Driver Structure - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Release(struct net_device *dev) -{ - /* release ports, irq and such -- like fops->close */ - - netif_stop_queue(dev); /* can't transmit any more */ - - return 0; -} -/** - * @brief WILC_WFI_Config - * @details Configuration changes (passed on by ifconfig) - * @param[in] net_device *dev : Network Device Driver Structure - * @param[in] struct ifmap *map : Contains the ioctl implementation for the - * network driver. - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Config(struct net_device *dev, struct ifmap *map) -{ - if (dev->flags & IFF_UP) /* can't act on a running interface */ - return -EBUSY; - - /* Don't allow changing the I/O address */ - if (map->base_addr != dev->base_addr) { - PRINT_D(RX_DBG, KERN_WARNING "WILC_WFI: Can't change I/O address\n"); - return -EOPNOTSUPP; - } - - /* Allow changing the IRQ */ - if (map->irq != dev->irq) { - dev->irq = map->irq; - /* request_irq() is delayed to open-time */ - } - - /* ignore other fields */ - return 0; -} -/** - * @brief WILC_WFI_Rx - * @details Receive a packet: retrieve, encapsulate and pass over to upper - * levels - * @param[in] net_device *dev : Network Device Driver Structure - * @param[in] WILC_WFI_packet : - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_Rx(struct net_device *dev, struct WILC_WFI_packet *pkt) -{ - int i; - struct sk_buff *skb; - struct WILC_WFI_priv *priv = netdev_priv(dev); - s8 rssi; - /* - * The packet has been retrieved from the transmission - * medium. Build an skb around it, so upper layers can handle it - */ - - - skb = dev_alloc_skb(pkt->datalen + 2); - if (!skb) { - if (printk_ratelimit()) - PRINT_D(RX_DBG, "WILC_WFI rx: low on mem - packet dropped\n"); - priv->stats.rx_dropped++; - goto out; - } - skb_reserve(skb, 2); /* align IP on 16B boundary */ - memcpy(skb_put(skb, pkt->datalen), pkt->data, pkt->datalen); - - if (priv->monitor_flag) { - PRINT_INFO(RX_DBG, "In monitor device name %s\n", dev->name); - priv = wiphy_priv(priv->dev->ieee80211_ptr->wiphy); - PRINT_D(RX_DBG, "VALUE PASSED IN OF HRWD %p\n", priv->hWILCWFIDrv); - /* host_int_get_rssi(priv->hWILCWFIDrv, &(rssi)); */ - if (INFO) { - for (i = 14; i < skb->len; i++) - PRINT_INFO(RX_DBG, "RXdata[%d] %02x\n", i, skb->data[i]); - } - WILC_WFI_monitor_rx(dev, skb); - return; - } -out: - return; -} - -/** - * @brief WILC_WFI_Poll - * @details The poll implementation - * @param[in] struct napi_struct *napi : - * @param[in] int budget : - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -static int WILC_WFI_Poll(struct napi_struct *napi, int budget) -{ - int npackets = 0; - struct sk_buff *skb; - struct WILC_WFI_priv *priv = container_of(napi, struct WILC_WFI_priv, napi); - struct net_device *dev = priv->dev; - struct WILC_WFI_packet *pkt; - - while (npackets < budget && priv->rx_queue) { - pkt = WILC_WFI_DequeueBuf(dev); - skb = dev_alloc_skb(pkt->datalen + 2); - if (!skb) { - if (printk_ratelimit()) - PRINT_D(RX_DBG, "WILC_WFI: packet dropped\n"); - priv->stats.rx_dropped++; - WILC_WFI_ReleaseBuffer(pkt); - continue; - } - skb_reserve(skb, 2); /* align IP on 16B boundary */ - memcpy(skb_put(skb, pkt->datalen), pkt->data, pkt->datalen); - skb->dev = dev; - skb->protocol = eth_type_trans(skb, dev); - skb->ip_summed = CHECKSUM_UNNECESSARY; /* don't check it */ - netif_receive_skb(skb); - /* Maintain stats */ - npackets++; - WILC_WFI_update_stats(priv->dev->ieee80211_ptr->wiphy, pkt->datalen, WILC_WFI_RX_PKT); - WILC_WFI_ReleaseBuffer(pkt); - } - /* If we processed all packets, we're done; tell the kernel and re-enable ints */ - if (npackets < budget) { - napi_complete(napi); - WILC_WFI_RxInts(dev, 1); - } - return npackets; -} - -/** - * @brief WILC_WFI_Poll - * @details The typical interrupt entry point - * @param[in] struct napi_struct *napi : - * @param[in] int budget : - * @return int : Return 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -static void WILC_WFI_RegularInterrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - int statusword; - struct WILC_WFI_priv *priv; - struct WILC_WFI_packet *pkt = NULL; - /* - * As usual, check the "device" pointer to be sure it is - * really interrupting. - * Then assign "struct device *dev" - */ - struct net_device *dev = (struct net_device *)dev_id; - /* ... and check with hw if it's really ours */ - - /* paranoid */ - if (!dev) - return; - - /* Lock the device */ - priv = netdev_priv(dev); - spin_lock(&priv->lock); - - /* retrieve statusword: real netdevices use I/O instructions */ - statusword = priv->status; - priv->status = 0; - if (statusword & WILC_WFI_RX_INTR) { - /* send it to WILC_WFI_rx for handling */ - pkt = priv->rx_queue; - if (pkt) { - priv->rx_queue = pkt->next; - WILC_WFI_Rx(dev, pkt); - } - } - if (statusword & WILC_WFI_TX_INTR) { - /* a transmission is over: free the skb */ - WILC_WFI_update_stats(priv->dev->ieee80211_ptr->wiphy, priv->tx_packetlen, WILC_WFI_TX_PKT); - dev_kfree_skb(priv->skb); - } - - /* Unlock the device and we are done */ - spin_unlock(&priv->lock); - if (pkt) - WILC_WFI_ReleaseBuffer(pkt); /* Do this outside the lock! */ - return; -} -/** - * @brief WILC_WFI_NapiInterrupt - * @details A NAPI interrupt handler - * @param[in] irq: - * @param[in] dev_id: - * @param[in] pt_regs: - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -static void WILC_WFI_NapiInterrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - int statusword; - struct WILC_WFI_priv *priv; - - /* - * As usual, check the "device" pointer for shared handlers. - * Then assign "struct device *dev" - */ - struct net_device *dev = (struct net_device *)dev_id; - /* ... and check with hw if it's really ours */ - - /* paranoid */ - if (!dev) - return; - - /* Lock the device */ - priv = netdev_priv(dev); - spin_lock(&priv->lock); - - /* retrieve statusword: real netdevices use I/O instructions */ - statusword = priv->status; - priv->status = 0; - if (statusword & WILC_WFI_RX_INTR) { - WILC_WFI_RxInts(dev, 0); /* Disable further interrupts */ - napi_schedule(&priv->napi); - } - if (statusword & WILC_WFI_TX_INTR) { - /* a transmission is over: free the skb */ - - WILC_WFI_update_stats(priv->dev->ieee80211_ptr->wiphy, priv->tx_packetlen, WILC_WFI_TX_PKT); - dev_kfree_skb(priv->skb); - } - - /* Unlock the device and we are done */ - spin_unlock(&priv->lock); - return; -} - -/** - * @brief MI_WFI_HwTx - * @details Transmit a packet (low level interface) - * @param[in] buf: - * @param[in] len: - * @param[in] net_device *dev: - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_HwTx(char *buf, int len, struct net_device *dev) -{ - /* - * This function deals with hw details. This interface loops - * back the packet to the other WILC_WFI interface (if any). - * In other words, this function implements the WILC_WFI behaviour, - * while all other procedures are rather device-independent - */ - struct iphdr *ih; - struct net_device *dest; - struct WILC_WFI_priv *priv; - u32 *saddr, *daddr; - struct WILC_WFI_packet *tx_buffer; - - - /* I am paranoid. Ain't I? */ - if (len < sizeof(struct ethhdr) + sizeof(struct iphdr)) { - PRINT_D(RX_DBG, "WILC_WFI: Hmm... packet too short (%i octets)\n", - len); - return; - } - - if (0) { /* enable this conditional to look at the data */ - int i; - PRINT_D(RX_DBG, "len is %i", len); - for (i = 14; i < len; i++) - PRINT_D(RX_DBG, "TXdata[%d] %02x\n", i, buf[i] & 0xff); - /* PRINT_D(RX_DBG, "\n"); */ - } - /* - * Ethhdr is 14 bytes, but the kernel arranges for iphdr - * to be aligned (i.e., ethhdr is unaligned) - */ - ih = (struct iphdr *)(buf + sizeof(struct ethhdr)); - saddr = &ih->saddr; - daddr = &ih->daddr; - - ((u8 *)saddr)[2] ^= 1; /* change the third octet (class C) */ - ((u8 *)daddr)[2] ^= 1; - - ih->check = 0; /* and rebuild the checksum (ip needs it) */ - ih->check = ip_fast_csum((unsigned char *)ih, ih->ihl); - - - if (dev == WILC_WFI_devs[0]) - PRINT_D(RX_DBG, "%08x:%05i --> %08x:%05i\n", - ntohl(ih->saddr), ntohs(((struct tcphdr *)(ih + 1))->source), - ntohl(ih->daddr), ntohs(((struct tcphdr *)(ih + 1))->dest)); - else - PRINT_D(RX_DBG, "%08x:%05i <-- %08x:%05i\n", - ntohl(ih->daddr), ntohs(((struct tcphdr *)(ih + 1))->dest), - ntohl(ih->saddr), ntohs(((struct tcphdr *)(ih + 1))->source)); - - /* - * Ok, now the packet is ready for transmission: first simulate a - * receive interrupt on the twin device, then a - * transmission-done on the transmitting device - */ - dest = WILC_WFI_devs[dev == WILC_WFI_devs[0] ? 1 : 0]; - priv = netdev_priv(dest); - - tx_buffer = WILC_WFI_GetTxBuffer(dev); - tx_buffer->datalen = len; - memcpy(tx_buffer->data, buf, len); - WILC_WFI_EnqueueBuf(dest, tx_buffer); - if (priv->rx_int_enabled) { - priv->status |= WILC_WFI_RX_INTR; - WILC_WFI_Interrupt(0, dest, NULL); - } - - priv = netdev_priv(dev); - priv->tx_packetlen = len; - priv->tx_packetdata = buf; - priv->status |= WILC_WFI_TX_INTR; - if (lockup && ((priv->stats.tx_packets + 1) % lockup) == 0) { - /* Simulate a dropped transmit interrupt */ - netif_stop_queue(dev); - PRINT_D(RX_DBG, "Simulate lockup at %ld, txp %ld\n", jiffies, - (unsigned long) priv->stats.tx_packets); - } else - WILC_WFI_Interrupt(0, dev, NULL); - -} - -/** - * @brief WILC_WFI_Tx - * @details Transmit a packet (called by the kernel) - * @param[in] sk_buff *skb: - * @param[in] net_device *dev: - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Tx(struct sk_buff *skb, struct net_device *dev) -{ - int len; - char *data, shortpkt[ETH_ZLEN]; - struct WILC_WFI_priv *priv = netdev_priv(dev); - - /* priv = wiphy_priv(priv->dev->ieee80211_ptr->wiphy); */ - - /* if(priv->monitor_flag) */ - /* mac80211_hwsim_monitor_rx(skb); */ - - - data = skb->data; - len = skb->len; - - if (len < ETH_ZLEN) { - memset(shortpkt, 0, ETH_ZLEN); - memcpy(shortpkt, skb->data, skb->len); - len = ETH_ZLEN; - data = shortpkt; - } - dev->trans_start = jiffies; /* save the timestamp */ - - /* Remember the skb, so we can free it at interrupt time */ - priv->skb = skb; - - /* actual deliver of data is device-specific, and not shown here */ - WILC_WFI_HwTx(data, len, dev); - - return 0; /* Our simple device can not fail */ -} - -/** - * @brief WILC_WFI_TxTimeout - * @details Deal with a transmit timeout. - * @param[in] net_device *dev: - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_TxTimeout(struct net_device *dev) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - - PRINT_D(RX_DBG, "Transmit timeout at %ld, latency %ld\n", jiffies, - jiffies - dev->trans_start); - /* Simulate a transmission interrupt to get things moving */ - priv->status = WILC_WFI_TX_INTR; - WILC_WFI_Interrupt(0, dev, NULL); - priv->stats.tx_errors++; - netif_wake_queue(dev); - return; -} - -/** - * @brief WILC_WFI_Ioctl - * @details Ioctl commands - * @param[in] net_device *dev: - * @param[in] ifreq *rq - * @param[in] cmd: - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - PRINT_D(RX_DBG, "ioctl\n"); - return 0; -} - -/** - * @brief WILC_WFI_Stat - * @details Return statistics to the caller - * @param[in] net_device *dev: - * @return WILC_WFI_Stats : Return net_device_stats stucture with the - * network device driver private data contents. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -struct net_device_stats *WILC_WFI_Stats(struct net_device *dev) -{ - struct WILC_WFI_priv *priv = netdev_priv(dev); - return &priv->stats; -} - -/** - * @brief WILC_WFI_RebuildHeader - * @details This function is called to fill up an eth header, since arp is not - * available on the interface - * @param[in] sk_buff *skb: - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_RebuildHeader(struct sk_buff *skb) -{ - struct ethhdr *eth = (struct ethhdr *) skb->data; - struct net_device *dev = skb->dev; - - memcpy(eth->h_source, dev->dev_addr, dev->addr_len); - memcpy(eth->h_dest, dev->dev_addr, dev->addr_len); - eth->h_dest[ETH_ALEN - 1] ^= 0x01; /* dest is us xor 1 */ - return 0; -} -/** - * @brief WILC_WFI_RebuildHeader - * @details This function is called to fill up an eth header, since arp is not - * available on the interface - * @param[in] sk_buff *skb: - * @param[in] struct net_device *dev: - * @param[in] unsigned short type: - * @param[in] const void *saddr, - * @param[in] const void *daddr: - * @param[in] unsigned int len - * @return int : Return 0 on Success - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_Header(struct sk_buff *skb, struct net_device *dev, - unsigned short type, const void *daddr, const void *saddr, - unsigned int len) -{ - struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN); - - eth->h_proto = htons(type); - memcpy(eth->h_source, saddr ? saddr : dev->dev_addr, dev->addr_len); - memcpy(eth->h_dest, daddr ? daddr : dev->dev_addr, dev->addr_len); - eth->h_dest[ETH_ALEN - 1] ^= 0x01; /* dest is us xor 1 */ - return dev->hard_header_len; -} - -/** - * @brief WILC_WFI_ChangeMtu - * @details The "change_mtu" method is usually not needed. - * If you need it, it must be like this. - * @param[in] net_device *dev : Network Device Driver Structure - * @param[in] new_mtu : - * @return int : Returns 0 on Success. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_ChangeMtu(struct net_device *dev, int new_mtu) -{ - unsigned long flags; - struct WILC_WFI_priv *priv = netdev_priv(dev); - spinlock_t *lock = &priv->lock; - - /* check ranges */ - if ((new_mtu < 68) || (new_mtu > 1500)) - return -EINVAL; - /* - * Do anything you need, and the accept the value - */ - spin_lock_irqsave(lock, flags); - dev->mtu = new_mtu; - spin_unlock_irqrestore(lock, flags); - return 0; /* success */ -} - -static const struct header_ops WILC_WFI_header_ops = { - .create = WILC_WFI_Header, - .rebuild = WILC_WFI_RebuildHeader, - .cache = NULL, /* disable caching */ -}; - - -static const struct net_device_ops WILC_WFI_netdev_ops = { - .ndo_open = WILC_WFI_Open, - .ndo_stop = WILC_WFI_Release, - .ndo_set_config = WILC_WFI_Config, - .ndo_start_xmit = WILC_WFI_Tx, - .ndo_do_ioctl = WILC_WFI_Ioctl, - .ndo_get_stats = WILC_WFI_Stats, - .ndo_change_mtu = WILC_WFI_ChangeMtu, - .ndo_tx_timeout = WILC_WFI_TxTimeout, -}; - -/** - * @brief WILC_WFI_Init - * @details The init function (sometimes called probe). - * It is invoked by register_netdev() - * @param[in] net_device *dev: - * @return NONE - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -void WILC_WFI_Init(struct net_device *dev) -{ - struct WILC_WFI_priv *priv; - - - /* - * Then, assign other fields in dev, using ether_setup() and some - * hand assignments - */ - ether_setup(dev); /* assign some of the fields */ - /* 1- Allocate space */ - - dev->netdev_ops = &WILC_WFI_netdev_ops; - dev->header_ops = &WILC_WFI_header_ops; - dev->watchdog_timeo = timeout; - /* keep the default flags, just add NOARP */ - dev->flags |= IFF_NOARP; - dev->features |= NETIF_F_NO_CSUM; - /* - * Then, initialize the priv field. This encloses the statistics - * and a few private fields. - */ - priv = netdev_priv(dev); - memset(priv, 0, sizeof(struct WILC_WFI_priv)); - priv->dev = dev; - netif_napi_add(dev, &priv->napi, WILC_WFI_Poll, 2); - /* The last parameter above is the NAPI "weight". */ - spin_lock_init(&priv->lock); - WILC_WFI_RxInts(dev, 1); /* enable receive interrupts */ - WILC_WFI_SetupPool(dev); -} - -/** - * @brief WILC_WFI_Stat - * @details Return statistics to the caller - * @param[in] net_device *dev: - * @return WILC_WFI_Stats : Return net_device_stats stucture with the - * network device driver private data contents. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ - -void WILC_WFI_Cleanup(void) -{ - int i; - struct WILC_WFI_priv *priv[2]; - - /*if(hwsim_mon!=NULL) - * { - * PRINT_D(RX_DBG, "Freeing monitor interface\n"); - * unregister_netdev(hwsim_mon); - * free_netdev(hwsim_mon); - * }*/ - for (i = 0; i < 2; i++) { - priv[i] = netdev_priv(WILC_WFI_devs[i]); - - if (WILC_WFI_devs[i]) { - PRINT_D(RX_DBG, "Unregistering\n"); - unregister_netdev(WILC_WFI_devs[i]); - WILC_WFI_TearDownPool(WILC_WFI_devs[i]); - free_netdev(WILC_WFI_devs[i]); - PRINT_D(RX_DBG, "[NETDEV]Stopping interface\n"); - WILC_WFI_DeInitHostInt(WILC_WFI_devs[i]); - WILC_WFI_WiphyFree(WILC_WFI_devs[i]); - } - - } - /* unregister_netdev(hwsim_mon); */ - WILC_WFI_deinit_mon_interface(); - return; -} - - -void StartConfigSim(void); - - - - - - - -/** - * @brief WILC_WFI_Stat - * @details Return statistics to the caller - * @param[in] net_device *dev: - * @return WILC_WFI_Stats : Return net_device_stats stucture with the - * network device driver private data contents. - * @author mdaftedar - * @date 01 MAR 2012 - * @version 1.0 - */ -int WILC_WFI_InitModule(void) -{ - - int result, i, ret = -ENOMEM; - struct WILC_WFI_priv *priv[2], *netpriv; - struct wireless_dev *wdev; - WILC_WFI_Interrupt = use_napi ? WILC_WFI_NapiInterrupt : WILC_WFI_RegularInterrupt; - char buf[IFNAMSIZ]; - - for (i = 0; i < 2; i++) { - - /* Allocate the net devices */ - WILC_WFI_devs[i] = alloc_netdev(sizeof(struct WILC_WFI_priv), "wlan%d", - WILC_WFI_Init); - if (WILC_WFI_devs[i] == NULL) - goto out; - /* priv[i] = netdev_priv(WILC_WFI_devs[i]); */ - - wdev = WILC_WFI_WiphyRegister(WILC_WFI_devs[i]); - WILC_WFI_devs[i]->ieee80211_ptr = wdev; - netpriv = netdev_priv(WILC_WFI_devs[i]); - netpriv->dev->ieee80211_ptr = wdev; - netpriv->dev->ml_priv = netpriv; - wdev->netdev = netpriv->dev; - - /*Registering the net device*/ - result = register_netdev(WILC_WFI_devs[i]); - if (result) - PRINT_D(RX_DBG, "WILC_WFI: error %i registering device \"%s\"\n", - result, WILC_WFI_devs[i]->name); - else - ret = 0; - } - - - /*init atmel driver */ - priv[0] = netdev_priv(WILC_WFI_devs[0]); - priv[1] = netdev_priv(WILC_WFI_devs[1]); - - if (priv[1]->dev->ieee80211_ptr->wiphy->interface_modes && BIT(NL80211_IFTYPE_MONITOR)) { - /* snprintf(buf, IFNAMSIZ, "mon.%s", priv[1]->dev->name); */ - /* WILC_WFI_init_mon_interface(); */ - /* priv[1]->monitor_flag = 1; */ - - } - priv[0]->bCfgScanning = false; - priv[0]->u32RcvdChCount = 0; - - WILC_memset(priv[0]->au8AssociatedBss, 0xFF, ETH_ALEN); - - - /* ret = host_int_init(&priv[0]->hWILCWFIDrv); */ - /*copy handle to the other driver*/ - /* priv[1]->hWILCWFIDrv = priv[0]->hWILCWFIDrv; */ - if (ret) { - PRINT_ER("Error Init Driver\n"); - } - - -out: - if (ret) - WILC_WFI_Cleanup(); - return ret; - - -} - - -module_init(WILC_WFI_InitModule); -module_exit(WILC_WFI_Cleanup); - -#endif diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index d413fa386..77f320d12 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -77,12 +77,12 @@ struct WILC_WFI_stats { #define num_reg_frame 2 /* * If you use RX_BH_WORK_QUEUE on LPC3131: You may lose the first interrupt on - * LPC3131 which is important to get the MAC start status when you are blocked inside - * linux_wlan_firmware_download() which blocks mac_open(). + * LPC3131 which is important to get the MAC start status when you are blocked + * inside linux_wlan_firmware_download() which blocks mac_open(). */ -#if defined (NM73131_0_BOARD) +#if defined(NM73131_0_BOARD) #define RX_BH_TYPE RX_BH_KTHREAD -#elif defined (PANDA_BOARD) +#elif defined(PANDA_BOARD) #define RX_BH_TYPE RX_BH_THREADED_IRQ #else #define RX_BH_TYPE RX_BH_KTHREAD @@ -95,6 +95,7 @@ struct wilc_wfi_key { int seq_len; u32 cipher; }; + struct wilc_wfi_wep_key { u8 *key; u8 key_len; @@ -143,14 +144,15 @@ struct WILC_WFI_priv { spinlock_t lock; struct net_device *dev; struct napi_struct napi; - WILC_WFIDrvHandle hWILCWFIDrv; + tstrWILC_WFIDrv *hWILCWFIDrv; WILC_WFIDrvHandle hWILCWFIDrv_2; tstrHostIFpmkidAttr pmkid_list; struct WILC_WFI_stats netstats; u8 WILC_WFI_wep_default; u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104]; u8 WILC_WFI_wep_key_len[4]; - struct net_device *real_ndev; /* The real interface that the monitor is on */ + /* The real interface that the monitor is on */ + struct net_device *real_ndev; struct wilc_wfi_key *wilc_gtk[MAX_NUM_STA]; struct wilc_wfi_key *wilc_ptk[MAX_NUM_STA]; u8 wilc_groupkey; @@ -174,7 +176,7 @@ typedef struct { typedef struct { uint8_t aSrcAddress[ETH_ALEN]; uint8_t aBSSID[ETH_ALEN]; - uint32_t drvHandler; + tstrWILC_WFIDrv *drvHandler; struct net_device *wilc_netdev; } tstrInterfaceInfo; typedef struct { diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 3af91f770..7c53a2bd0 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -16,7 +16,6 @@ * Global * ********************************************/ -extern unsigned int int_clrd; extern wilc_hif_func_t hif_sdio; extern wilc_hif_func_t hif_spi; extern wilc_cfg_func_t mac_cfg; @@ -24,8 +23,6 @@ extern wilc_cfg_func_t mac_cfg; extern u8 g_wilc_initialized; /* AMR : 0422 RK3026 Crash issue */ #endif extern void WILC_WFI_mgmt_rx(uint8_t *buff, uint32_t size); -extern void frmw_to_linux(uint8_t *buff, uint32_t size); -int sdio_xfer_cnt(void); uint32_t wilc_get_chipid(uint8_t update); u16 Set_machw_change_vir_if(bool bValue); @@ -118,18 +115,15 @@ static void wilc_debug(uint32_t flag, char *fmt, ...) { char buf[256]; va_list args; - int len; if (flag & dbgflag) { va_start(args, fmt); - len = vsprintf(buf, fmt, args); + vsprintf(buf, fmt, args); va_end(args); if (g_wlan.os_func.os_debug) g_wlan.os_func.os_debug(buf); } - - return; } static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP; @@ -292,13 +286,13 @@ uint32_t Statisitcs_totalAcks = 0, Statisitcs_DroppedAcks = 0; #ifdef TCP_ACK_FILTER struct Ack_session_info; -typedef struct Ack_session_info { +struct Ack_session_info { uint32_t Ack_seq_num; uint32_t Bigger_Ack_num; uint16_t src_port; uint16_t dst_port; uint16_t status; -} Ack_session_info_t; +}; typedef struct { uint32_t ack_num; @@ -319,7 +313,7 @@ struct Ack_session_info *Alloc_head; #define MAX_TCP_SESSION 25 #define MAX_PENDING_ACKS 256 -Ack_session_info_t Acks_keep_track_info[2 * MAX_TCP_SESSION]; +struct Ack_session_info Acks_keep_track_info[2 * MAX_TCP_SESSION]; Pending_Acks_info_t Pending_Acks_info[MAX_PENDING_ACKS]; uint32_t PendingAcks_arrBase; @@ -451,7 +445,7 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void) for (i = PendingAcks_arrBase; i < (PendingAcks_arrBase + Pending_Acks); i++) { if (Pending_Acks_info[i].ack_num < Acks_keep_track_info[Pending_Acks_info[i].Session_index].Bigger_Ack_num) { struct txq_entry_t *tqe; - PRINT_D(TCP_ENH, "DROP ACK: %u \n", Pending_Acks_info[i].ack_num); + PRINT_D(TCP_ENH, "DROP ACK: %u\n", Pending_Acks_info[i].ack_num); tqe = Pending_Acks_info[i].txqe; if (tqe) { wilc_wlan_txq_remove(tqe); @@ -467,11 +461,10 @@ static int wilc_wlan_txq_filter_dup_tcp_ack(void) Pending_Acks = 0; Opened_TCP_session = 0; - if (PendingAcks_arrBase == 0) { + if (PendingAcks_arrBase == 0) PendingAcks_arrBase = MAX_TCP_SESSION; - } else { + else PendingAcks_arrBase = 0; - } p->os_func.os_spin_unlock(p->txq_spinlock, &p->txq_spinlock_flags); @@ -735,7 +728,7 @@ INLINE void chip_wakeup(void) do { /* Wait for the chip to stabilize*/ - WILC_Sleep(2); + usleep_range(2 * 1000, 2 * 1000); /* Make sure chip is awake. This is an extra step that can be removed */ /* later to avoid the bus access overhead */ if ((wilc_get_chipid(true) == 0)) { @@ -758,7 +751,7 @@ INLINE void chip_wakeup(void) /* If still off, redo the wake up sequence */ while (((clk_status_reg & 0x1) == 0) && (((++trials) % 3) == 0)) { /* Wait for the chip to stabilize*/ - WILC_Sleep(2); + usleep_range(2 * 1000, 2 * 1000); /* Make sure chip is awake. This is an extra step that can be removed */ /* later to avoid the bus access overhead */ @@ -996,7 +989,7 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount) /** * wait for vmm table is ready **/ - PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait... \n"); + PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n"); release_bus(RELEASE_ALLOW_SLEEP); p->os_func.os_sleep(3); /* wait 3 ms */ acquire_bus(ACQUIRE_AND_WAKEUP); @@ -1063,7 +1056,7 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount) } if (entries == 0) { - PRINT_WRN(GENERIC_DBG, "[wilc txq]: no more buffer in the chip (reg: %08x), retry later [[ %d, %x ]] \n", reg, i, vmm_table[i - 1]); + PRINT_WRN(GENERIC_DBG, "[wilc txq]: no more buffer in the chip (reg: %08x), retry later [[ %d, %x ]]\n", reg, i, vmm_table[i - 1]); /* undo the transaction. */ ret = p->hif_func.hif_read_reg(WILC_HOST_TX_CTRL, ®); @@ -1114,11 +1107,10 @@ static int wilc_wlan_handle_txq(uint32_t *pu32TxqCount) /*Bug3959: transmitting mgmt frames received from host*/ /*setting bit 30 in the host header to indicate mgmt frame*/ #ifdef WILC_AP_EXTERNAL_MLME - if (tqe->type == WILC_MGMT_PKT) { + if (tqe->type == WILC_MGMT_PKT) header |= (1 << 30); - } else { + else header &= ~(1 << 30); - } #endif #ifdef BIG_ENDIAN @@ -1213,7 +1205,7 @@ static void wilc_wlan_handle_rxq(void) do { if (p->quit) { - PRINT_D(RX_DBG, "exit 1st do-while due to Clean_UP function \n"); + PRINT_D(RX_DBG, "exit 1st do-while due to Clean_UP function\n"); p->os_func.os_signal(p->cfg_wait); break; } @@ -1330,8 +1322,7 @@ static void wilc_wlan_handle_rxq(void) } while (1); p->rxq_exit = 1; - PRINT_D(RX_DBG, "THREAD: Exiting RX thread \n"); - return; + PRINT_D(RX_DBG, "THREAD: Exiting RX thread\n"); } /******************************************** @@ -1414,7 +1405,7 @@ static void wilc_wlan_handle_isr_ext(uint32_t int_status) buffer = p->os_func.os_malloc(size); if (buffer == NULL) { wilc_debug(N_ERR, "[wilc isr]: fail alloc host memory...drop the packets (%d)\n", size); - WILC_Sleep(100); + usleep_range(100 * 1000, 100 * 1000); goto _end_; } #endif @@ -1545,11 +1536,10 @@ static int wilc_wlan_firmware_download(const uint8_t *buffer, uint32_t buffer_si acquire_bus(ACQUIRE_ONLY); offset += 8; while (((int)size) && (offset < buffer_size)) { - if (size <= blksz) { + if (size <= blksz) size2 = size; - } else { + else size2 = blksz; - } /* Copy firmware into a DMA coherent buffer */ memcpy(dma_buffer, &buffer[offset], size2); ret = p->hif_func.hif_block_tx(addr, dma_buffer, size2); @@ -1782,7 +1772,7 @@ static int wilc_wlan_stop(void) /******************************************************************************/ reg = ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 8) | (1 << 9) | (1 << 26) | (1 << 29) | (1 << 30) | (1 << 31)); /**/ /**/ - ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); /**/ + p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); /**/ reg = ~(1 << 10); /**/ /**/ ret = p->hif_func.hif_write_reg(WILC_GLB_RESET_0, reg); /**/ @@ -2306,11 +2296,10 @@ u16 Set_machw_change_vir_if(bool bValue) PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n"); } - if (bValue) { + if (bValue) reg |= (BIT31); - } else { + else reg &= ~(BIT31); - } ret = (&g_wlan)->hif_func.hif_write_reg(WILC_CHANGING_VIR_IF, reg); diff --git a/drivers/staging/wilc1000/wilc_wlan.h b/drivers/staging/wilc1000/wilc_wlan.h index 0ba7ec69e..244f7108a 100644 --- a/drivers/staging/wilc1000/wilc_wlan.h +++ b/drivers/staging/wilc1000/wilc_wlan.h @@ -1,7 +1,7 @@ #ifndef WILC_WLAN_H #define WILC_WLAN_H -#include "wilc_type.h" +#include "wilc_oswrapper.h" #define ISWILC1000(id) (((id & 0xfffff000) == 0x100000) ? 1 : 0) diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 3cffe55b3..e2842d37b 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -363,8 +363,6 @@ static void wilc_wlan_parse_response_frame(uint8_t *info, int size) size -= (2 + len); info += (2 + len); } - - return; } static int wilc_wlan_parse_info_frame(uint8_t *info, int size) @@ -513,7 +511,6 @@ static int wilc_wlan_cfg_indicate_rx(uint8_t *frame, int size, wilc_cfg_rsp_t *r int ret = 1; uint8_t msg_type; uint8_t msg_id; - uint16_t msg_len; #ifdef WILC_FULLY_HOSTING_AP u32 *ptru32Frame; bool bStatus = frame[2]; @@ -528,11 +525,6 @@ static int wilc_wlan_cfg_indicate_rx(uint8_t *frame, int size, wilc_cfg_rsp_t *r msg_type = frame[0]; msg_id = frame[1]; /* seq no */ -#ifdef BIG_ENDIAN - msg_len = (frame[2] << 8) | frame[3]; -#else - msg_len = (frame[3] << 8) | frame[2]; -#endif frame += 4; size -= 4; @@ -557,7 +549,7 @@ static int wilc_wlan_cfg_indicate_rx(uint8_t *frame, int size, wilc_cfg_rsp_t *r case 'L': #ifndef SWITCH_LOG_TERMINAL - PRINT_ER("Unexpected firmware log message received \n"); + PRINT_ER("Unexpected firmware log message received\n"); #else PRINT_D(FIRM_DBG, "\nFIRMWARE LOGS :\n<<\n%s\n>>\n", frame); break; @@ -572,18 +564,18 @@ static int wilc_wlan_cfg_indicate_rx(uint8_t *frame, int size, wilc_cfg_rsp_t *r #endif /*bug3819:*/ case 'S': - PRINT_INFO(RX_DBG, "Scan Notification Received \n"); + PRINT_INFO(RX_DBG, "Scan Notification Received\n"); host_int_ScanCompleteReceived(frame - 4, size + 4); break; #ifdef WILC_FULLY_HOSTING_AP case 'T': - PRINT_INFO(RX_DBG, "TBTT Notification Received \n"); + PRINT_INFO(RX_DBG, "TBTT Notification Received\n"); process_tbtt_isr(); break; case 'A': - PRINT_INFO(RX_DBG, "HOSTAPD ACK Notification Received \n"); + PRINT_INFO(RX_DBG, "HOSTAPD ACK Notification Received\n"); WILC_mgm_HOSTAPD_ACK(ptru32Frame, bStatus); break; #endif diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 8ed51e385..5cf74e4c4 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -20,7 +20,7 @@ /* #define USE_OLD_SPI_SW */ -#include "wilc_type.h" +#include "wilc_oswrapper.h" #include "linux_wlan_common.h" @@ -43,8 +43,8 @@ ********************************************/ #define HIF_SDIO (0) -#define HIF_SPI (1 << 0) -#define HIF_SDIO_GPIO_IRQ (1 << 2) +#define HIF_SPI BIT(0) +#define HIF_SDIO_GPIO_IRQ BIT(2) /******************************************** -- cgit v1.2.3-54-g00ecf