From c1ccdc6f183894b5cf4ba9737ece48199856be81 Mon Sep 17 00:00:00 2001 From: Luis R. Rodriguez Date: Mon, 28 Feb 2011 15:09:48 -0800 Subject: [PATCH 1/7] ath6kl: s|A_FREE|kfree|g for i in $(find ./drivers/staging/ath6kl/ -name \*.[ch]) ; do \ sed -r -i -e "s/A_FREE/kfree/g" $i; done Tested-by: Naveen Singh Signed-off-by: Luis R. Rodriguez --- drivers/staging/ath6kl/bmi/src/bmi.c | 8 +++--- .../ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c | 10 +++--- drivers/staging/ath6kl/htc2/AR6000/ar6k.c | 2 +- .../ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c | 2 +- drivers/staging/ath6kl/htc2/htc.c | 4 +- drivers/staging/ath6kl/miscdrv/ar3kconfig.c | 22 ++++++++-------- .../staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c | 22 ++++++++-------- .../staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c | 28 ++++++++++---------- .../staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h | 4 +- drivers/staging/ath6kl/os/linux/ar6000_drv.c | 10 +++--- drivers/staging/ath6kl/os/linux/ar6k_pal.c | 2 +- drivers/staging/ath6kl/os/linux/cfg80211.c | 4 +- drivers/staging/ath6kl/os/linux/hci_bridge.c | 4 +- .../staging/ath6kl/os/linux/include/osapi_linux.h | 2 - drivers/staging/ath6kl/os/linux/ioctl.c | 8 +++--- drivers/staging/ath6kl/reorder/rcv_aggr.c | 6 ++-- drivers/staging/ath6kl/wlan/src/wlan_node.c | 6 ++-- drivers/staging/ath6kl/wmi/wmi.c | 4 +- 18 files changed, 73 insertions(+), 75 deletions(-) diff --git a/drivers/staging/ath6kl/bmi/src/bmi.c b/drivers/staging/ath6kl/bmi/src/bmi.c index 9268bf3..f1f085e 100644 --- a/drivers/staging/ath6kl/bmi/src/bmi.c +++ b/drivers/staging/ath6kl/bmi/src/bmi.c @@ -95,12 +95,12 @@ void BMICleanup(void) { if (pBMICmdCredits) { - A_FREE(pBMICmdCredits); + kfree(pBMICmdCredits); pBMICmdCredits = NULL; } if (pBMICmdBuf) { - A_FREE(pBMICmdBuf); + kfree(pBMICmdBuf); pBMICmdBuf = NULL; } } @@ -127,12 +127,12 @@ BMIDone(struct hif_device *device) } if (pBMICmdCredits) { - A_FREE(pBMICmdCredits); + kfree(pBMICmdCredits); pBMICmdCredits = NULL; } if (pBMICmdBuf) { - A_FREE(pBMICmdBuf); + kfree(pBMICmdBuf); pBMICmdBuf = NULL; } diff --git a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c index a1fdcc1..7516d91 100644 --- a/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c +++ b/drivers/staging/ath6kl/hif/sdio/linux_sdio/src/hif_scatter.c @@ -309,7 +309,7 @@ int SetupHIFScatterSupport(struct hif_device *device, struct hif_device_scatter_ (MAX_SCATTER_ENTRIES_PER_REQ - 1) * (sizeof(struct hif_scatter_item))); if (NULL == pReqPriv->pHifScatterReq) { - A_FREE(pReqPriv); + kfree(pReqPriv); break; } /* just zero the main part of the scatter request */ @@ -319,8 +319,8 @@ int SetupHIFScatterSupport(struct hif_device *device, struct hif_device_scatter_ /* allocate a bus request for this scatter request */ busrequest = hifAllocateBusRequest(device); if (NULL == busrequest) { - A_FREE(pReqPriv->pHifScatterReq); - A_FREE(pReqPriv); + kfree(pReqPriv->pHifScatterReq); + kfree(pReqPriv); break; } /* assign the scatter request to this bus request */ @@ -382,11 +382,11 @@ void CleanupHIFScatterResources(struct hif_device *device) } if (pReqPriv->pHifScatterReq != NULL) { - A_FREE(pReqPriv->pHifScatterReq); + kfree(pReqPriv->pHifScatterReq); pReqPriv->pHifScatterReq = NULL; } - A_FREE(pReqPriv); + kfree(pReqPriv); } } diff --git a/drivers/staging/ath6kl/htc2/AR6000/ar6k.c b/drivers/staging/ath6kl/htc2/AR6000/ar6k.c index eeddf60..05f6d15 100644 --- a/drivers/staging/ath6kl/htc2/AR6000/ar6k.c +++ b/drivers/staging/ath6kl/htc2/AR6000/ar6k.c @@ -743,7 +743,7 @@ static void DevCleanupVirtualScatterSupport(struct ar6k_device *pDev) if (NULL == pReq) { break; } - A_FREE(pReq); + kfree(pReq); } } diff --git a/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c b/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c index c6488e0..68dd816 100644 --- a/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c +++ b/drivers/staging/ath6kl/htc2/AR6000/ar6k_gmbox_hciuart.c @@ -108,7 +108,7 @@ static void HCIUartCleanup(struct gmbox_proto_hci_uart *pProtocol) A_MUTEX_DELETE(&pProtocol->HCIRxLock); A_MUTEX_DELETE(&pProtocol->HCITxLock); - A_FREE(pProtocol); + kfree(pProtocol); } static int InitTxCreditState(struct gmbox_proto_hci_uart *pProt) diff --git a/drivers/staging/ath6kl/htc2/htc.c b/drivers/staging/ath6kl/htc2/htc.c index d40bb14..f308655 100644 --- a/drivers/staging/ath6kl/htc2/htc.c +++ b/drivers/staging/ath6kl/htc2/htc.c @@ -70,7 +70,7 @@ static void HTCCleanup(struct htc_target *target) for (i = 0;i < NUM_CONTROL_BUFFERS;i++) { if (target->HTCControlBuffers[i].Buffer) { - A_FREE(target->HTCControlBuffers[i].Buffer); + kfree(target->HTCControlBuffers[i].Buffer); } } @@ -86,7 +86,7 @@ static void HTCCleanup(struct htc_target *target) A_MUTEX_DELETE(&target->HTCTxLock); } /* free our instance */ - A_FREE(target); + kfree(target); } /* registered target arrival callback from the HIF layer */ diff --git a/drivers/staging/ath6kl/miscdrv/ar3kconfig.c b/drivers/staging/ath6kl/miscdrv/ar3kconfig.c index 4f18f43..5125edc 100644 --- a/drivers/staging/ath6kl/miscdrv/ar3kconfig.c +++ b/drivers/staging/ath6kl/miscdrv/ar3kconfig.c @@ -78,7 +78,7 @@ static int SendHCICommand(struct ar3k_config_info *pConfig, } while (false); if (pPacket != NULL) { - A_FREE(pPacket); + kfree(pPacket); } return status; @@ -116,7 +116,7 @@ static int RecvHCIEvent(struct ar3k_config_info *pConfig, } while (false); if (pRecvPacket != NULL) { - A_FREE(pRecvPacket); + kfree(pRecvPacket); } return status; @@ -203,7 +203,7 @@ int SendHCICommandWaitCommandComplete(struct ar3k_config_info *pConfig, } while (false); if (pBuffer != NULL) { - A_FREE(pBuffer); + kfree(pBuffer); } return status; @@ -268,7 +268,7 @@ static int AR3KConfigureHCIBaud(struct ar3k_config_info *pConfig) } while (false); if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); + kfree(pBufferToFree); } return status; @@ -304,7 +304,7 @@ static int AR3KExitMinBoot(struct ar3k_config_info *pConfig) } if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); + kfree(pBufferToFree); } return status; @@ -328,7 +328,7 @@ static int AR3KConfigureSendHCIReset(struct ar3k_config_info *pConfig) } if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); + kfree(pBufferToFree); } return status; @@ -382,7 +382,7 @@ static int AR3KEnableTLPM(struct ar3k_config_info *pConfig) &pEvent, &pBufferToFree); if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); + kfree(pBufferToFree); } if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HostWakeup Config Failed! \n")); @@ -397,7 +397,7 @@ static int AR3KEnableTLPM(struct ar3k_config_info *pConfig) &pEvent, &pBufferToFree); if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); + kfree(pBufferToFree); } if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Target Wakeup Config Failed! \n")); @@ -412,7 +412,7 @@ static int AR3KEnableTLPM(struct ar3k_config_info *pConfig) &pEvent, &pBufferToFree); if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); + kfree(pBufferToFree); } if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HostWakeup Enable Failed! \n")); @@ -427,7 +427,7 @@ static int AR3KEnableTLPM(struct ar3k_config_info *pConfig) &pEvent, &pBufferToFree); if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); + kfree(pBufferToFree); } if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Target Wakeup Enable Failed! \n")); @@ -442,7 +442,7 @@ static int AR3KEnableTLPM(struct ar3k_config_info *pConfig) &pEvent, &pBufferToFree); if (pBufferToFree != NULL) { - A_FREE(pBufferToFree); + kfree(pBufferToFree); } if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Sleep Enable Failed! \n")); diff --git a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c index 8393efe..282ceac 100644 --- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c +++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c @@ -222,7 +222,7 @@ int PSSendOps(void *arg) A_RELEASE_FIRMWARE(firmware); /* Parse the PS buffer to a global variable */ status = AthDoParsePS(buffer,len); - A_FREE(buffer); + kfree(buffer); } else { A_RELEASE_FIRMWARE(firmware); } @@ -256,7 +256,7 @@ int PSSendOps(void *arg) A_RELEASE_FIRMWARE(firmware); /* parse and store the Patch file contents to a global variables */ status = AthDoParsePatch(buffer,len); - A_FREE(buffer); + kfree(buffer); } else { A_RELEASE_FIRMWARE(firmware); } @@ -283,7 +283,7 @@ int PSSendOps(void *arg) &bufferToFree) == 0) { if(ReadPSEvent(event) == 0) { /* Exit if the status is success */ if(bufferToFree != NULL) { - A_FREE(bufferToFree); + kfree(bufferToFree); } #ifndef HCI_TRANSPORT_SDIO @@ -295,7 +295,7 @@ int PSSendOps(void *arg) goto complete; } if(bufferToFree != NULL) { - A_FREE(bufferToFree); + kfree(bufferToFree); } } else { status = 0; @@ -312,13 +312,13 @@ int PSSendOps(void *arg) &bufferToFree) == 0) { if(ReadPSEvent(event) != 0) { /* Exit if the status is success */ if(bufferToFree != NULL) { - A_FREE(bufferToFree); + kfree(bufferToFree); } status = 1; goto complete; } if(bufferToFree != NULL) { - A_FREE(bufferToFree); + kfree(bufferToFree); } } else { status = 0; @@ -376,10 +376,10 @@ complete: AthFreeCommandList(&HciCmdList,numCmds); } if(path) { - A_FREE(path); + kfree(path); } if(config_path) { - A_FREE(config_path); + kfree(config_path); } return status; } @@ -511,7 +511,7 @@ int write_bdaddr(struct ar3k_config_info *pConfig,u8 *bdaddr,int type) } if(bufferToFree != NULL) { - A_FREE(bufferToFree); + kfree(bufferToFree); } return result; @@ -527,7 +527,7 @@ int ReadVersionInfo(struct ar3k_config_info *pConfig) } if(bufferToFree != NULL) { - A_FREE(bufferToFree); + kfree(bufferToFree); } return result; } @@ -564,7 +564,7 @@ int getDeviceType(struct ar3k_config_info *pConfig, u32 *code) } if(bufferToFree != NULL) { - A_FREE(bufferToFree); + kfree(bufferToFree); } return result; } diff --git a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c index 94a0939..c01c0cb 100644 --- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c +++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c @@ -362,7 +362,7 @@ int AthParseFilesUnified(u8 *srcbuffer,u32 srclen, int FileFormat) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("error\n")); if(Buffer != NULL) { - A_FREE(Buffer); + kfree(Buffer); } return A_ERROR; } @@ -401,7 +401,7 @@ int AthParseFilesUnified(u8 *srcbuffer,u32 srclen, int FileFormat) if(uGetInputDataFormat(pCharLine, &stPS_DataFormat)) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("uGetInputDataFormat fail\n")); if(Buffer != NULL) { - A_FREE(Buffer); + kfree(Buffer); } return A_ERROR; } @@ -422,7 +422,7 @@ int AthParseFilesUnified(u8 *srcbuffer,u32 srclen, int FileFormat) if(uGetInputDataFormat(pCharLine, &stPS_DataFormat)) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("uGetInputDataFormat fail \n")); if(Buffer != NULL) { - A_FREE(Buffer); + kfree(Buffer); } return A_ERROR; } @@ -433,7 +433,7 @@ int AthParseFilesUnified(u8 *srcbuffer,u32 srclen, int FileFormat) if (ByteCount > LINE_SIZE_MAX/2) { if(Buffer != NULL) { - A_FREE(Buffer); + kfree(Buffer); } return A_ERROR; } @@ -449,7 +449,7 @@ int AthParseFilesUnified(u8 *srcbuffer,u32 srclen, int FileFormat) if(uGetInputDataFormat(pCharLine,&stPS_DataFormat)) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("uGetInputDataFormat Fail\n")); if(Buffer != NULL) { - A_FREE(Buffer); + kfree(Buffer); } return A_ERROR; } @@ -510,7 +510,7 @@ int AthParseFilesUnified(u8 *srcbuffer,u32 srclen, int FileFormat) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("\n Buffer over flow PS File too big!!!")); if(Buffer != NULL) { - A_FREE(Buffer); + kfree(Buffer); } return A_ERROR; //Sleep (3000); @@ -524,7 +524,7 @@ int AthParseFilesUnified(u8 *srcbuffer,u32 srclen, int FileFormat) default: { if(Buffer != NULL) { - A_FREE(Buffer); + kfree(Buffer); } return A_ERROR; } @@ -541,13 +541,13 @@ int AthParseFilesUnified(u8 *srcbuffer,u32 srclen, int FileFormat) { if(Buffer != NULL) { - A_FREE(Buffer); + kfree(Buffer); } return A_ERROR; } if(Buffer != NULL) { - A_FREE(Buffer); + kfree(Buffer); } return 0; @@ -609,7 +609,7 @@ int AthDoParsePatch(u8 *patchbuffer, u32 patchlen) /* Handle case when the number of patch buffer is more than the 20K */ if(MAX_NUM_PATCH_ENTRY == Patch_Count) { for(i = 0; i < Patch_Count; i++) { - A_FREE(RamPatch[i].Data); + kfree(RamPatch[i].Data); } return A_ERROR; } @@ -812,13 +812,13 @@ int AthCreateCommandList(struct ps_cmd_packet **HciPacketList, u32 *numPackets) for(count = 0; count < Patch_Count; count++) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Freeing Patch Buffer %d \r\n",count)); - A_FREE(RamPatch[Patch_Count].Data); + kfree(RamPatch[Patch_Count].Data); } for(count = 0; count < Tag_Count; count++) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Freeing PS Buffer %d \r\n",count)); - A_FREE(PsTagEntry[count].TagData); + kfree(PsTagEntry[count].TagData); } /* @@ -962,8 +962,8 @@ int AthFreeCommandList(struct ps_cmd_packet **HciPacketList, u32 numPackets) return A_ERROR; } for(i = 0; i < numPackets;i++) { - A_FREE((*HciPacketList)[i].Hcipacket); + kfree((*HciPacketList)[i].Hcipacket); } - A_FREE(*HciPacketList); + kfree(*HciPacketList); return 0; } diff --git a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h index 9378efc..d462aed 100644 --- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h +++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h @@ -62,8 +62,8 @@ #endif /* A_MALLOC */ -#ifndef A_FREE -#define A_FREE(addr) kfree((addr)) +#ifndef kfree +#define kfree(addr) kfree((addr)) #endif /* A_MALLOC */ #endif /* HCI_TRANSPORT_UART */ diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c index 27cb02d..6ca147f 100644 --- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c +++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c @@ -982,7 +982,7 @@ ar6000_softmac_update(struct ar6_softc *ar, u8 *eeprom_data, size_t size) } source = "softmac file"; } - A_FREE(macbuf); + kfree(macbuf); } A_RELEASE_FIRMWARE(softmac_entry); } @@ -2134,7 +2134,7 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister) #ifdef HTC_RAW_INTERFACE if (ar->arRawHtc) { - A_FREE(ar->arRawHtc); + kfree(ar->arRawHtc); ar->arRawHtc = NULL; } #endif @@ -4883,7 +4883,7 @@ ar6000_neighborReport_event(struct ar6_softc *ar, int numAps, WMI_NEIGHBOR_INFO memcpy(pmkcand->bssid.sa_data, info->bssid, ATH_MAC_LEN); wrqu.data.length = sizeof(struct iw_pmkid_cand); wireless_send_event(ar->arNetDev, IWEVPMKIDCAND, &wrqu, (char *)pmkcand); - A_FREE(pmkcand); + kfree(pmkcand); #else /* WIRELESS_EXT >= 18 */ snprintf(buf, sizeof(buf), "%s%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x", tag, @@ -5603,7 +5603,7 @@ void ar6000_send_event_to_app(struct ar6_softc *ar, u16 eventId, A_MEMZERO(&wrqu, sizeof(wrqu)); wrqu.data.length = size; wireless_send_event(ar->arNetDev, IWEVCUSTOM, &wrqu, buf); - A_FREE(buf); + kfree(buf); #endif @@ -5648,7 +5648,7 @@ void ar6000_send_generic_event_to_app(struct ar6_softc *ar, u16 eventId, wrqu.data.length = size; wireless_send_event(ar->arNetDev, IWEVGENIE, &wrqu, buf); - A_FREE(buf); + kfree(buf); #endif /* (WIRELESS_EXT >= 18) */ diff --git a/drivers/staging/ath6kl/os/linux/ar6k_pal.c b/drivers/staging/ath6kl/os/linux/ar6k_pal.c index 1f7179a..7e6279f 100644 --- a/drivers/staging/ath6kl/os/linux/ar6k_pal.c +++ b/drivers/staging/ath6kl/os/linux/ar6k_pal.c @@ -318,7 +318,7 @@ void ar6k_cleanup_hci_pal(void *ar_p) if (pHciPalInfo != NULL) { bt_cleanup_hci_pal(pHciPalInfo); - A_FREE(pHciPalInfo); + kfree(pHciPalInfo); ar->hcipal_info = NULL; } } diff --git a/drivers/staging/ath6kl/os/linux/cfg80211.c b/drivers/staging/ath6kl/os/linux/cfg80211.c index bcca394..1f799c1 100644 --- a/drivers/staging/ath6kl/os/linux/cfg80211.c +++ b/drivers/staging/ath6kl/os/linux/cfg80211.c @@ -552,7 +552,7 @@ ar6k_cfg80211_connect_event(struct ar6_softc *ar, u16 channel, ibss_channel, mgmt, le16_to_cpu(size), signal, GFP_KERNEL); - A_FREE(ieeemgmtbuf); + kfree(ieeemgmtbuf); cfg80211_put_bss(bss); } @@ -729,7 +729,7 @@ ar6k_cfg80211_scan_node(void *arg, bss_t *ni) le16_to_cpu(size), signal, GFP_KERNEL); - A_FREE (ieeemgmtbuf); + kfree (ieeemgmtbuf); } static int diff --git a/drivers/staging/ath6kl/os/linux/hci_bridge.c b/drivers/staging/ath6kl/os/linux/hci_bridge.c index 39e5798..ac08bcb 100644 --- a/drivers/staging/ath6kl/os/linux/hci_bridge.c +++ b/drivers/staging/ath6kl/os/linux/hci_bridge.c @@ -582,11 +582,11 @@ void ar6000_cleanup_hci(struct ar6_softc *ar) } if (pHcidevInfo->pHTCStructAlloc != NULL) { - A_FREE(pHcidevInfo->pHTCStructAlloc); + kfree(pHcidevInfo->pHTCStructAlloc); pHcidevInfo->pHTCStructAlloc = NULL; } - A_FREE(pHcidevInfo); + kfree(pHcidevInfo); #ifndef EXPORT_HCI_BRIDGE_INTERFACE ar->hcidev_info = NULL; #endif diff --git a/drivers/staging/ath6kl/os/linux/include/osapi_linux.h b/drivers/staging/ath6kl/os/linux/include/osapi_linux.h index 53b500c..ff9d06e 100644 --- a/drivers/staging/ath6kl/os/linux/include/osapi_linux.h +++ b/drivers/staging/ath6kl/os/linux/include/osapi_linux.h @@ -79,7 +79,6 @@ #define A_MEMZERO(addr, len) memset(addr, 0, len) #define A_MALLOC(size) kmalloc((size), GFP_KERNEL) #define A_MALLOC_NOWAIT(size) kmalloc((size), GFP_ATOMIC) -#define A_FREE(addr) kfree(addr) #if defined(ANDROID_ENV) && defined(CONFIG_ANDROID_LOGGER) extern unsigned int enablelogcat; @@ -364,7 +363,6 @@ static inline void *A_ALIGN_TO_CACHE_LINE(void *ptr) { #define A_MEMZERO(addr, len) memset((addr), 0, (len)) #define A_MALLOC(size) malloc(size) -#define A_FREE(addr) free(addr) #ifdef ANDROID #ifndef err diff --git a/drivers/staging/ath6kl/os/linux/ioctl.c b/drivers/staging/ath6kl/os/linux/ioctl.c index 0daa201..159a64c 100644 --- a/drivers/staging/ath6kl/os/linux/ioctl.c +++ b/drivers/staging/ath6kl/os/linux/ioctl.c @@ -2132,7 +2132,7 @@ int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) if (copy_to_user(rq->ifr_data, buffer, length)) { ret = -EFAULT; } - A_FREE(buffer); + kfree(buffer); } else { ret = -ENOMEM; } @@ -2155,7 +2155,7 @@ int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) } else { ret = BMIWriteMemory(hifDevice, address, buffer, length); } - A_FREE(buffer); + kfree(buffer); } else { ret = -ENOMEM; } @@ -2308,7 +2308,7 @@ int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) } else { ret = BMILZData(hifDevice, buffer, length); } - A_FREE(buffer); + kfree(buffer); } else { ret = -ENOMEM; } @@ -3822,7 +3822,7 @@ int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ret = BMIrompatchDeactivate(hifDevice, rompatch_count, (u32 *)buffer); } } - A_FREE(buffer); + kfree(buffer); } else { ret = -ENOMEM; } diff --git a/drivers/staging/ath6kl/reorder/rcv_aggr.c b/drivers/staging/ath6kl/reorder/rcv_aggr.c index 094b227..eec1dc6 100644 --- a/drivers/staging/ath6kl/reorder/rcv_aggr.c +++ b/drivers/staging/ath6kl/reorder/rcv_aggr.c @@ -123,7 +123,7 @@ aggr_delete_tid_state(struct aggr_info *p_aggr, u8 tid) rxtid->hold_q_sz = 0; if(rxtid->hold_q) { - A_FREE(rxtid->hold_q); + kfree(rxtid->hold_q); rxtid->hold_q = NULL; } @@ -154,7 +154,7 @@ aggr_module_destroy(void *cntxt) A_NETBUF_FREE(rxtid->hold_q[k].osbuf); } } - A_FREE(rxtid->hold_q); + kfree(rxtid->hold_q); } /* Free the dispatch q contents*/ while(A_NETBUF_QUEUE_SIZE(&rxtid->q)) { @@ -168,7 +168,7 @@ aggr_module_destroy(void *cntxt) while(A_NETBUF_QUEUE_SIZE(&p_aggr->freeQ)) { A_NETBUF_FREE(A_NETBUF_DEQUEUE(&p_aggr->freeQ)); } - A_FREE(p_aggr); + kfree(p_aggr); } A_PRINTF("out aggr_module_destroy\n"); } diff --git a/drivers/staging/ath6kl/wlan/src/wlan_node.c b/drivers/staging/ath6kl/wlan/src/wlan_node.c index 1a3ac7d..b166dd4 100644 --- a/drivers/staging/ath6kl/wlan/src/wlan_node.c +++ b/drivers/staging/ath6kl/wlan/src/wlan_node.c @@ -72,7 +72,7 @@ wlan_node_alloc(struct ieee80211_node_table *nt, int wh_size) { ni->ni_buf = A_MALLOC_NOWAIT(wh_size); if (ni->ni_buf == NULL) { - A_FREE(ni); + kfree(ni); ni = NULL; return ni; } @@ -104,9 +104,9 @@ void wlan_node_free(bss_t *ni) { if (ni->ni_buf != NULL) { - A_FREE(ni->ni_buf); + kfree(ni->ni_buf); } - A_FREE(ni); + kfree(ni); } void diff --git a/drivers/staging/ath6kl/wmi/wmi.c b/drivers/staging/ath6kl/wmi/wmi.c index 0ddaee2..eccccee 100644 --- a/drivers/staging/ath6kl/wmi/wmi.c +++ b/drivers/staging/ath6kl/wmi/wmi.c @@ -381,7 +381,7 @@ wmi_shutdown(struct wmi_t *wmip) A_MUTEX_DELETE(&wmip->wmi_lock); #endif } - A_FREE(wmip); + kfree(wmip); } } @@ -5877,7 +5877,7 @@ wmi_scan_indication (struct wmi_t *wmip) ar6000_scan_indication (wmip->wmi_devt, pAr6kScanIndEvent, size); - A_FREE(pAr6kScanIndEvent); + kfree(pAr6kScanIndEvent); } #endif -- 1.7.4.15.g7811d From 40d73343f7d2d3a716bdfd9d9ab8a9d06f40c091 Mon Sep 17 00:00:00 2001 From: Luis R. Rodriguez Date: Thu, 24 Mar 2011 14:06:28 -0700 Subject: [PATCH 2/7] ath6kl: remove BMIENABLE_SET define Leave the code in place as this is always defined statically. Signed-off-by: Luis R. Rodriguez --- drivers/staging/ath6kl/Makefile | 1 - drivers/staging/ath6kl/os/linux/ar6000_drv.c | 66 ++++++++------------ .../staging/ath6kl/os/linux/include/ar6000_drv.h | 6 -- 3 files changed, 25 insertions(+), 48 deletions(-) diff --git a/drivers/staging/ath6kl/Makefile b/drivers/staging/ath6kl/Makefile index ab68078..50c1db0 100644 --- a/drivers/staging/ath6kl/Makefile +++ b/drivers/staging/ath6kl/Makefile @@ -126,7 +126,6 @@ ccflags-y += -DWAPI_ENABLE ccflags-y += -DCHECKSUM_OFFLOAD ccflags-y += -DWLAN_HEADERS ccflags-y += -DINIT_MODE_DRV_ENABLED -ccflags-y += -DBMIENABLE_SET obj-$(CONFIG_ATH6K_LEGACY) := ath6kl.o ath6kl-y += htc2/AR6000/ar6k.o diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c index 6ca147f..6248c6d 100644 --- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c +++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c @@ -118,7 +118,6 @@ struct hci_transport_callbacks ar6kHciTransCallbacks = { NULL }; #endif unsigned int processDot11Hdr = 0; -int bmienable = BMIENABLE_DEFAULT; char ifname[IFNAMSIZ] = {0,}; @@ -164,7 +163,6 @@ unsigned int eppingtest=0; module_param_string(ifname, ifname, sizeof(ifname), 0644); module_param(wlaninitmode, int, 0644); -module_param(bmienable, int, 0644); module_param(bypasswmi, bool, 0644); module_param(debuglevel, uint, 0644); module_param(tspecCompliance, int, 0644); @@ -1719,9 +1717,7 @@ ar6000_avail_ev(void *context, void *hif_handle) BMIInit(); - if (bmienable) { - ar6000_sysfs_bmi_init(ar); - } + ar6000_sysfs_bmi_init(ar); { struct bmi_target_info targ_info; @@ -1791,38 +1787,31 @@ ar6000_avail_ev(void *context, void *hif_handle) /* when the module is unloaded. */ ar6000_devices[device_index] = dev; - /* Don't install the init function if BMI is requested */ - if (!bmienable) { - ar6000_netdev_ops.ndo_init = ar6000_init; - } else { - AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode)); - if ((wlaninitmode == WLAN_INIT_MODE_UDEV) || - (wlaninitmode == WLAN_INIT_MODE_DRV)) - { - int status = 0; - do { - if ((status = ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != 0) - { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n")); - break; - } + AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode)); + if ((wlaninitmode == WLAN_INIT_MODE_UDEV) || + (wlaninitmode == WLAN_INIT_MODE_DRV)) { + int status = 0; + do { + if ((status = ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != 0) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n")); + break; + } #ifdef HTC_RAW_INTERFACE - if (!eppingtest && bypasswmi) { - break; /* Don't call ar6000_init for ART */ - } + if (!eppingtest && bypasswmi) { + break; /* Don't call ar6000_init for ART */ + } #endif - rtnl_lock(); - status = (ar6000_init(dev)==0) ? 0 : A_ERROR; - rtnl_unlock(); - if (status) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n")); - } - } while (false); - + rtnl_lock(); + status = (ar6000_init(dev)==0) ? 0 : A_ERROR; + rtnl_unlock(); if (status) { - init_status = status; - goto avail_ev_failed; + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n")); } + } while (false); + + if (status) { + init_status = status; + goto avail_ev_failed; } } @@ -1843,11 +1832,8 @@ ar6000_avail_ev(void *context, void *hif_handle) (unsigned long)ar)); avail_ev_failed : - if (init_status) { - if (bmienable) { - ar6000_sysfs_bmi_deinit(ar); - } - } + if (init_status) + ar6000_sysfs_bmi_deinit(ar); return init_status; } @@ -2120,9 +2106,7 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister) /* cleanup any allocated AMSDU buffers */ ar6000_cleanup_amsdu_rxbufs(ar); - if (bmienable) { - ar6000_sysfs_bmi_deinit(ar); - } + ar6000_sysfs_bmi_deinit(ar); /* Cleanup BMI */ BMICleanup(); diff --git a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h index 89fd80a..dc27860 100644 --- a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h +++ b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h @@ -227,12 +227,6 @@ typedef enum _AR6K_BIN_FILE { #define SETUPBTDEV_DEFAULT 0 #endif /* SETUPBTDEV_ENABLED */ -#ifdef BMIENABLE_SET -#define BMIENABLE_DEFAULT 1 -#else -#define BMIENABLE_DEFAULT 0 -#endif /* BMIENABLE_SET */ - #ifdef ENABLEUARTPRINT_SET #define ENABLEUARTPRINT_DEFAULT 1 #else -- 1.7.4.15.g7811d From 6614ccf89e8565591d2a876b7b23b7ddd494b8b5 Mon Sep 17 00:00:00 2001 From: Luis R. Rodriguez Date: Thu, 24 Mar 2011 16:09:56 -0700 Subject: [PATCH 3/7] ath6kl: propagate error values on ar6000_avail_ev() When something fails we set up some generic error values, instead keep the values from the callers and make sure to pass them on. Cc: Naveen Singh Signed-off-by: Luis R. Rodriguez --- drivers/staging/ath6kl/os/linux/ar6000_drv.c | 51 ++++++++++++-------------- 1 files changed, 24 insertions(+), 27 deletions(-) diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c index 6248c6d..846eea7 100644 --- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c +++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c @@ -1601,7 +1601,7 @@ ar6000_avail_ev(void *context, void *hif_handle) #ifdef ATH6K_CONFIG_CFG80211 struct wireless_dev *wdev; #endif /* ATH6K_CONFIG_CFG80211 */ - int init_status = 0; + int r = 0; struct hif_device_os_device_info osDevInfo; memset(&osDevInfo, 0, sizeof(osDevInfo)); @@ -1722,28 +1722,25 @@ ar6000_avail_ev(void *context, void *hif_handle) { struct bmi_target_info targ_info; - if (BMIGetTargetInfo(ar->arHifDevice, &targ_info) != 0) { - init_status = A_ERROR; + r = BMIGetTargetInfo(ar->arHifDevice, &targ_info); + if (r) goto avail_ev_failed; - } ar->arVersion.target_ver = targ_info.target_ver; ar->arTargetType = targ_info.target_type; - /* do any target-specific preparation that can be done through BMI */ - if (ar6000_prepare_target(ar->arHifDevice, + /* do any target-specific preparation that can be done through BMI */ + r = ar6000_prepare_target(ar->arHifDevice, targ_info.target_type, - targ_info.target_ver) != 0) { - init_status = A_ERROR; + targ_info.target_ver); + if (r) goto avail_ev_failed; - } } - if (ar6000_configure_target(ar) != 0) { - init_status = A_ERROR; + r = ar6000_configure_target(ar); + if (r) goto avail_ev_failed; - } A_MEMZERO(&htcInfo,sizeof(htcInfo)); htcInfo.pContext = ar; @@ -1751,8 +1748,8 @@ ar6000_avail_ev(void *context, void *hif_handle) ar->arHtcTarget = HTCCreate(ar->arHifDevice,&htcInfo); - if (ar->arHtcTarget == NULL) { - init_status = A_ERROR; + if (!ar->arHtcTarget) { + r = -ENOMEM; goto avail_ev_failed; } @@ -1771,9 +1768,10 @@ ar6000_avail_ev(void *context, void *hif_handle) #endif #ifdef ATH_AR6K_11N_SUPPORT - if((ar->aggr_cntxt = aggr_init(ar6000_alloc_netbufs)) == NULL) { + ar->aggr_cntxt = aggr_init(ar6000_alloc_netbufs); + if (!ar->aggr_cntxt) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s() Failed to initialize aggr.\n", __func__)); - init_status = A_ERROR; + r = -ENOMEM; goto avail_ev_failed; } @@ -1790,9 +1788,9 @@ ar6000_avail_ev(void *context, void *hif_handle) AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode)); if ((wlaninitmode == WLAN_INIT_MODE_UDEV) || (wlaninitmode == WLAN_INIT_MODE_DRV)) { - int status = 0; do { - if ((status = ar6000_sysfs_bmi_get_config(ar, wlaninitmode)) != 0) { + r = ar6000_sysfs_bmi_get_config(ar, wlaninitmode); + if (r) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n")); break; } @@ -1802,24 +1800,23 @@ ar6000_avail_ev(void *context, void *hif_handle) } #endif rtnl_lock(); - status = (ar6000_init(dev)==0) ? 0 : A_ERROR; + r = ar6000_init(dev); rtnl_unlock(); - if (status) { + if (r) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n")); } } while (false); - if (status) { - init_status = status; + if (r) goto avail_ev_failed; - } } /* This runs the init function if registered */ - if (register_netdev(dev)) { + r = register_netdev(dev); + if (r) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: register_netdev failed\n")); ar6000_destroy(dev, 0); - return A_ERROR; + return r; } is_netdev_registered = 1; @@ -1832,10 +1829,10 @@ ar6000_avail_ev(void *context, void *hif_handle) (unsigned long)ar)); avail_ev_failed : - if (init_status) + if (r) ar6000_sysfs_bmi_deinit(ar); - return init_status; + return r; } static void ar6000_target_failure(void *Instance, int Status) -- 1.7.4.15.g7811d From 9a3b7c9f27aa6109ce00d7bab8cbe4c22af5d196 Mon Sep 17 00:00:00 2001 From: Luis R. Rodriguez Date: Thu, 24 Mar 2011 16:45:01 -0700 Subject: [PATCH 4/7] ath6kl: replace do while loop with function helpers on ar6000_avail_ev() This unwraps the do while loops in favor for function helpers. Cc: Naveen Singh Signed-off-by: Luis R. Rodriguez --- drivers/staging/ath6kl/os/linux/ar6000_drv.c | 68 ++++++++++++++++++-------- 1 files changed, 48 insertions(+), 20 deletions(-) diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c index 846eea7..cbf2cb6 100644 --- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c +++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c @@ -1586,6 +1586,52 @@ init_netdev(struct net_device *dev, char *name) return; } +static int __ath6kl_init_netdev(struct net_device *dev) +{ + int r; + + rtnl_lock(); + r = ar6000_init(dev); + rtnl_unlock(); + + if (r) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n")); + return r; + } + + return 0; +} + +#ifdef HTC_RAW_INTERFACE +static int ath6kl_init_netdev_wmi(struct net_device *dev) +{ + if (!eppingtest && bypasswmi) + return 0; + + return __ath6kl_init_netdev(dev); +} +#else +static int ath6kl_init_netdev_wmi(struct net_device *dev) +{ + return __ath6kl_init_netdev(dev); +} +#endif + +static int ath6kl_init_netdev(struct ar6_softc *ar) +{ + int r; + + r = ar6000_sysfs_bmi_get_config(ar, wlaninitmode); + if (r) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, + ("ar6000_avail: " + "ar6000_sysfs_bmi_get_config failed\n")); + return r; + } + + return ath6kl_init_netdev_wmi(ar->arNetDev); +} + /* * HTC Event handlers */ @@ -1788,26 +1834,8 @@ ar6000_avail_ev(void *context, void *hif_handle) AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode)); if ((wlaninitmode == WLAN_INIT_MODE_UDEV) || (wlaninitmode == WLAN_INIT_MODE_DRV)) { - do { - r = ar6000_sysfs_bmi_get_config(ar, wlaninitmode); - if (r) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n")); - break; - } -#ifdef HTC_RAW_INTERFACE - if (!eppingtest && bypasswmi) { - break; /* Don't call ar6000_init for ART */ - } -#endif - rtnl_lock(); - r = ar6000_init(dev); - rtnl_unlock(); - if (r) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n")); - } - } while (false); - - if (r) + r = ath6kl_init_netdev(ar); + if (r) goto avail_ev_failed; } -- 1.7.4.15.g7811d From dfbaf69166d8a6ebcf839ab77b754f68a68db4f7 Mon Sep 17 00:00:00 2001 From: Luis R. Rodriguez Date: Thu, 24 Mar 2011 17:25:55 -0700 Subject: [PATCH 5/7] ath6kl: remove SET_MODULE_OWNER usage This is not required. Cc: Naveen Singh Signed-off-by: Luis R. Rodriguez --- drivers/staging/ath6kl/os/linux/ar6000_drv.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c index cbf2cb6..bb4dbb5 100644 --- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c +++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c @@ -1573,10 +1573,6 @@ init_netdev(struct net_device *dev, char *name) strcpy(dev->name, name); } -#ifdef SET_MODULE_OWNER - SET_MODULE_OWNER(dev); -#endif - #ifdef CONFIG_CHECKSUM_OFFLOAD if(csumOffload){ dev->features |= NETIF_F_IP_CSUM; /*advertise kernel capability to do TCP/UDP CSUM offload for IPV4*/ -- 1.7.4.15.g7811d From 5eb542c3c776a3fc36565adc543311ef8889aa18 Mon Sep 17 00:00:00 2001 From: Luis R. Rodriguez Date: Thu, 24 Mar 2011 17:32:49 -0700 Subject: [PATCH 6/7] ath6kl: move setting netdev for non-cf80211 case The check for SET_NETDEV_DEV is not required given that this is upstream. The setting of the SET_NETDEV_DEV with the osDevInfo.pOSDevice is redundant for the cfg80211 case as this was already being done, so just set the netdev device for the non-cfg80211 which was missing. Cc: Naveen Singh Signed-off-by: Luis R. Rodriguez --- drivers/staging/ath6kl/os/linux/ar6000_drv.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c index bb4dbb5..94b9132 100644 --- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c +++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c @@ -1685,6 +1685,7 @@ ar6000_avail_ev(void *context, void *hif_handle) } ether_setup(dev); ar_netif = ar6k_priv(dev); + SET_NETDEV_DEV(dev, osDevInfo.pOSDevice); #endif /* ATH6K_CONFIG_CFG80211 */ if (ar_netif == NULL) { @@ -1715,11 +1716,6 @@ ar6000_avail_ev(void *context, void *hif_handle) init_netdev(dev, ifname); -#ifdef SET_NETDEV_DEV - if (ar_netif) { - SET_NETDEV_DEV(dev, osDevInfo.pOSDevice); - } -#endif ar->arNetDev = dev; ar->arHifDevice = hif_handle; -- 1.7.4.15.g7811d From 68013f0b090fe1fafb80e53c06b0efee8d24c09f Mon Sep 17 00:00:00 2001 From: Luis R. Rodriguez Date: Thu, 17 Mar 2011 19:37:03 -0700 Subject: [PATCH 7/7] ath6kl: fix device name allocation / registration Use dev_alloc_name() and contend on the rtnl_lock() for device name allocation and registration. This should prevent any races against device name assignment and registration to the core. This should provide consistent udev events aligned with device registration to the core. This should cure this reported issue: http://code.google.com/p/chromium-os/issues/detail?id=13159 Cc: stable@kernel.org Cc: Naveen Singh Signed-off-by: Luis R. Rodriguez --- drivers/staging/ath6kl/os/linux/ar6000_drv.c | 35 ++++++++++++++------------ 1 files changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/staging/ath6kl/os/linux/ar6000_drv.c b/drivers/staging/ath6kl/os/linux/ar6000_drv.c index 94b9132..e99f739 100644 --- a/drivers/staging/ath6kl/os/linux/ar6000_drv.c +++ b/drivers/staging/ath6kl/os/linux/ar6000_drv.c @@ -1568,11 +1568,6 @@ init_netdev(struct net_device *dev, char *name) sizeof(WMI_DATA_HDR) + HTC_HEADER_LEN + WMI_MAX_TX_META_SZ + LINUX_HACK_FUDGE_FACTOR; } - if (name[0]) - { - strcpy(dev->name, name); - } - #ifdef CONFIG_CHECKSUM_OFFLOAD if(csumOffload){ dev->features |= NETIF_F_IP_CSUM; /*advertise kernel capability to do TCP/UDP CSUM offload for IPV4*/ @@ -1586,10 +1581,7 @@ static int __ath6kl_init_netdev(struct net_device *dev) { int r; - rtnl_lock(); r = ar6000_init(dev); - rtnl_unlock(); - if (r) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n")); return r; @@ -1678,9 +1670,11 @@ ar6000_avail_ev(void *context, void *hif_handle) } ar_netif = wdev_priv(wdev); #else + rtnl_lock(); dev = alloc_etherdev(sizeof(struct ar6_softc)); if (dev == NULL) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_available: can't alloc etherdev\n")); + rtnl_unlock(); return A_ERROR; } ether_setup(dev); @@ -1700,23 +1694,32 @@ ar6000_avail_ev(void *context, void *hif_handle) ar->wdev = wdev; wdev->iftype = NL80211_IFTYPE_STATION; + rtnl_lock(); dev = alloc_netdev_mq(0, "wlan%d", ether_setup, 1); if (!dev) { printk(KERN_CRIT "AR6K: no memory for network device instance\n"); + rtnl_unlock(); ar6k_cfg80211_deinit(ar); return A_ERROR; } - dev->ieee80211_ptr = wdev; + r = dev_alloc_name(dev, dev->name); + if (r < 0) { + rtnl_unlock(); + ar6k_cfg80211_deinit(ar); + return r; + } + SET_NETDEV_DEV(dev, wiphy_dev(wdev->wiphy)); + dev->ieee80211_ptr = wdev; wdev->netdev = dev; + ar->arNetworkType = INFRA_NETWORK; ar->smeState = SME_DISCONNECTED; #endif /* ATH6K_CONFIG_CFG80211 */ init_netdev(dev, ifname); - ar->arNetDev = dev; ar->arHifDevice = hif_handle; ar->arWlanState = WLAN_ENABLED; @@ -1832,9 +1835,10 @@ ar6000_avail_ev(void *context, void *hif_handle) } /* This runs the init function if registered */ - r = register_netdev(dev); + r = register_netdevice(dev); if (r) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: register_netdev failed\n")); + rtnl_unlock(); ar6000_destroy(dev, 0); return r; } @@ -1847,8 +1851,12 @@ ar6000_avail_ev(void *context, void *hif_handle) AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("ar6000_avail: name=%s hifdevice=0x%lx, dev=0x%lx (%d), ar=0x%lx\n", dev->name, (unsigned long)ar->arHifDevice, (unsigned long)dev, device_index, (unsigned long)ar)); + rtnl_unlock(); + return 0; avail_ev_failed : + rtnl_unlock(); + if (r) ar6000_sysfs_bmi_deinit(ar); @@ -2571,9 +2579,6 @@ int ar6000_init(struct net_device *dev) } } - dev_hold(dev); - rtnl_unlock(); - /* Do we need to finish the BMI phase */ if ((wlaninitmode == WLAN_INIT_MODE_USR || wlaninitmode == WLAN_INIT_MODE_DRV) && (BMIDone(ar->arHifDevice) != 0)) @@ -2836,8 +2841,6 @@ int ar6000_init(struct net_device *dev) } ar6000_init_done: - rtnl_lock(); - dev_put(dev); return ret; } -- 1.7.4.15.g7811d