Skip to content

Commit

Permalink
mac80211: remove struct ieee80211_if_init_conf
Browse files Browse the repository at this point in the history
All its members (vif, mac_addr, type) are now available
in the vif struct directly, so we can pass that instead
of the conf struct. I generated this patch (except the
mac80211 and header file changes) with this semantic
patch:

@@
identifier conf, fn, hw;
type tp;
@@
tp fn(struct ieee80211_hw *hw,
-struct ieee80211_if_init_conf *conf)
+struct ieee80211_vif *vif)
{
<...
(
-conf->type
+vif->type
|
-conf->mac_addr
+vif->addr
|
-conf->vif
+vif
)
...>
}

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Dec 28, 2009
1 parent 98b6218 commit 1ed32e4
Show file tree
Hide file tree
Showing 25 changed files with 170 additions and 214 deletions.
12 changes: 6 additions & 6 deletions drivers/net/wireless/adm8211.c
Original file line number Diff line number Diff line change
Expand Up @@ -1400,24 +1400,24 @@ static void adm8211_configure_filter(struct ieee80211_hw *dev,
}

static int adm8211_add_interface(struct ieee80211_hw *dev,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct adm8211_priv *priv = dev->priv;
if (priv->mode != NL80211_IFTYPE_MONITOR)
return -EOPNOTSUPP;

switch (conf->type) {
switch (vif->type) {
case NL80211_IFTYPE_STATION:
priv->mode = conf->type;
priv->mode = vif->type;
break;
default:
return -EOPNOTSUPP;
}

ADM8211_IDLE();

ADM8211_CSR_WRITE(PAR0, le32_to_cpu(*(__le32 *)conf->mac_addr));
ADM8211_CSR_WRITE(PAR1, le16_to_cpu(*(__le16 *)(conf->mac_addr + 4)));
ADM8211_CSR_WRITE(PAR0, le32_to_cpu(*(__le32 *)vif->addr));
ADM8211_CSR_WRITE(PAR1, le16_to_cpu(*(__le16 *)(vif->addr + 4)));

adm8211_update_mode(dev);

Expand All @@ -1427,7 +1427,7 @@ static int adm8211_add_interface(struct ieee80211_hw *dev,
}

static void adm8211_remove_interface(struct ieee80211_hw *dev,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct adm8211_priv *priv = dev->priv;
priv->mode = NL80211_IFTYPE_MONITOR;
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/wireless/at76c50x-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,7 @@ static void at76_mac80211_stop(struct ieee80211_hw *hw)
}

static int at76_add_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct at76_priv *priv = hw->priv;
int ret = 0;
Expand All @@ -1798,7 +1798,7 @@ static int at76_add_interface(struct ieee80211_hw *hw,

mutex_lock(&priv->mtx);

switch (conf->type) {
switch (vif->type) {
case NL80211_IFTYPE_STATION:
priv->iw_mode = IW_MODE_INFRA;
break;
Expand All @@ -1814,7 +1814,7 @@ static int at76_add_interface(struct ieee80211_hw *hw,
}

static void at76_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
at76_dbg(DBG_MAC80211, "%s()", __func__);
}
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/wireless/ath/ar9170/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1939,7 +1939,7 @@ int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
}

static int ar9170_op_add_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct ar9170 *ar = hw->priv;
struct ath_common *common = &ar->common;
Expand All @@ -1952,8 +1952,8 @@ static int ar9170_op_add_interface(struct ieee80211_hw *hw,
goto unlock;
}

ar->vif = conf->vif;
memcpy(common->macaddr, conf->mac_addr, ETH_ALEN);
ar->vif = vif;
memcpy(common->macaddr, vif->addr, ETH_ALEN);

if (modparam_nohwcrypt || (ar->vif->type != NL80211_IFTYPE_STATION)) {
ar->rx_software_decryption = true;
Expand All @@ -1973,7 +1973,7 @@ static int ar9170_op_add_interface(struct ieee80211_hw *hw,
}

static void ar9170_op_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct ar9170 *ar = hw->priv;

Expand Down
18 changes: 9 additions & 9 deletions drivers/net/wireless/ath/ath5k/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ static int ath5k_reset_wake(struct ath5k_softc *sc);
static int ath5k_start(struct ieee80211_hw *hw);
static void ath5k_stop(struct ieee80211_hw *hw);
static int ath5k_add_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf);
struct ieee80211_vif *vif);
static void ath5k_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf);
struct ieee80211_vif *vif);
static int ath5k_config(struct ieee80211_hw *hw, u32 changed);
static u64 ath5k_prepare_multicast(struct ieee80211_hw *hw,
int mc_count, struct dev_addr_list *mc_list);
Expand Down Expand Up @@ -2785,7 +2785,7 @@ static void ath5k_stop(struct ieee80211_hw *hw)
}

static int ath5k_add_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct ath5k_softc *sc = hw->priv;
int ret;
Expand All @@ -2796,22 +2796,22 @@ static int ath5k_add_interface(struct ieee80211_hw *hw,
goto end;
}

sc->vif = conf->vif;
sc->vif = vif;

switch (conf->type) {
switch (vif->type) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_ADHOC:
case NL80211_IFTYPE_MESH_POINT:
case NL80211_IFTYPE_MONITOR:
sc->opmode = conf->type;
sc->opmode = vif->type;
break;
default:
ret = -EOPNOTSUPP;
goto end;
}

ath5k_hw_set_lladdr(sc->ah, conf->mac_addr);
ath5k_hw_set_lladdr(sc->ah, vif->addr);
ath5k_mode_setup(sc);

ret = 0;
Expand All @@ -2822,13 +2822,13 @@ static int ath5k_add_interface(struct ieee80211_hw *hw,

static void
ath5k_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct ath5k_softc *sc = hw->priv;
u8 mac[ETH_ALEN] = {};

mutex_lock(&sc->lock);
if (sc->vif != conf->vif)
if (sc->vif != vif)
goto end;

ath5k_hw_set_lladdr(sc->ah, mac);
Expand Down
28 changes: 14 additions & 14 deletions drivers/net/wireless/ath/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2534,12 +2534,12 @@ static void ath9k_stop(struct ieee80211_hw *hw)
}

static int ath9k_add_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_vif *avp = (void *)conf->vif->drv_priv;
struct ath_vif *avp = (void *)vif->drv_priv;
enum nl80211_iftype ic_opmode = NL80211_IFTYPE_UNSPECIFIED;
int ret = 0;

Expand All @@ -2551,7 +2551,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
goto out;
}

switch (conf->type) {
switch (vif->type) {
case NL80211_IFTYPE_STATION:
ic_opmode = NL80211_IFTYPE_STATION;
break;
Expand All @@ -2562,11 +2562,11 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
ret = -ENOBUFS;
goto out;
}
ic_opmode = conf->type;
ic_opmode = vif->type;
break;
default:
ath_print(common, ATH_DBG_FATAL,
"Interface type %d not yet supported\n", conf->type);
"Interface type %d not yet supported\n", vif->type);
ret = -EOPNOTSUPP;
goto out;
}
Expand Down Expand Up @@ -2598,18 +2598,18 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
* Enable MIB interrupts when there are hardware phy counters.
* Note we only do this (at the moment) for station mode.
*/
if ((conf->type == NL80211_IFTYPE_STATION) ||
(conf->type == NL80211_IFTYPE_ADHOC) ||
(conf->type == NL80211_IFTYPE_MESH_POINT)) {
if ((vif->type == NL80211_IFTYPE_STATION) ||
(vif->type == NL80211_IFTYPE_ADHOC) ||
(vif->type == NL80211_IFTYPE_MESH_POINT)) {
sc->imask |= ATH9K_INT_MIB;
sc->imask |= ATH9K_INT_TSFOOR;
}

ath9k_hw_set_interrupts(sc->sc_ah, sc->imask);

if (conf->type == NL80211_IFTYPE_AP ||
conf->type == NL80211_IFTYPE_ADHOC ||
conf->type == NL80211_IFTYPE_MONITOR)
if (vif->type == NL80211_IFTYPE_AP ||
vif->type == NL80211_IFTYPE_ADHOC ||
vif->type == NL80211_IFTYPE_MONITOR)
ath_start_ani(common);

out:
Expand All @@ -2618,12 +2618,12 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
}

static void ath9k_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_vif *avp = (void *)conf->vif->drv_priv;
struct ath_vif *avp = (void *)vif->drv_priv;
int i;

ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n");
Expand All @@ -2644,7 +2644,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
sc->sc_flags &= ~SC_OP_BEACONS;

for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) {
if (sc->beacon.bslot[i] == conf->vif) {
if (sc->beacon.bslot[i] == vif) {
printk(KERN_DEBUG "%s: vif had allocated beacon "
"slot\n", __func__);
sc->beacon.bslot[i] = NULL;
Expand Down
26 changes: 13 additions & 13 deletions drivers/net/wireless/b43/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4391,32 +4391,32 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
}

static int b43_op_add_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct b43_wl *wl = hw_to_b43_wl(hw);
struct b43_wldev *dev;
int err = -EOPNOTSUPP;

/* TODO: allow WDS/AP devices to coexist */

if (conf->type != NL80211_IFTYPE_AP &&
conf->type != NL80211_IFTYPE_MESH_POINT &&
conf->type != NL80211_IFTYPE_STATION &&
conf->type != NL80211_IFTYPE_WDS &&
conf->type != NL80211_IFTYPE_ADHOC)
if (vif->type != NL80211_IFTYPE_AP &&
vif->type != NL80211_IFTYPE_MESH_POINT &&
vif->type != NL80211_IFTYPE_STATION &&
vif->type != NL80211_IFTYPE_WDS &&
vif->type != NL80211_IFTYPE_ADHOC)
return -EOPNOTSUPP;

mutex_lock(&wl->mutex);
if (wl->operating)
goto out_mutex_unlock;

b43dbg(wl, "Adding Interface type %d\n", conf->type);
b43dbg(wl, "Adding Interface type %d\n", vif->type);

dev = wl->current_dev;
wl->operating = 1;
wl->vif = conf->vif;
wl->if_type = conf->type;
memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN);
wl->vif = vif;
wl->if_type = vif->type;
memcpy(wl->mac_addr, vif->addr, ETH_ALEN);

b43_adjust_opmode(dev);
b43_set_pretbtt(dev);
Expand All @@ -4431,17 +4431,17 @@ static int b43_op_add_interface(struct ieee80211_hw *hw,
}

static void b43_op_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct b43_wl *wl = hw_to_b43_wl(hw);
struct b43_wldev *dev = wl->current_dev;

b43dbg(wl, "Removing Interface type %d\n", conf->type);
b43dbg(wl, "Removing Interface type %d\n", vif->type);

mutex_lock(&wl->mutex);

B43_WARN_ON(!wl->operating);
B43_WARN_ON(wl->vif != conf->vif);
B43_WARN_ON(wl->vif != vif);
wl->vif = NULL;

wl->operating = 0;
Expand Down
24 changes: 12 additions & 12 deletions drivers/net/wireless/b43legacy/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3361,7 +3361,7 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev)
}

static int b43legacy_op_add_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
struct b43legacy_wldev *dev;
Expand All @@ -3370,23 +3370,23 @@ static int b43legacy_op_add_interface(struct ieee80211_hw *hw,

/* TODO: allow WDS/AP devices to coexist */

if (conf->type != NL80211_IFTYPE_AP &&
conf->type != NL80211_IFTYPE_STATION &&
conf->type != NL80211_IFTYPE_WDS &&
conf->type != NL80211_IFTYPE_ADHOC)
if (vif->type != NL80211_IFTYPE_AP &&
vif->type != NL80211_IFTYPE_STATION &&
vif->type != NL80211_IFTYPE_WDS &&
vif->type != NL80211_IFTYPE_ADHOC)
return -EOPNOTSUPP;

mutex_lock(&wl->mutex);
if (wl->operating)
goto out_mutex_unlock;

b43legacydbg(wl, "Adding Interface type %d\n", conf->type);
b43legacydbg(wl, "Adding Interface type %d\n", vif->type);

dev = wl->current_dev;
wl->operating = 1;
wl->vif = conf->vif;
wl->if_type = conf->type;
memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN);
wl->vif = vif;
wl->if_type = vif->type;
memcpy(wl->mac_addr, vif->addr, ETH_ALEN);

spin_lock_irqsave(&wl->irq_lock, flags);
b43legacy_adjust_opmode(dev);
Expand All @@ -3403,18 +3403,18 @@ static int b43legacy_op_add_interface(struct ieee80211_hw *hw,
}

static void b43legacy_op_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_if_init_conf *conf)
struct ieee80211_vif *vif)
{
struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
struct b43legacy_wldev *dev = wl->current_dev;
unsigned long flags;

b43legacydbg(wl, "Removing Interface type %d\n", conf->type);
b43legacydbg(wl, "Removing Interface type %d\n", vif->type);

mutex_lock(&wl->mutex);

B43legacy_WARN_ON(!wl->operating);
B43legacy_WARN_ON(wl->vif != conf->vif);
B43legacy_WARN_ON(wl->vif != vif);
wl->vif = NULL;

wl->operating = 0;
Expand Down
Loading

0 comments on commit 1ed32e4

Please sign in to comment.