diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-19 17:48:32 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-19 17:48:32 -0700 |
commit | fb20871a54961b82d35303b43452928186c1361d (patch) | |
tree | 1beeb39e45eda1c8b5893090904b583fceeb07ef /drivers/staging/rt2870/2870_main_dev.c | |
parent | bee89ab228e6f51c4ddd3481b9bd491859a8ee7b (diff) | |
parent | c7a5d70796379e3d51d0c652fbe1634b81d3bbd5 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (342 commits)
Staging: comedi: fix build errors
Staging: udlfb: update to version 0.2.3
Staging: udlfb: fix some sparse warnings.
Staging: udlfb: clean up checkpatch warnings in udlfb.c
Staging: udlfb: clean up checkpatch warnings in udlfb.h
Staging: udlfb: add udlfb driver to build
Staging: add udlfb driver
Staging: pata_rdc: remove pointless comments
Staging: pata_rdc: remove DRIVER macros
Staging: pata_rdc: remove dbgprintf macro
Staging: pata_rdc: remove broken flag
Staging: pata_rdc: fix build warnings
Staging: pata_rdc: use PCI_DEVICE
Staging: pata_rdc: remove function prototypes
Staging: pata_rdc: coding style fixes
Staging: pata_rdc: convert code to work in 2.6.29
Staging: pata_rdc: add driver to the build system
Staging: add pata_rdc driver
Staging: remove obsolete serqt_usb driver
Staging: serqt_usb2 add the driver to the build
...
Diffstat (limited to 'drivers/staging/rt2870/2870_main_dev.c')
-rw-r--r-- | drivers/staging/rt2870/2870_main_dev.c | 264 |
1 files changed, 92 insertions, 172 deletions
diff --git a/drivers/staging/rt2870/2870_main_dev.c b/drivers/staging/rt2870/2870_main_dev.c index 9d59e3167fe..dd01c64fbf6 100644 --- a/drivers/staging/rt2870/2870_main_dev.c +++ b/drivers/staging/rt2870/2870_main_dev.c @@ -46,17 +46,10 @@ // Otherwise post to forum in ralinktech's web site(www.ralinktech.com) and let all users help you. *** MODULE_AUTHOR("Paul Lin <paul_lin@ralinktech.com>"); MODULE_DESCRIPTION("RT2870 Wireless Lan Linux Driver"); -#ifdef CONFIG_STA_SUPPORT MODULE_LICENSE("GPL"); #ifdef MODULE_VERSION MODULE_VERSION(STA_DRIVER_VERSION); #endif -#endif // CONFIG_STA_SUPPORT // - -#ifdef MULTIPLE_CARD_SUPPORT -// record whether the card in the card list is used in the card file -extern UINT8 MC_CardUsed[]; -#endif // MULTIPLE_CARD_SUPPORT // /* Kernel thread and vars, which handles packets that are completed. Only * packets that have a "complete" function are sent here. This way, the @@ -77,26 +70,6 @@ MODULE_DEVICE_TABLE(usb, rtusb_usb_id); #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - -/**************************************************************************/ -/**************************************************************************/ -//tested for kernel 2.4 series -/**************************************************************************/ -/**************************************************************************/ -static void *rtusb_probe(struct usb_device *dev, UINT interface, - const struct usb_device_id *id_table); -static void rtusb_disconnect(struct usb_device *dev, void *ptr); - -struct usb_driver rtusb_driver = { - name:"rt2870", - probe:rtusb_probe, - disconnect:rtusb_disconnect, - id_table:rtusb_usb_id, - }; - -#else - #ifdef CONFIG_PM static int rt2870_suspend(struct usb_interface *intf, pm_message_t state); static int rt2870_resume(struct usb_interface *intf); @@ -112,9 +85,6 @@ static int rtusb_probe (struct usb_interface *intf, static void rtusb_disconnect(struct usb_interface *intf); struct usb_driver rtusb_driver = { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) - .owner = THIS_MODULE, -#endif .name="rt2870", .probe=rtusb_probe, .disconnect=rtusb_disconnect, @@ -176,7 +146,6 @@ static int rt2870_resume( return 0; } #endif // CONFIG_PM // -#endif // LINUX_VERSION_CODE // // Init driver module @@ -265,7 +234,12 @@ INT MlmeThread( */ DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__func__)); +#ifndef RT30xx pObj->MLMEThr_task = NULL; +#endif +#ifdef RT30xx + pObj->MLMEThr_pid = NULL; +#endif complete_and_exit (&pAd->mlmeComplete, 0); return 0; @@ -373,7 +347,12 @@ INT RTUSBCmdThread( */ DBGPRINT(RT_DEBUG_TRACE,( "<---RTUSBCmdThread\n")); +#ifndef RT30xx pObj->RTUSBCmdThr_task = NULL; +#endif +#ifdef RT30xx + pObj->RTUSBCmdThr_pid = NULL; +#endif complete_and_exit (&pAd->CmdQComplete, 0); return 0; @@ -467,8 +446,12 @@ INT TimerQThread( */ DBGPRINT(RT_DEBUG_TRACE,( "<---%s\n",__func__)); +#ifndef RT30xx pObj->TimerQThr_task = NULL; - +#endif +#ifdef RT30xx + pObj->TimerQThr_pid = NULL; +#endif complete_and_exit(&pAd->TimerQComplete, 0); return 0; @@ -636,6 +619,7 @@ VOID RT2870_WatchDog(IN RTMP_ADAPTER *pAd) RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf40006); } +//PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA) idx = 0; if ((MACValue & 0xff00) !=0 ) { @@ -649,7 +633,6 @@ VOID RT2870_WatchDog(IN RTMP_ADAPTER *pAd) RTMP_IO_WRITE32(pAd, PBF_CFG, 0xf40006); } - if (pAd->watchDogRxOverFlowCnt >= 2) { DBGPRINT(RT_DEBUG_TRACE, ("Maybe the Rx Bulk-In hanged! Cancel the pending Rx bulks request!\n")); @@ -740,7 +723,6 @@ VOID RT2870_WatchDog(IN RTMP_ADAPTER *pAd) } } -#ifdef DOT11_N_SUPPORT // For Sigma debug, dump the ba_reordering sequence. if((needDumpSeq == TRUE) && (pAd->CommonCfg.bDisableReordering == 0)) { @@ -768,7 +750,6 @@ VOID RT2870_WatchDog(IN RTMP_ADAPTER *pAd) NdisReleaseSpinLock(&pBAEntry->RxReRingLock); } } -#endif // DOT11_N_SUPPORT // } /* @@ -795,19 +776,7 @@ static void _rtusb_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd) dev->bus->bus_name, dev->devpath)); if (!pAd) { -#ifdef MULTIPLE_CARD_SUPPORT - if ((pAd->MC_RowID >= 0) && (pAd->MC_RowID <= MAX_NUM_OF_MULTIPLE_CARD)) - MC_CardUsed[pAd->MC_RowID] = 0; // not clear MAC address -#endif // MULTIPLE_CARD_SUPPORT // - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */ - while(MOD_IN_USE > 0) - { - MOD_DEC_USE_COUNT; - } -#else usb_put_dev(dev); -#endif // LINUX_VERSION_CODE // printk("rtusb_disconnect: pAd == NULL!\n"); return; @@ -829,31 +798,17 @@ static void _rtusb_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd) unregister_netdev (pAd->net_dev); } udelay(1); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */ -#else flush_scheduled_work(); -#endif // LINUX_VERSION_CODE // udelay(1); // free net_device memory -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */ - kfree(net_dev); -#else free_netdev(net_dev); -#endif // LINUX_VERSION_CODE // // free adapter memory RTMPFreeAdapter(pAd); // release a use of the usb device structure -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */ - while(MOD_IN_USE > 0) - { - MOD_DEC_USE_COUNT; - } -#else usb_put_dev(dev); -#endif // LINUX_VERSION_CODE // udelay(1); DBGPRINT(RT_DEBUG_ERROR, (" RTUSB disconnect successfully\n")); @@ -876,22 +831,6 @@ Return Value: Note: ======================================================================== */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */ -static void *rtusb_probe(struct usb_device *dev, UINT interface, - const struct usb_device_id *id) -{ - PRTMP_ADAPTER pAd; - rt28xx_probe((void *)dev, (void *)id, interface, &pAd); - return (void *)pAd; -} - -//Disconnect function is called within exit routine -static void rtusb_disconnect(struct usb_device *dev, void *ptr) -{ - _rtusb_disconnect(dev, ((PRTMP_ADAPTER)ptr)); -} - -#else /* kernel 2.6 series */ static int rtusb_probe (struct usb_interface *intf, const struct usb_device_id *id) { @@ -911,7 +850,6 @@ static void rtusb_disconnect(struct usb_interface *intf) _rtusb_disconnect(dev, pAd); } -#endif // LINUX_VERSION_CODE // /* @@ -944,6 +882,7 @@ VOID RT28xxThreadTerminate( RTUSBCancelPendingIRPs(pAd); // Terminate Threads +#ifndef RT30xx BUG_ON(pObj->TimerQThr_task == NULL); CHECK_PID_LEGALITY(task_pid(pObj->TimerQThr_task)) { @@ -985,7 +924,72 @@ VOID RT28xxThreadTerminate( kthread_stop(pObj->RTUSBCmdThr_task); pObj->RTUSBCmdThr_task = NULL; } +#endif +#ifdef RT30xx + if (pObj->MLMEThr_pid) + { + printk("Terminate the MLMEThr_pid=%d!\n", pid_nr(pObj->MLMEThr_pid)); + mb(); + pAd->mlme_kill = 1; + //RT28XX_MLME_HANDLER(pAd); + mb(); + ret = kill_pid(pObj->MLMEThr_pid, SIGTERM, 1); + if (ret) + { + printk (KERN_WARNING "%s: unable to Mlme thread, pid=%d, ret=%d!\n", + pAd->net_dev->name, pid_nr(pObj->MLMEThr_pid), ret); + } + else + { + //wait_for_completion (&pAd->notify); + wait_for_completion (&pAd->mlmeComplete); + pObj->MLMEThr_pid = NULL; + } + } + if (pObj->RTUSBCmdThr_pid >= 0) + { + printk("Terminate the RTUSBCmdThr_pid=%d!\n", pid_nr(pObj->RTUSBCmdThr_pid)); + mb(); + NdisAcquireSpinLock(&pAd->CmdQLock); + pAd->CmdQ.CmdQState = RT2870_THREAD_STOPED; + NdisReleaseSpinLock(&pAd->CmdQLock); + mb(); + //RTUSBCMDUp(pAd); + ret = kill_pid(pObj->RTUSBCmdThr_pid, SIGTERM, 1); + if (ret) + { + printk(KERN_WARNING "%s: unable to RTUSBCmd thread, pid=%d, ret=%d!\n", + pAd->net_dev->name, pid_nr(pObj->RTUSBCmdThr_pid), ret); + } + else + { + //wait_for_completion (&pAd->notify); + wait_for_completion (&pAd->CmdQComplete); + pObj->RTUSBCmdThr_pid = NULL; + } + } + if (pObj->TimerQThr_pid >= 0) + { + POS_COOKIE pObj = (POS_COOKIE)pAd->OS_Cookie; + printk("Terminate the TimerQThr_pid=%d!\n", pid_nr(pObj->TimerQThr_pid)); + mb(); + pAd->TimerFunc_kill = 1; + mb(); + ret = kill_pid(pObj->TimerQThr_pid, SIGTERM, 1); + if (ret) + { + printk(KERN_WARNING "%s: unable to stop TimerQThread, pid=%d, ret=%d!\n", + pAd->net_dev->name, pid_nr(pObj->TimerQThr_pid), ret); + } + else + { + printk("wait_for_completion TimerQThr\n"); + wait_for_completion(&pAd->TimerQComplete); + pObj->TimerQThr_pid = NULL; + } + } +#endif // Kill tasklets pAd->mlme_kill = 0; @@ -1030,12 +1034,8 @@ Note: BOOLEAN RT28XXChipsetCheck( IN void *_dev_p) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */ - struct usb_device *dev_p = (struct usb_device *)_dev_p; -#else struct usb_interface *intf = (struct usb_interface *)_dev_p; struct usb_device *dev_p = interface_to_usbdev(intf); -#endif // LINUX_VERSION_CODE // UINT32 i; @@ -1044,7 +1044,12 @@ BOOLEAN RT28XXChipsetCheck( if (dev_p->descriptor.idVendor == rtusb_usb_id[i].idVendor && dev_p->descriptor.idProduct == rtusb_usb_id[i].idProduct) { +#ifndef RT30xx printk(KERN_DEBUG "rt2870: idVendor = 0x%x, idProduct = 0x%x\n", +#endif +#ifdef RT30xx + printk("rt2870: idVendor = 0x%x, idProduct = 0x%x\n", +#endif dev_p->descriptor.idVendor, dev_p->descriptor.idProduct); break; } @@ -1082,19 +1087,11 @@ BOOLEAN RT28XXNetDevInit( IN struct net_device *net_dev, IN RTMP_ADAPTER *pAd) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */ - struct usb_device *dev_p = (struct usb_device *)_dev_p; -#else struct usb_interface *intf = (struct usb_interface *)_dev_p; struct usb_device *dev_p = interface_to_usbdev(intf); -#endif // LINUX_VERSION_CODE // -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */ - pAd->config = dev_p->config; -#else pAd->config = &dev_p->config->desc; -#endif // LINUX_VERSION_CODE // return TRUE; } @@ -1115,70 +1112,6 @@ Return Value: Note: ======================================================================== */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -BOOLEAN RT28XXProbePostConfig( - IN void *_dev_p, - IN RTMP_ADAPTER *pAd, - IN INT32 interface) -{ - struct usb_device *dev_p = (struct usb_device *)_dev_p; - struct usb_interface *intf; - struct usb_interface_descriptor *iface_desc; - struct usb_endpoint_descriptor *endpoint; - ULONG BulkOutIdx; - UINT32 i; - - - /* get the active interface descriptor */ - intf = &dev_p->actconfig->interface[interface]; - iface_desc = &intf->altsetting[0]; - - /* get # of enpoints */ - pAd->NumberOfPipes = iface_desc->bNumEndpoints; - DBGPRINT(RT_DEBUG_TRACE, ("NumEndpoints=%d\n", iface_desc->bNumEndpoints)); - - /* Configure Pipes */ - endpoint = &iface_desc->endpoint[0]; - BulkOutIdx = 0; - - for(i=0; i<pAd->NumberOfPipes; i++) - { - if ((endpoint[i].bmAttributes == USB_ENDPOINT_XFER_BULK) && - ((endpoint[i].bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN)) - { - pAd->BulkInEpAddr = endpoint[i].bEndpointAddress; - pAd->BulkInMaxPacketSize = endpoint[i].wMaxPacketSize; - - DBGPRINT_RAW(RT_DEBUG_TRACE, - ("BULK IN MaximumPacketSize = %d\n", pAd->BulkInMaxPacketSize)); - DBGPRINT_RAW(RT_DEBUG_TRACE, - ("EP address = 0x%2x \n", endpoint[i].bEndpointAddress)); - } - else if ((endpoint[i].bmAttributes == USB_ENDPOINT_XFER_BULK) && - ((endpoint[i].bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)) - { - // There are 6 bulk out EP. EP6 highest priority. - // EP1-4 is EDCA. EP5 is HCCA. - pAd->BulkOutEpAddr[BulkOutIdx++] = endpoint[i].bEndpointAddress; - pAd->BulkOutMaxPacketSize = endpoint[i].wMaxPacketSize; - - DBGPRINT_RAW(RT_DEBUG_TRACE, - ("BULK OUT MaximumPacketSize = %d\n", pAd->BulkOutMaxPacketSize)); - DBGPRINT_RAW(RT_DEBUG_TRACE, - ("EP address = 0x%2x \n", endpoint[i].bEndpointAddress)); - } - } - - if (!(pAd->BulkInEpAddr && pAd->BulkOutEpAddr[0])) - { - printk("Could not find both bulk-in and bulk-out endpoints\n"); - return FALSE; - } - - return TRUE; -} - -#else BOOLEAN RT28XXProbePostConfig( IN void *_dev_p, IN RTMP_ADAPTER *pAd, @@ -1241,7 +1174,6 @@ BOOLEAN RT28XXProbePostConfig( return TRUE; } -#endif // LINUX_VERSION_CODE // /* @@ -1380,9 +1312,7 @@ VOID RT28xx_UpdateBeaconToAsic( else { ptr = (PUCHAR)&pAd->BeaconTxWI; -#ifdef RT_BIG_ENDIAN - RTMPWIEndianChange(ptr, TYPE_TXWI); -#endif + if (NdisEqualMemory(pBeaconSync->BeaconTxWI[bcn_idx], &pAd->BeaconTxWI, TXWI_SIZE) == FALSE) { // If BeaconTxWI changed, we need to rewrite the TxWI for the Beacon frames. pBeaconSync->BeaconBitMap &= (~(BEACON_BITMAP_MASK & (1 << bcn_idx))); @@ -1417,6 +1347,8 @@ VOID RT28xx_UpdateBeaconToAsic( } pBeaconSync->BeaconBitMap |= (1 << bcn_idx); + + // For AP interface, set the DtimBitOn so that we can send Bcast/Mcast frame out after this beacon frame. } } @@ -1434,13 +1366,7 @@ VOID RT2870_BssBeaconStop( { INT NumOfBcn; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - NumOfBcn = MAX_MESH_NUM; - } -#endif // CONFIG_STA_SUPPORT // + NumOfBcn = MAX_MESH_NUM; RTMPCancelTimer(&pAd->CommonCfg.BeaconUpdateTimer, &Cancelled); @@ -1473,13 +1399,7 @@ VOID RT2870_BssBeaconStart( { INT NumOfBcn; - -#ifdef CONFIG_STA_SUPPORT - IF_DEV_CONFIG_OPMODE_ON_STA(pAd) - { - NumOfBcn = MAX_MESH_NUM; - } -#endif // CONFIG_STA_SUPPORT // + NumOfBcn = MAX_MESH_NUM; for(apidx=0; apidx<NumOfBcn; apidx++) { |