Skip to content

Commit

Permalink
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/linville/wireless-next-2.6
  • Loading branch information
David S. Miller committed Mar 4, 2010
2 parents 1cd4efd + 31f66be commit e5c1a0a
Show file tree
Hide file tree
Showing 17 changed files with 237 additions and 168 deletions.
3 changes: 2 additions & 1 deletion drivers/net/wireless/airo.c
Original file line number Diff line number Diff line change
Expand Up @@ -5255,7 +5255,8 @@ static int set_wep_key(struct airo_info *ai, u16 index, const char *key,
WepKeyRid wkr;
int rc;

WARN_ON(keylen == 0);
if (WARN_ON(keylen == 0))
return -1;

memset(&wkr, 0, sizeof(wkr));
wkr.len = cpu_to_le16(sizeof(wkr));
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ar9170/ar9170.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ struct ar9170 {
struct ath_common common;
struct mutex mutex;
enum ar9170_device_state state;
bool registered;
unsigned long bad_hw_nagger;

int (*open)(struct ar9170 *);
Expand Down
10 changes: 7 additions & 3 deletions drivers/net/wireless/ath/ar9170/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2701,7 +2701,8 @@ int ar9170_register(struct ar9170 *ar, struct device *pdev)
dev_info(pdev, "Atheros AR9170 is registered as '%s'\n",
wiphy_name(ar->hw->wiphy));

return err;
ar->registered = true;
return 0;

err_unreg:
ieee80211_unregister_hw(ar->hw);
Expand All @@ -2712,11 +2713,14 @@ int ar9170_register(struct ar9170 *ar, struct device *pdev)

void ar9170_unregister(struct ar9170 *ar)
{
if (ar->registered) {
#ifdef CONFIG_AR9170_LEDS
ar9170_unregister_leds(ar);
ar9170_unregister_leds(ar);
#endif /* CONFIG_AR9170_LEDS */

kfree_skb(ar->rx_failover);
ieee80211_unregister_hw(ar->hw);
}

kfree_skb(ar->rx_failover);
mutex_destroy(&ar->mutex);
}
170 changes: 103 additions & 67 deletions drivers/net/wireless/ath/ar9170/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,43 +582,6 @@ static int ar9170_usb_upload(struct ar9170_usb *aru, const void *data,
return 0;
}

static int ar9170_usb_request_firmware(struct ar9170_usb *aru)
{
int err = 0;

err = request_firmware(&aru->firmware, "ar9170.fw",
&aru->udev->dev);
if (!err) {
aru->init_values = NULL;
return 0;
}

if (aru->req_one_stage_fw) {
dev_err(&aru->udev->dev, "ar9170.fw firmware file "
"not found and is required for this device\n");
return -EINVAL;
}

dev_err(&aru->udev->dev, "ar9170.fw firmware file "
"not found, trying old firmware...\n");

err = request_firmware(&aru->init_values, "ar9170-1.fw",
&aru->udev->dev);
if (err) {
dev_err(&aru->udev->dev, "file with init values not found.\n");
return err;
}

err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev);
if (err) {
release_firmware(aru->init_values);
dev_err(&aru->udev->dev, "firmware file not found.\n");
return err;
}

return err;
}

static int ar9170_usb_reset(struct ar9170_usb *aru)
{
int ret, lock = (aru->intf->condition != USB_INTERFACE_BINDING);
Expand Down Expand Up @@ -757,6 +720,103 @@ static int ar9170_usb_init_device(struct ar9170_usb *aru)
return err;
}

static void ar9170_usb_firmware_failed(struct ar9170_usb *aru)
{
struct device *parent = aru->udev->dev.parent;

/* unbind anything failed */
if (parent)
down(&parent->sem);
device_release_driver(&aru->udev->dev);
if (parent)
up(&parent->sem);
}

static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context)
{
struct ar9170_usb *aru = context;
int err;

aru->firmware = fw;

if (!fw) {
dev_err(&aru->udev->dev, "firmware file not found.\n");
goto err_freefw;
}

err = ar9170_usb_init_device(aru);
if (err)
goto err_freefw;

err = ar9170_usb_open(&aru->common);
if (err)
goto err_unrx;

err = ar9170_register(&aru->common, &aru->udev->dev);

ar9170_usb_stop(&aru->common);
if (err)
goto err_unrx;

return;

err_unrx:
ar9170_usb_cancel_urbs(aru);

err_freefw:
ar9170_usb_firmware_failed(aru);
}

static void ar9170_usb_firmware_inits(const struct firmware *fw,
void *context)
{
struct ar9170_usb *aru = context;
int err;

if (!fw) {
dev_err(&aru->udev->dev, "file with init values not found.\n");
ar9170_usb_firmware_failed(aru);
return;
}

aru->init_values = fw;

/* ok so we have the init values -- get code for two-stage */

err = request_firmware_nowait(THIS_MODULE, 1, "ar9170-2.fw",
&aru->udev->dev, GFP_KERNEL, aru,
ar9170_usb_firmware_finish);
if (err)
ar9170_usb_firmware_failed(aru);
}

static void ar9170_usb_firmware_step2(const struct firmware *fw, void *context)
{
struct ar9170_usb *aru = context;
int err;

if (fw) {
ar9170_usb_firmware_finish(fw, context);
return;
}

if (aru->req_one_stage_fw) {
dev_err(&aru->udev->dev, "ar9170.fw firmware file "
"not found and is required for this device\n");
ar9170_usb_firmware_failed(aru);
return;
}

dev_err(&aru->udev->dev, "ar9170.fw firmware file "
"not found, trying old firmware...\n");

err = request_firmware_nowait(THIS_MODULE, 1, "ar9170-1.fw",
&aru->udev->dev, GFP_KERNEL, aru,
ar9170_usb_firmware_inits);
if (err)
ar9170_usb_firmware_failed(aru);
}

static bool ar9170_requires_one_stage(const struct usb_device_id *id)
{
if (!id->driver_info)
Expand Down Expand Up @@ -814,33 +874,9 @@ static int ar9170_usb_probe(struct usb_interface *intf,
if (err)
goto err_freehw;

err = ar9170_usb_request_firmware(aru);
if (err)
goto err_freehw;

err = ar9170_usb_init_device(aru);
if (err)
goto err_freefw;

err = ar9170_usb_open(ar);
if (err)
goto err_unrx;

err = ar9170_register(ar, &udev->dev);

ar9170_usb_stop(ar);
if (err)
goto err_unrx;

return 0;

err_unrx:
ar9170_usb_cancel_urbs(aru);

err_freefw:
release_firmware(aru->init_values);
release_firmware(aru->firmware);

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);
Expand All @@ -860,12 +896,12 @@ static void ar9170_usb_disconnect(struct usb_interface *intf)
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);

release_firmware(aru->init_values);
release_firmware(aru->firmware);
}

#ifdef CONFIG_PM
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/wireless/ath/ath9k/rc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,

static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
struct ieee80211_sta *sta, void *priv_sta,
u32 changed)
u32 changed, enum nl80211_channel_type oper_chan_type)
{
struct ath_softc *sc = priv;
struct ath_rate_priv *ath_rc_priv = priv_sta;
Expand All @@ -1340,8 +1340,8 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION)
return;

if (sc->hw->conf.channel_type == NL80211_CHAN_HT40MINUS ||
sc->hw->conf.channel_type == NL80211_CHAN_HT40PLUS)
if (oper_chan_type == NL80211_CHAN_HT40MINUS ||
oper_chan_type == NL80211_CHAN_HT40PLUS)
oper_cw40 = true;

oper_sgi40 = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ?
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/ath/ath9k/xmit.c
Original file line number Diff line number Diff line change
Expand Up @@ -2258,7 +2258,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
if (ATH_TXQ_SETUP(sc, i)) {
txq = &sc->tx.txq[i];

spin_lock(&txq->axq_lock);
spin_lock_bh(&txq->axq_lock);

list_for_each_entry_safe(ac,
ac_tmp, &txq->axq_acq, list) {
Expand All @@ -2279,7 +2279,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
}
}

spin_unlock(&txq->axq_lock);
spin_unlock_bh(&txq->axq_lock);
}
}
}
Loading

0 comments on commit e5c1a0a

Please sign in to comment.