Return-path: Received: from mail-we0-f177.google.com ([74.125.82.177]:61157 "EHLO mail-we0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755269AbaFYUVD (ORCPT ); Wed, 25 Jun 2014 16:21:03 -0400 Received: by mail-we0-f177.google.com with SMTP id u56so2555214wes.36 for ; Wed, 25 Jun 2014 13:20:59 -0700 (PDT) From: Malcolm Priestley To: gregkh@linuxfoundation.org Cc: linux-wireless@vger.kernel.org, Malcolm Priestley Subject: [PATCH 04/34] staging: vt6656: main_usb removed dead code Date: Wed, 25 Jun 2014 21:19:41 +0100 Message-Id: <1403727611-6825-5-git-send-email-tvboxspy@gmail.com> (sfid-20140625_222112_788700_2DF00F89) In-Reply-To: <1403727611-6825-1-git-send-email-tvboxspy@gmail.com> References: <1403727611-6825-1-git-send-email-tvboxspy@gmail.com> Sender: linux-wireless-owner@vger.kernel.org List-ID: Signed-off-by: Malcolm Priestley --- drivers/staging/vt6656/device.h | 2 - drivers/staging/vt6656/main_usb.c | 371 -------------------------------------- drivers/staging/vt6656/wcmd.c | 1 - 3 files changed, 374 deletions(-) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 1b74f47..c2e495b 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -754,8 +754,6 @@ struct vnt_private { #define MP_IS_READY(_M) (((_M)->Flags & fMP_DISCONNECTED) == 0) -int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF); -void vnt_configure_filter(struct vnt_private *); int vnt_init(struct vnt_private *priv); #endif diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index ce8aa26..f3b0890 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -204,21 +204,11 @@ static int vt6656_suspend(struct usb_interface *intf, pm_message_t message); static int vt6656_resume(struct usb_interface *intf); #endif /* CONFIG_PM */ -static struct net_device_stats *device_get_stats(struct net_device *dev); -static int device_open(struct net_device *dev); -static int device_xmit(struct sk_buff *skb, struct net_device *dev); -static void device_set_multi(struct net_device *dev); -static int device_close(struct net_device *dev); -static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); - static int device_init_registers(struct vnt_private *pDevice); -static bool device_init_defrag_cb(struct vnt_private *pDevice); -static int ethtool_ioctl(struct net_device *dev, struct ifreq *); static void device_free_tx_bufs(struct vnt_private *pDevice); static void device_free_rx_bufs(struct vnt_private *pDevice); static void device_free_int_bufs(struct vnt_private *pDevice); -static void device_free_frag_bufs(struct vnt_private *pDevice); static bool device_alloc_bufs(struct vnt_private *pDevice); static void usb_device_reset(struct vnt_private *pDevice); @@ -561,15 +551,6 @@ static int device_init_registers(struct vnt_private *pDevice) return true; } -static const struct net_device_ops device_netdev_ops = { - .ndo_open = device_open, - .ndo_stop = device_close, - .ndo_do_ioctl = device_ioctl, - .ndo_get_stats = device_get_stats, - .ndo_start_xmit = device_xmit, - .ndo_set_rx_mode = device_set_multi, -}; - static void device_free_tx_bufs(struct vnt_private *priv) { struct vnt_usb_send_context *tx_context; @@ -726,213 +707,6 @@ free_tx: return false; } -static bool device_init_defrag_cb(struct vnt_private *pDevice) -{ - int i; - PSDeFragControlBlock pDeF; - - /* Init the fragment ctl entries */ - for (i = 0; i < CB_MAX_RX_FRAG; i++) { - pDeF = &(pDevice->sRxDFCB[i]); - if (!device_alloc_frag_buf(pDevice, pDeF)) { - DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc frag bufs\n", - pDevice->dev->name); - goto free_frag; - } - } - pDevice->cbDFCB = CB_MAX_RX_FRAG; - pDevice->cbFreeDFCB = pDevice->cbDFCB; - return true; - -free_frag: - device_free_frag_bufs(pDevice); - return false; -} - -static void device_free_frag_bufs(struct vnt_private *pDevice) -{ - PSDeFragControlBlock pDeF; - int i; - - for (i = 0; i < CB_MAX_RX_FRAG; i++) { - - pDeF = &(pDevice->sRxDFCB[i]); - - if (pDeF->skb) - dev_kfree_skb(pDeF->skb); - } -} - -int device_alloc_frag_buf(struct vnt_private *pDevice, - PSDeFragControlBlock pDeF) -{ - pDeF->skb = netdev_alloc_skb(pDevice->dev, pDevice->rx_buf_sz); - if (!pDeF->skb) - return false; - - return true; -} - -static int device_open(struct net_device *dev) -{ - struct vnt_private *pDevice = netdev_priv(dev); - - pDevice->fWPA_Authened = false; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " device_open...\n"); - - pDevice->rx_buf_sz = MAX_TOTAL_SIZE_WITH_ALL_HEADERS; - - if (device_alloc_bufs(pDevice) == false) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " device_alloc_bufs fail... \n"); - return -ENOMEM; - } - - if (device_init_defrag_cb(pDevice)== false) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Initial defragment cb fail \n"); - goto free_rx_tx; - } - - MP_CLEAR_FLAG(pDevice, fMP_DISCONNECTED); - MP_SET_FLAG(pDevice, fMP_POST_READS); - MP_SET_FLAG(pDevice, fMP_POST_WRITES); - - if (device_init_registers(pDevice) == false) { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " init register fail\n"); - goto free_all; - } - - /* init for key management */ - KeyvInitTable(pDevice,&pDevice->sKey); - memcpy(pDevice->vnt_mgmt.abyMACAddr, - pDevice->abyCurrentNetAddr, ETH_ALEN); - memcpy(pDevice->dev->dev_addr, pDevice->abyCurrentNetAddr, ETH_ALEN); - pDevice->bStopTx0Pkt = false; - pDevice->bStopDataPkt = false; - pDevice->bRoaming = false; - pDevice->bIsRoaming = false; - pDevice->bEnableRoaming = false; - - vMgrObjectInit(pDevice); - - schedule_delayed_work(&pDevice->second_callback_work, HZ); - - pDevice->int_interval = 1; /* bInterval is set to 1 */ - pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; - - pDevice->bIsRxWorkItemQueued = true; - - pDevice->bWPADEVUp = false; - pDevice->bwextstep0 = false; - pDevice->bwextstep1 = false; - pDevice->bwextstep2 = false; - pDevice->bwextstep3 = false; - pDevice->bWPASuppWextEnabled = false; - pDevice->byReAssocCount = 0; - - schedule_work(&pDevice->read_work_item); - INTvWorkItem(pDevice); - - /* if WEP key already set by iwconfig but device not yet open */ - if ((pDevice->bEncryptionEnable == true) && (pDevice->bTransmitKey == true)) { - KeybSetDefaultKey( pDevice, - &(pDevice->sKey), - pDevice->byKeyIndex | (1 << 31), - pDevice->uKeyLength, - NULL, - pDevice->abyKey, - KEY_CTL_WEP - ); - - pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; - } - - if (pDevice->vnt_mgmt.eConfigMode == WMAC_CONFIG_AP) - bScheduleCommand((void *) pDevice, WLAN_CMD_RUN_AP, NULL); - else - bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); - - netif_stop_queue(pDevice->dev); - pDevice->flags |= DEVICE_FLAGS_OPENED; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success..\n"); - return 0; - -free_all: - device_free_frag_bufs(pDevice); -free_rx_tx: - device_free_rx_bufs(pDevice); - device_free_tx_bufs(pDevice); - device_free_int_bufs(pDevice); - usb_kill_urb(pDevice->pInterruptURB); - usb_free_urb(pDevice->pInterruptURB); - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open fail.. \n"); - return -ENOMEM; -} - -static int device_close(struct net_device *dev) -{ - struct vnt_private *pDevice = netdev_priv(dev); - struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - u8 uu; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close1\n"); - if (pDevice == NULL) - return -ENODEV; - - if (pDevice->bLinkPass) { - bScheduleCommand((void *) pDevice, WLAN_CMD_DISASSOCIATE, NULL); - mdelay(30); - } - - memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); - pMgmt->bShareKeyAlgorithm = false; - pDevice->bEncryptionEnable = false; - pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; - - for (uu = 0; uu < MAX_KEY_TABLE; uu++) - vnt_mac_disable_keyentry(pDevice, uu); - - if ((pDevice->flags & DEVICE_FLAGS_UNPLUG) == false) - vnt_mac_shutdown(pDevice); - - netif_stop_queue(pDevice->dev); - MP_SET_FLAG(pDevice, fMP_DISCONNECTED); - MP_CLEAR_FLAG(pDevice, fMP_POST_WRITES); - MP_CLEAR_FLAG(pDevice, fMP_POST_READS); - - cancel_delayed_work_sync(&pDevice->run_command_work); - cancel_delayed_work_sync(&pDevice->second_callback_work); - - cancel_work_sync(&pDevice->rx_mng_work_item); - cancel_work_sync(&pDevice->read_work_item); - - pDevice->bRoaming = false; - pDevice->bIsRoaming = false; - pDevice->bEnableRoaming = false; - pDevice->bCmdRunning = false; - pDevice->bLinkPass = false; - memset(pMgmt->abyCurrBSSID, 0, 6); - pMgmt->eCurrState = WMAC_STATE_IDLE; - - pDevice->flags &= ~DEVICE_FLAGS_OPENED; - - device_free_tx_bufs(pDevice); - device_free_rx_bufs(pDevice); - device_free_int_bufs(pDevice); - device_free_frag_bufs(pDevice); - - usb_kill_urb(pDevice->pInterruptURB); - usb_free_urb(pDevice->pInterruptURB); - - BSSvClearNodeDBTable(pDevice, 0); - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close2 \n"); - - return 0; -} - static void vnt_tx_80211(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct sk_buff *skb) { @@ -1473,151 +1247,6 @@ static int vt6656_resume(struct usb_interface *intf) #endif /* CONFIG_PM */ -static int device_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct vnt_private *pDevice = netdev_priv(dev); - struct net_device_stats *stats = &pDevice->stats; - unsigned long flags; - - spin_lock_irqsave(&pDevice->lock, flags); - - netif_stop_queue(dev); - - if (!pDevice->bLinkPass) { - dev_kfree_skb_irq(skb); - goto out; - } - - if (pDevice->bStopDataPkt) { - dev_kfree_skb_irq(skb); - stats->tx_dropped++; - goto out; - } - - if (nsDMA_tx_packet(pDevice, skb)) { - if (netif_queue_stopped(dev)) - netif_wake_queue(dev); - } - -out: - spin_unlock_irqrestore(&pDevice->lock, flags); - - return NETDEV_TX_OK; -} - -static void device_set_multi(struct net_device *dev) -{ - struct vnt_private *priv = netdev_priv(dev); - unsigned long flags; - - if (priv->flags & DEVICE_FLAGS_OPENED) { - spin_lock_irqsave(&priv->lock, flags); - - bScheduleCommand(priv, WLAN_CMD_CONFIGURE_FILTER, NULL); - - spin_unlock_irqrestore(&priv->lock, flags); - } -} - -void vnt_configure_filter(struct vnt_private *priv) -{ - struct net_device *dev = priv->dev; - struct vnt_manager *mgmt = &priv->vnt_mgmt; - struct netdev_hw_addr *ha; - u64 mc_filter = 0; - u8 tmp = 0; - int rc; - - rc = vnt_control_in(priv, MESSAGE_TYPE_READ, - MAC_REG_RCR, MESSAGE_REQUEST_MACREG, 1, &tmp); - if (rc == 0) - priv->byRxMode = tmp; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "priv->byRxMode in= %x\n", - priv->byRxMode); - - if (dev->flags & IFF_PROMISC) { /* set promiscuous mode */ - DBG_PRT(MSG_LEVEL_ERR, KERN_NOTICE - "%s: Promiscuous mode enabled.\n", dev->name); - /* unconditionally log net taps */ - priv->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST|RCR_UNICAST); - } else if ((netdev_mc_count(dev) > priv->multicast_limit) || - (dev->flags & IFF_ALLMULTI)) { - mc_filter = ~0x0; - vnt_mac_set_filter(priv, mc_filter); - - priv->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST); - } else { - netdev_for_each_mc_addr(ha, dev) { - int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26; - - mc_filter |= 1ULL << (bit_nr & 0x3f); - } - - vnt_mac_set_filter(priv, mc_filter); - - priv->byRxMode &= ~(RCR_UNICAST); - priv->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST); - } - - if (mgmt->eConfigMode == WMAC_CONFIG_AP) { - /* - * If AP mode, don't enable RCR_UNICAST since HW only compares - * addr1 with local MAC - */ - priv->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST); - priv->byRxMode &= ~(RCR_UNICAST); - } - - vnt_control_out_u8(priv, MESSAGE_REQUEST_MACREG, - MAC_REG_RCR, priv->byRxMode); - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "priv->byRxMode out= %x\n", priv->byRxMode); -} - -static struct net_device_stats *device_get_stats(struct net_device *dev) -{ - struct vnt_private *pDevice = netdev_priv(dev); - - return &pDevice->stats; -} - -static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - int rc = 0; - - switch (cmd) { - case SIOCETHTOOL: - return ethtool_ioctl(dev, rq); - - } - - return rc; -} - -static int ethtool_ioctl(struct net_device *dev, struct ifreq *rq) -{ - u32 ethcmd; - - if (copy_from_user(ðcmd, rq->ifr_data, sizeof(ethcmd))) - return -EFAULT; - - switch (ethcmd) { - case ETHTOOL_GDRVINFO: { - struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO}; - strncpy(info.driver, DEVICE_NAME, sizeof(info.driver)-1); - strncpy(info.version, DEVICE_VERSION, sizeof(info.version)-1); - if (copy_to_user(rq->ifr_data, &info, sizeof(info))) - return -EFAULT; - return 0; - } - - } - - return -EOPNOTSUPP; -} - MODULE_DEVICE_TABLE(usb, vt6656_table); static struct usb_driver vt6656_driver = { diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index 81a6683..4d7d5b1 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -899,7 +899,6 @@ void vRunCommand(struct work_struct *work) break; case WLAN_CMD_CONFIGURE_FILTER_START: - vnt_configure_filter(pDevice); break; default: break; -- 1.9.1