void cw1200_free_common(struct ieee80211_hw *dev) { /* struct cw1200_common *priv = dev->priv; */ /* unsigned int i; */ ieee80211_free_hw(dev); }
struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf) { struct zd_mac *mac; struct ieee80211_hw *hw; int i; hw = ieee80211_alloc_hw(sizeof(struct zd_mac), &zd_ops); if (!hw) { dev_dbg_f(&intf->dev, "out of memory\n"); return NULL; } mac = zd_hw_mac(hw); memset(mac, 0, sizeof(*mac)); spin_lock_init(&mac->lock); mac->hw = hw; mac->type = IEEE80211_IF_TYPE_INVALID; memcpy(mac->channels, zd_channels, sizeof(zd_channels)); memcpy(mac->rates, zd_rates, sizeof(zd_rates)); mac->modes[0].mode = MODE_IEEE80211G; mac->modes[0].num_rates = ARRAY_SIZE(zd_rates); mac->modes[0].rates = mac->rates; mac->modes[0].num_channels = ARRAY_SIZE(zd_channels); mac->modes[0].channels = mac->channels; mac->modes[1].mode = MODE_IEEE80211B; mac->modes[1].num_rates = 4; mac->modes[1].rates = mac->rates; mac->modes[1].num_channels = ARRAY_SIZE(zd_channels); mac->modes[1].channels = mac->channels; hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED; hw->max_rssi = 100; hw->max_signal = 100; hw->queues = 1; hw->extra_tx_headroom = sizeof(struct zd_ctrlset); skb_queue_head_init(&mac->ack_wait_queue); for (i = 0; i < 2; i++) { if (ieee80211_register_hwmode(hw, &mac->modes[i])) { dev_dbg_f(&intf->dev, "cannot register hwmode\n"); ieee80211_free_hw(hw); return NULL; } } zd_chip_init(&mac->chip, hw, intf); housekeeping_init(mac); INIT_WORK(&mac->set_multicast_hash_work, set_multicast_hash_handler); INIT_WORK(&mac->set_rts_cts_work, set_rts_cts_work); INIT_WORK(&mac->set_rx_filter_work, set_rx_filter_handler); SET_IEEE80211_DEV(hw, &intf->dev); return hw; }
struct mt7601u_dev *mt7601u_alloc_device(struct device *pdev) { struct ieee80211_hw *hw; struct mt7601u_dev *dev; hw = ieee80211_alloc_hw(sizeof(*dev), &mt7601u_ops); if (!hw) return NULL; dev = hw->priv; dev->dev = pdev; dev->hw = hw; mutex_init(&dev->vendor_req_mutex); mutex_init(&dev->reg_atomic_mutex); mutex_init(&dev->hw_atomic_mutex); mutex_init(&dev->mutex); spin_lock_init(&dev->tx_lock); spin_lock_init(&dev->rx_lock); spin_lock_init(&dev->lock); spin_lock_init(&dev->mac_lock); spin_lock_init(&dev->con_mon_lock); atomic_set(&dev->avg_ampdu_len, 1); skb_queue_head_init(&dev->tx_skb_done); dev->stat_wq = alloc_workqueue("mt7601u", WQ_UNBOUND, 0); if (!dev->stat_wq) { ieee80211_free_hw(hw); return NULL; } return dev; }
/* * called from both kernel as from wl_*() * precondition: perimeter lock is not acquired. */ static void wl_remove(struct pci_dev *pdev) { struct wl_info *wl; struct ieee80211_hw *hw; int status; hw = pci_get_drvdata(pdev); wl = HW_TO_WL(hw); if (!wl) { pr_err("wl: wl_remove: pci_get_drvdata failed\n"); return; } WL_LOCK(wl); status = wlc_chipmatch(pdev->vendor, pdev->device); WL_UNLOCK(wl); if (!status) { wiphy_err(wl->wiphy, "wl: wl_remove: wlc_chipmatch failed\n"); return; } if (wl->wlc) { wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, false); wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); ieee80211_unregister_hw(hw); WL_LOCK(wl); wl_down(wl); WL_UNLOCK(wl); } pci_disable_device(pdev); wl_free(wl); pci_set_drvdata(pdev, NULL); ieee80211_free_hw(hw); }
static int __devexit wl1271_remove(struct spi_device *spi) { struct wl1271 *wl = dev_get_drvdata(&spi->dev); ieee80211_unregister_hw(wl->hw); wl1271_debugfs_exit(wl); platform_device_unregister(&wl1271_device); free_irq(wl->irq, wl); kfree(wl->target_mem_map); kfree(wl->fw); wl->fw = NULL; kfree(wl->nvs); wl->nvs = NULL; kfree(wl->rx_descriptor); wl->rx_descriptor = NULL; kfree(wl->fw_status); kfree(wl->tx_res_if); ieee80211_free_hw(wl->hw); return 0; }
static int ar9170_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct ar9170_usb *aru; struct ar9170 *ar; struct usb_device *udev; int err; aru = ar9170_alloc(sizeof(*aru)); if (IS_ERR(aru)) { err = PTR_ERR(aru); goto out; } udev = interface_to_usbdev(intf); usb_get_dev(udev); aru->udev = udev; aru->intf = intf; ar = &aru->common; aru->req_one_stage_fw = ar9170_requires_one_stage(id); usb_set_intfdata(intf, aru); SET_IEEE80211_DEV(ar->hw, &intf->dev); init_usb_anchor(&aru->rx_submitted); init_usb_anchor(&aru->tx_pending); init_usb_anchor(&aru->tx_submitted); init_completion(&aru->cmd_wait); init_completion(&aru->firmware_loading_complete); spin_lock_init(&aru->tx_urb_lock); aru->tx_pending_urbs = 0; atomic_set(&aru->tx_submitted_urbs, 0); aru->common.stop = ar9170_usb_stop; aru->common.flush = ar9170_usb_flush; aru->common.open = ar9170_usb_open; aru->common.tx = ar9170_usb_tx; aru->common.exec_cmd = ar9170_usb_exec_cmd; aru->common.callback_cmd = ar9170_usb_callback_cmd; #ifdef CONFIG_PM udev->reset_resume = 1; #endif /* CONFIG_PM */ err = ar9170_usb_reset(aru); if (err) goto err_freehw; usb_get_dev(aru->udev); return request_firmware_nowait(THIS_MODULE, 1, "ar9170.fw", &aru->udev->dev, GFP_KERNEL, aru, ar9170_usb_firmware_step2); err_freehw: usb_set_intfdata(intf, NULL); usb_put_dev(udev); ieee80211_free_hw(ar->hw); out: return err; }
static int mt76x2u_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(intf); struct mt76x02_dev *dev; int err; dev = mt76x2u_alloc_device(&intf->dev); if (!dev) return -ENOMEM; udev = usb_get_dev(udev); usb_reset_device(udev); mt76x02u_init_mcu(&dev->mt76); err = mt76u_init(&dev->mt76, intf); if (err < 0) goto err; dev->mt76.rev = mt76_rr(dev, MT_ASIC_VERSION); dev_info(dev->mt76.dev, "ASIC revision: %08x\n", dev->mt76.rev); err = mt76x2u_register_device(dev); if (err < 0) goto err; return 0; err: ieee80211_free_hw(mt76_hw(dev)); usb_set_intfdata(intf, NULL); usb_put_dev(udev); return err; }
void ath9k_deinit_device(struct ath_softc *sc) { struct ieee80211_hw *hw = sc->hw; int i = 0; ath9k_ps_wakeup(sc); wiphy_rfkill_stop_polling(sc->hw->wiphy); ath_deinit_leds(sc); for (i = 0; i < sc->num_sec_wiphy; i++) { struct ath_wiphy *aphy = sc->sec_wiphy[i]; if (aphy == NULL) continue; sc->sec_wiphy[i] = NULL; ieee80211_unregister_hw(aphy->hw); ieee80211_free_hw(aphy->hw); } kfree(sc->sec_wiphy); ieee80211_unregister_hw(hw); ath_rx_cleanup(sc); ath_tx_cleanup(sc); ath9k_deinit_softc(sc); }
static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode) { struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); int i; iwl_mvm_leds_exit(mvm); iwl_mvm_tt_exit(mvm); ieee80211_unregister_hw(mvm->hw); kfree(mvm->scan_cmd); vfree(mvm->fw_error_dump); kfree(mvm->fw_error_sram); kfree(mvm->fw_error_rxf); kfree(mvm->mcast_filter_cmd); mvm->mcast_filter_cmd = NULL; #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_IWLWIFI_DEBUGFS) kfree(mvm->d3_resume_sram); #endif iwl_trans_op_mode_leave(mvm->trans); iwl_phy_db_free(mvm->phy_db); mvm->phy_db = NULL; iwl_free_nvm_data(mvm->nvm_data); for (i = 0; i < NVM_MAX_NUM_SECTIONS; i++) kfree(mvm->nvm_sections[i].data); ieee80211_free_hw(mvm->hw); }
void rtl_usb_disconnect(struct usb_interface *intf) { struct ieee80211_hw *hw = usb_get_intfdata(intf); struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_mac *rtlmac = rtl_mac(rtl_priv(hw)); struct rtl_usb *rtlusb = rtl_usbdev(rtl_usbpriv(hw)); if (unlikely(!rtlpriv)) return; /* just in case driver is removed before firmware callback */ wait_for_completion(&rtlpriv->firmware_loading_complete); /*ieee80211_unregister_hw will call ops_stop */ if (rtlmac->mac80211_registered == 1) { ieee80211_unregister_hw(hw); rtlmac->mac80211_registered = 0; } else { rtl_deinit_deferred_work(hw); rtlpriv->intf_ops->adapter_stop(hw); } /*deinit rfkill */ /* rtl_deinit_rfkill(hw); */ rtl_usb_deinit(hw); rtl_deinit_core(hw); kfree(rtlpriv->usb_data); rtlpriv->cfg->ops->deinit_sw_leds(hw); rtlpriv->cfg->ops->deinit_sw_vars(hw); _rtl_usb_io_handler_release(hw); usb_put_dev(rtlusb->udev); usb_set_intfdata(intf, NULL); ieee80211_free_hw(hw); }
static void mt76pci_remove(struct pci_dev *pdev) { struct mt7603_dev *dev = pci_get_drvdata(pdev); mt76_unregister_device(&dev->mt76); mt7603_mcu_exit(dev); mt7603_dma_cleanup(dev); ieee80211_free_hw(mt76_hw(dev)); }
static void mt76pci_remove(struct pci_dev *pdev) { struct mt76_dev *mdev = pci_get_drvdata(pdev); struct mt76x2_dev *dev = container_of(mdev, struct mt76x2_dev, mt76); mt76_unregister_device(mdev); mt76x2_cleanup(dev); ieee80211_free_hw(mdev->hw); }
static int mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct mt76x2_dev *dev; int ret; ret = pcim_enable_device(pdev); if (ret) return ret; ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev)); if (ret) return ret; pci_set_master(pdev); ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret) return ret; dev = mt76x2_alloc_device(&pdev->dev); if (!dev) return -ENOMEM; mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]); dev->mt76.rev = mt76_rr(dev, MT_ASIC_VERSION); dev_info(dev->mt76.dev, "ASIC revision: %08x\n", dev->mt76.rev); ret = devm_request_irq(dev->mt76.dev, pdev->irq, mt76x2_irq_handler, IRQF_SHARED, KBUILD_MODNAME, dev); if (ret) goto error; ret = mt76x2_register_device(dev); if (ret) goto error; /* Fix up ASPM configuration */ /* RG_SSUSB_G1_CDR_BIR_LTR = 0x9 */ mt76_rmw_field(dev, 0x15a10, 0x1f << 16, 0x9); /* RG_SSUSB_G1_CDR_BIC_LTR = 0xf */ mt76_rmw_field(dev, 0x15a0c, 0xf << 28, 0xf); /* RG_SSUSB_CDR_BR_PE1D = 0x3 */ mt76_rmw_field(dev, 0x15c58, 0x3 << 6, 0x3); return 0; error: ieee80211_free_hw(mt76_hw(dev)); return ret; }
static void ath_pci_remove(struct pci_dev *pdev) { struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ath_softc *sc = hw->priv; if (!is_ath9k_unloaded) sc->sc_ah->ah_flags |= AH_UNPLUGGED; ath9k_deinit_device(sc); free_irq(sc->irq, sc); ieee80211_free_hw(sc->hw); }
static int mt7601u_probe(struct usb_interface *usb_intf, const struct usb_device_id *id) { struct usb_device *usb_dev = interface_to_usbdev(usb_intf); struct mt7601u_dev *dev; u32 asic_rev, mac_rev; int ret; dev = mt7601u_alloc_device(&usb_intf->dev); if (!dev) return -ENOMEM; usb_dev = usb_get_dev(usb_dev); usb_reset_device(usb_dev); usb_set_intfdata(usb_intf, dev); ret = mt7601u_assign_pipes(usb_intf, dev); if (ret) goto err; ret = mt7601u_wait_asic_ready(dev); if (ret) goto err; asic_rev = mt7601u_rr(dev, MT_ASIC_VERSION); mac_rev = mt7601u_rr(dev, MT_MAC_CSR0); dev_info(dev->dev, "ASIC revision: %08x MAC revision: %08x\n", asic_rev, mac_rev); /* Note: vendor driver skips this check for MT7601U */ if (!(mt7601u_rr(dev, MT_EFUSE_CTRL) & MT_EFUSE_CTRL_SEL)) dev_warn(dev->dev, "Warning: eFUSE not present\n"); ret = mt7601u_init_hardware(dev); if (ret) goto err; ret = mt7601u_register_device(dev); if (ret) goto err_hw; set_bit(MT7601U_STATE_INITIALIZED, &dev->state); return 0; err_hw: mt7601u_cleanup(dev); err: usb_set_intfdata(usb_intf, NULL); usb_put_dev(interface_to_usbdev(usb_intf)); destroy_workqueue(dev->stat_wq); ieee80211_free_hw(dev->hw); return ret; }
static void mt7601u_disconnect(struct usb_interface *usb_intf) { struct mt7601u_dev *dev = usb_get_intfdata(usb_intf); ieee80211_unregister_hw(dev->hw); mt7601u_cleanup(dev); usb_set_intfdata(usb_intf, NULL); usb_put_dev(interface_to_usbdev(usb_intf)); destroy_workqueue(dev->stat_wq); ieee80211_free_hw(dev->hw); }
int rt2x00soc_remove(struct platform_device *pdev) { struct ieee80211_hw *hw = platform_get_drvdata(pdev); struct rt2x00_dev *rt2x00dev = hw->priv; /* * Free all allocated data. */ rt2x00lib_remove_dev(rt2x00dev); rt2x00soc_free_reg(rt2x00dev); ieee80211_free_hw(hw); return 0; }
static void mt76x2u_disconnect(struct usb_interface *intf) { struct usb_device *udev = interface_to_usbdev(intf); struct mt76x02_dev *dev = usb_get_intfdata(intf); struct ieee80211_hw *hw = mt76_hw(dev); set_bit(MT76_REMOVED, &dev->mt76.state); ieee80211_unregister_hw(hw); mt76x2u_cleanup(dev); ieee80211_free_hw(hw); usb_set_intfdata(intf, NULL); usb_put_dev(udev); }
static void ath_pci_remove(struct pci_dev *pdev) { struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ath_wiphy *aphy = hw->priv; struct ath_softc *sc = aphy->sc; void __iomem *mem = sc->mem; ath9k_deinit_device(sc); free_irq(sc->irq, sc); ieee80211_free_hw(sc->hw); pci_iounmap(pdev, mem); pci_disable_device(pdev); pci_release_region(pdev, 0); }
static void __devexit p54u_disconnect(struct usb_interface *intf) { struct ieee80211_hw *dev = usb_get_intfdata(intf); struct p54u_priv *priv; if (!dev) return; ieee80211_unregister_hw(dev); priv = dev->priv; usb_put_dev(interface_to_usbdev(intf)); p54_free_common(dev); ieee80211_free_hw(dev); }
static int mt76_wmac_probe(struct platform_device *pdev) { struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct mt7603_dev *dev; void __iomem *mem_base; struct mt76_dev *mdev; int irq; int ret; irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_err(&pdev->dev, "Failed to get device IRQ\n"); return irq; } mem_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(mem_base)) { dev_err(&pdev->dev, "Failed to get memory resource\n"); return PTR_ERR(mem_base); } mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), &mt7603_ops, &mt7603_drv_ops); if (!mdev) return -ENOMEM; dev = container_of(mdev, struct mt7603_dev, mt76); mt76_mmio_init(mdev, mem_base); mdev->rev = (mt76_rr(dev, MT_HW_CHIPID) << 16) | (mt76_rr(dev, MT_HW_REV) & 0xff); dev_info(mdev->dev, "ASIC revision: %04x\n", mdev->rev); ret = devm_request_irq(mdev->dev, irq, mt7603_irq_handler, IRQF_SHARED, KBUILD_MODNAME, dev); if (ret) goto error; ret = mt7603_register_device(dev); if (ret) goto error; return 0; error: ieee80211_free_hw(mt76_hw(dev)); return ret; }
static void mac80211_hwsim_free(void) { int i; for (i = 0; i < hwsim_radio_count; i++) { if (hwsim_radios[i]) { struct mac80211_hwsim_data *data; data = hwsim_radios[i]->priv; ieee80211_unregister_hw(hwsim_radios[i]); device_unregister(data->dev); ieee80211_free_hw(hwsim_radios[i]); } } kfree(hwsim_radios); class_destroy(hwsim_class); }
/* * called from both kernel as from this kernel module (error flow on attach) * precondition: perimeter lock is not acquired. */ static void brcms_remove(struct bcma_device *pdev) { struct ieee80211_hw *hw = bcma_get_drvdata(pdev); struct brcms_info *wl = hw->priv; if (wl->wlc) { wiphy_rfkill_set_hw_state(wl->pub->ieee_hw->wiphy, false); wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy); ieee80211_unregister_hw(hw); } brcms_free(wl); bcma_set_drvdata(pdev, NULL); ieee80211_free_hw(hw); }
static void ath_pci_remove(struct pci_dev *pdev) { struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ath_softc *sc = hw->priv; void __iomem *mem = sc->mem; if (!is_ath9k_unloaded) sc->sc_ah->ah_flags |= AH_UNPLUGGED; ath9k_deinit_device(sc); free_irq(sc->irq, sc); ieee80211_free_hw(sc->hw); pci_iounmap(pdev, mem); pci_disable_device(pdev); pci_release_region(pdev, 0); }
static int mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct mt7603_dev *dev; int ret; ret = pcim_enable_device(pdev); if (ret) return ret; ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev)); if (ret) return ret; pci_set_master(pdev); ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret) return ret; dev = mt7603_alloc_device(&pdev->dev); if (!dev) return -ENOMEM; mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]); pci_set_drvdata(pdev, dev); dev->mt76.rev = (mt76_rr(dev, MT_HW_CHIPID) << 16) | (mt76_rr(dev, MT_HW_REV) & 0xff); dev_printk(KERN_INFO, dev->mt76.dev, "ASIC revision: %04x\n", dev->mt76.rev); ret = devm_request_irq(dev->mt76.dev, pdev->irq, mt7603_irq_handler, IRQF_SHARED, KBUILD_MODNAME, dev); if (ret) goto error; ret = mt7603_register_device(dev); if (ret) goto error; return 0; error: ieee80211_free_hw(mt76_hw(dev)); return ret; }
static void __devexit rtl8180_remove(struct pci_dev *pdev) { struct ieee80211_hw *dev = pci_get_drvdata(pdev); struct rtl8180_priv *priv; if (!dev) return; ieee80211_unregister_hw(dev); priv = dev->priv; pci_iounmap(pdev, priv->map); pci_release_regions(pdev); pci_disable_device(pdev); ieee80211_free_hw(dev); }
static void device_free_info(struct vnt_private *pDevice) { if (!pDevice) return; if (pDevice->mac_hw) ieee80211_unregister_hw(pDevice->hw); if (pDevice->PortOffset) iounmap(pDevice->PortOffset); if (pDevice->pcid) pci_release_regions(pDevice->pcid); if (pDevice->hw) ieee80211_free_hw(pDevice->hw); }
static void __devexit agnx_pci_remove(struct pci_dev *pdev) { struct ieee80211_hw *dev = pci_get_drvdata(pdev); struct agnx_priv *priv; AGNX_TRACE; if (!dev) return; priv = dev->priv; ieee80211_unregister_hw(dev); pci_iounmap(pdev, priv->ctl); pci_iounmap(pdev, priv->data); pci_release_regions(pdev); pci_disable_device(pdev); ieee80211_free_hw(dev); }
void rtl_pci_disconnect(struct pci_dev *pdev) { struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_pci *rtlpci = rtl_pcidev(pcipriv); struct rtl_mac *rtlmac = rtl_mac(rtlpriv); clear_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); sysfs_remove_group(&pdev->dev.kobj, &rtl_attribute_group); /*ieee80211_unregister_hw will call ops_stop */ if (rtlmac->mac80211_registered == 1) { ieee80211_unregister_hw(hw); rtlmac->mac80211_registered = 0; } else { rtl_deinit_deferred_work(hw); rtlpriv->intf_ops->adapter_stop(hw); } /*deinit rfkill */ rtl_deinit_rfkill(hw); rtl_pci_deinit(hw); rtl_deinit_core(hw); rtlpriv->cfg->ops->deinit_sw_leds(hw); _rtl_pci_io_handler_release(hw); rtlpriv->cfg->ops->deinit_sw_vars(hw); if (rtlpci->irq_alloc) { free_irq(rtlpci->pdev->irq, hw); rtlpci->irq_alloc = 0; } if (rtlpriv->io.pci_mem_start != 0) { pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start); pci_release_regions(pdev); } pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); ieee80211_free_hw(hw); }
static void ar9170_usb_disconnect(struct usb_interface *intf) { struct ar9170_usb *aru = usb_get_intfdata(intf); if (!aru) return; aru->common.state = AR9170_IDLE; ar9170_unregister(&aru->common); ar9170_usb_cancel_urbs(aru); release_firmware(aru->init_values); release_firmware(aru->firmware); usb_put_dev(aru->udev); usb_set_intfdata(intf, NULL); ieee80211_free_hw(aru->common.hw); }