Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89900
b: refs/heads/master
c: 96d5105
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Feb 29, 2008
1 parent 4441e1e commit 484f53f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4688be308f35f1e0099140a179d95c5e63b2319d
refs/heads/master: 96d510566e4908f77f03ff1436c78ae7162a17d0
72 changes: 38 additions & 34 deletions trunk/net/mac80211/ieee80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -1375,9 +1375,7 @@ EXPORT_SYMBOL(ieee80211_tx_status);
struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
const struct ieee80211_ops *ops)
{
struct net_device *mdev;
struct ieee80211_local *local;
struct ieee80211_sub_if_data *sdata;
int priv_size;
struct wiphy *wiphy;

Expand Down Expand Up @@ -1423,22 +1421,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
BUG_ON(!ops->configure_filter);
local->ops = ops;

/* for now, mdev needs sub_if_data :/ */
mdev = alloc_netdev(sizeof(struct ieee80211_sub_if_data),
"wmaster%d", ether_setup);
if (!mdev) {
wiphy_free(wiphy);
return NULL;
}

sdata = IEEE80211_DEV_TO_SUB_IF(mdev);
mdev->ieee80211_ptr = &sdata->wdev;
sdata->wdev.wiphy = wiphy;

local->hw.queues = 1; /* default */

local->mdev = mdev;

local->bridge_packets = 1;

local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
Expand All @@ -1450,26 +1434,9 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
INIT_LIST_HEAD(&local->interfaces);

INIT_DELAYED_WORK(&local->scan_work, ieee80211_sta_scan_work);
ieee80211_rx_bss_list_init(mdev);

sta_info_init(local);

mdev->hard_start_xmit = ieee80211_master_start_xmit;
mdev->open = ieee80211_master_open;
mdev->stop = ieee80211_master_stop;
mdev->type = ARPHRD_IEEE80211;
mdev->header_ops = &ieee80211_header_ops;
mdev->set_multicast_list = ieee80211_master_set_multicast_list;

sdata->vif.type = IEEE80211_IF_TYPE_AP;
sdata->dev = mdev;
sdata->local = local;
sdata->u.ap.force_unicast_rateidx = -1;
sdata->u.ap.max_ratectrl_rateidx = -1;
ieee80211_if_sdata_init(sdata);
/* no RCU needed since we're still during init phase */
list_add_tail(&sdata->list, &local->interfaces);

tasklet_init(&local->tx_pending_tasklet, ieee80211_tx_pending,
(unsigned long)local);
tasklet_disable(&local->tx_pending_tasklet);
Expand All @@ -1492,6 +1459,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
const char *name;
int result;
enum ieee80211_band band;
struct net_device *mdev;
struct ieee80211_sub_if_data *sdata;

/*
* generic code guarantees at least one band,
Expand All @@ -1515,6 +1484,37 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
if (result < 0)
return result;

/* for now, mdev needs sub_if_data :/ */
mdev = alloc_netdev(sizeof(struct ieee80211_sub_if_data),
"wmaster%d", ether_setup);
if (!mdev)
goto fail_mdev_alloc;

sdata = IEEE80211_DEV_TO_SUB_IF(mdev);
mdev->ieee80211_ptr = &sdata->wdev;
sdata->wdev.wiphy = local->hw.wiphy;

local->mdev = mdev;

ieee80211_rx_bss_list_init(mdev);

mdev->hard_start_xmit = ieee80211_master_start_xmit;
mdev->open = ieee80211_master_open;
mdev->stop = ieee80211_master_stop;
mdev->type = ARPHRD_IEEE80211;
mdev->header_ops = &ieee80211_header_ops;
mdev->set_multicast_list = ieee80211_master_set_multicast_list;

sdata->vif.type = IEEE80211_IF_TYPE_AP;
sdata->dev = mdev;
sdata->local = local;
sdata->u.ap.force_unicast_rateidx = -1;
sdata->u.ap.max_ratectrl_rateidx = -1;
ieee80211_if_sdata_init(sdata);

/* no RCU needed since we're still during init phase */
list_add_tail(&sdata->list, &local->interfaces);

name = wiphy_dev(local->hw.wiphy)->driver->name;
local->hw.workqueue = create_singlethread_workqueue(name);
if (!local->hw.workqueue) {
Expand Down Expand Up @@ -1606,6 +1606,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
debugfs_hw_del(local);
destroy_workqueue(local->hw.workqueue);
fail_workqueue:
ieee80211_if_free(local->mdev);
local->mdev = NULL;
fail_mdev_alloc:
wiphy_unregister(local->hw.wiphy);
return result;
}
Expand Down Expand Up @@ -1666,14 +1669,15 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
wiphy_unregister(local->hw.wiphy);
ieee80211_wep_free(local);
ieee80211_led_exit(local);
ieee80211_if_free(local->mdev);
local->mdev = NULL;
}
EXPORT_SYMBOL(ieee80211_unregister_hw);

void ieee80211_free_hw(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);

ieee80211_if_free(local->mdev);
wiphy_free(local->hw.wiphy);
}
EXPORT_SYMBOL(ieee80211_free_hw);
Expand Down

0 comments on commit 484f53f

Please sign in to comment.