Skip to content

Commit dcc5141

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6
2 parents bd28bdb + 4cc683c commit dcc5141

File tree

4 files changed

+60
-40
lines changed

4 files changed

+60
-40
lines changed

drivers/net/wireless/ath5k/base.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@ static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp)
340340
}
341341

342342
/* Interrupt handling */
343-
static int ath5k_init(struct ath5k_softc *sc);
343+
static int ath5k_init(struct ath5k_softc *sc, bool is_resume);
344344
static int ath5k_stop_locked(struct ath5k_softc *sc);
345-
static int ath5k_stop_hw(struct ath5k_softc *sc);
345+
static int ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend);
346346
static irqreturn_t ath5k_intr(int irq, void *dev_id);
347347
static void ath5k_tasklet_reset(unsigned long data);
348348

@@ -646,7 +646,7 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
646646

647647
ath5k_led_off(sc);
648648

649-
ath5k_stop_hw(sc);
649+
ath5k_stop_hw(sc, true);
650650

651651
free_irq(pdev->irq, sc);
652652
pci_save_state(pdev);
@@ -683,7 +683,7 @@ ath5k_pci_resume(struct pci_dev *pdev)
683683
goto err_no_irq;
684684
}
685685

686-
err = ath5k_init(sc);
686+
err = ath5k_init(sc, true);
687687
if (err)
688688
goto err_irq;
689689
ath5k_led_enable(sc);
@@ -2200,12 +2200,17 @@ ath5k_beacon_config(struct ath5k_softc *sc)
22002200
\********************/
22012201

22022202
static int
2203-
ath5k_init(struct ath5k_softc *sc)
2203+
ath5k_init(struct ath5k_softc *sc, bool is_resume)
22042204
{
22052205
int ret;
22062206

22072207
mutex_lock(&sc->lock);
22082208

2209+
if (is_resume && !test_bit(ATH_STAT_STARTED, sc->status))
2210+
goto out_ok;
2211+
2212+
__clear_bit(ATH_STAT_STARTED, sc->status);
2213+
22092214
ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "mode %d\n", sc->opmode);
22102215

22112216
/*
@@ -2230,12 +2235,15 @@ ath5k_init(struct ath5k_softc *sc)
22302235
if (ret)
22312236
goto done;
22322237

2238+
__set_bit(ATH_STAT_STARTED, sc->status);
2239+
22332240
/* Set ack to be sent at low bit-rates */
22342241
ath5k_hw_set_ack_bitrate_high(sc->ah, false);
22352242

22362243
mod_timer(&sc->calib_tim, round_jiffies(jiffies +
22372244
msecs_to_jiffies(ath5k_calinterval * 1000)));
22382245

2246+
out_ok:
22392247
ret = 0;
22402248
done:
22412249
mmiowb();
@@ -2290,7 +2298,7 @@ ath5k_stop_locked(struct ath5k_softc *sc)
22902298
* stop is preempted).
22912299
*/
22922300
static int
2293-
ath5k_stop_hw(struct ath5k_softc *sc)
2301+
ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend)
22942302
{
22952303
int ret;
22962304

@@ -2321,6 +2329,9 @@ ath5k_stop_hw(struct ath5k_softc *sc)
23212329
}
23222330
}
23232331
ath5k_txbuf_free(sc, sc->bbuf);
2332+
if (!is_suspend)
2333+
__clear_bit(ATH_STAT_STARTED, sc->status);
2334+
23242335
mmiowb();
23252336
mutex_unlock(&sc->lock);
23262337

@@ -2718,12 +2729,12 @@ ath5k_reset_wake(struct ath5k_softc *sc)
27182729

27192730
static int ath5k_start(struct ieee80211_hw *hw)
27202731
{
2721-
return ath5k_init(hw->priv);
2732+
return ath5k_init(hw->priv, false);
27222733
}
27232734

27242735
static void ath5k_stop(struct ieee80211_hw *hw)
27252736
{
2726-
ath5k_stop_hw(hw->priv);
2737+
ath5k_stop_hw(hw->priv, false);
27272738
}
27282739

27292740
static int ath5k_add_interface(struct ieee80211_hw *hw,

drivers/net/wireless/ath5k/base.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,12 @@ struct ath5k_softc {
128128
size_t desc_len; /* size of TX/RX descriptors */
129129
u16 cachelsz; /* cache line size */
130130

131-
DECLARE_BITMAP(status, 4);
131+
DECLARE_BITMAP(status, 5);
132132
#define ATH_STAT_INVALID 0 /* disable hardware accesses */
133133
#define ATH_STAT_MRRETRY 1 /* multi-rate retry support */
134134
#define ATH_STAT_PROMISC 2
135135
#define ATH_STAT_LEDSOFT 3 /* enable LED gpio status */
136+
#define ATH_STAT_STARTED 4 /* opened & irqs enabled */
136137

137138
unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
138139
unsigned int curmode; /* current phy mode */

drivers/net/wireless/orinoco.c

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ struct fw_info {
433433
const static struct fw_info orinoco_fw[] = {
434434
{ "", "agere_sta_fw.bin", "agere_ap_fw.bin", 0x00390000, 1000 },
435435
{ "", "prism_sta_fw.bin", "prism_ap_fw.bin", 0, 1024 },
436-
{ "symbol_sp24t_prim_fw", "symbol_sp24t_sec_fw", "", 0x00003100, 0x100 }
436+
{ "symbol_sp24t_prim_fw", "symbol_sp24t_sec_fw", "", 0x00003100, 512 }
437437
};
438438

439439
/* Structure used to access fields in FW
@@ -458,7 +458,7 @@ orinoco_dl_firmware(struct orinoco_private *priv,
458458
int ap)
459459
{
460460
/* Plug Data Area (PDA) */
461-
__le16 pda[512] = { 0 };
461+
__le16 *pda;
462462

463463
hermes_t *hw = &priv->hw;
464464
const struct firmware *fw_entry;
@@ -467,7 +467,11 @@ orinoco_dl_firmware(struct orinoco_private *priv,
467467
const unsigned char *end;
468468
const char *firmware;
469469
struct net_device *dev = priv->ndev;
470-
int err;
470+
int err = 0;
471+
472+
pda = kzalloc(fw->pda_size, GFP_KERNEL);
473+
if (!pda)
474+
return -ENOMEM;
471475

472476
if (ap)
473477
firmware = fw->ap_fw;
@@ -478,17 +482,17 @@ orinoco_dl_firmware(struct orinoco_private *priv,
478482
dev->name, firmware);
479483

480484
/* Read current plug data */
481-
err = hermes_read_pda(hw, pda, fw->pda_addr,
482-
min_t(u16, fw->pda_size, sizeof(pda)), 0);
485+
err = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 0);
483486
printk(KERN_DEBUG "%s: Read PDA returned %d\n", dev->name, err);
484487
if (err)
485-
return err;
488+
goto free;
486489

487490
err = request_firmware(&fw_entry, firmware, priv->dev);
488491
if (err) {
489492
printk(KERN_ERR "%s: Cannot find firmware %s\n",
490493
dev->name, firmware);
491-
return -ENOENT;
494+
err = -ENOENT;
495+
goto free;
492496
}
493497

494498
hdr = (const struct orinoco_fw_header *) fw_entry->data;
@@ -532,6 +536,9 @@ orinoco_dl_firmware(struct orinoco_private *priv,
532536

533537
abort:
534538
release_firmware(fw_entry);
539+
540+
free:
541+
kfree(pda);
535542
return err;
536543
}
537544

@@ -549,12 +556,12 @@ symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw,
549556
int secondary)
550557
{
551558
hermes_t *hw = &priv->hw;
552-
int ret;
559+
int ret = 0;
553560
const unsigned char *ptr;
554561
const unsigned char *first_block;
555562

556563
/* Plug Data Area (PDA) */
557-
__le16 pda[256];
564+
__le16 *pda = NULL;
558565

559566
/* Binary block begins after the 0x1A marker */
560567
ptr = image;
@@ -563,28 +570,33 @@ symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw,
563570

564571
/* Read the PDA from EEPROM */
565572
if (secondary) {
566-
ret = hermes_read_pda(hw, pda, fw->pda_addr, sizeof(pda), 1);
573+
pda = kzalloc(fw->pda_size, GFP_KERNEL);
574+
if (!pda)
575+
return -ENOMEM;
576+
577+
ret = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 1);
567578
if (ret)
568-
return ret;
579+
goto free;
569580
}
570581

571582
/* Stop the firmware, so that it can be safely rewritten */
572583
if (priv->stop_fw) {
573584
ret = priv->stop_fw(priv, 1);
574585
if (ret)
575-
return ret;
586+
goto free;
576587
}
577588

578589
/* Program the adapter with new firmware */
579590
ret = hermes_program(hw, first_block, end);
580591
if (ret)
581-
return ret;
592+
goto free;
582593

583594
/* Write the PDA to the adapter */
584595
if (secondary) {
585596
size_t len = hermes_blocks_length(first_block);
586597
ptr = first_block + len;
587598
ret = hermes_apply_pda(hw, ptr, pda);
599+
kfree(pda);
588600
if (ret)
589601
return ret;
590602
}
@@ -608,6 +620,10 @@ symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw,
608620
return -ENODEV;
609621

610622
return 0;
623+
624+
free:
625+
kfree(pda);
626+
return ret;
611627
}
612628

613629

drivers/net/wireless/p54/p54common.c

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ static int p54_convert_rev1(struct ieee80211_hw *dev,
306306
return 0;
307307
}
308308

309-
static const char *p54_rf_chips[] = { "NULL", "Indigo?", "Duette",
310-
"Frisbee", "Xbow", "Longbow" };
309+
static const char *p54_rf_chips[] = { "NULL", "Duette3", "Duette2",
310+
"Frisbee", "Xbow", "Longbow", "NULL", "NULL" };
311311
static int p54_init_xbow_synth(struct ieee80211_hw *dev);
312312

313313
static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
@@ -319,6 +319,7 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
319319
void *tmp;
320320
int err;
321321
u8 *end = (u8 *)eeprom + len;
322+
u16 synth;
322323
DECLARE_MAC_BUF(mac);
323324

324325
wrap = (struct eeprom_pda_wrap *) eeprom;
@@ -400,8 +401,8 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
400401
tmp = entry->data;
401402
while ((u8 *)tmp < entry->data + data_len) {
402403
struct bootrec_exp_if *exp_if = tmp;
403-
if (le16_to_cpu(exp_if->if_id) == 0xF)
404-
priv->rxhw = le16_to_cpu(exp_if->variant) & 0x07;
404+
if (le16_to_cpu(exp_if->if_id) == 0xf)
405+
synth = le16_to_cpu(exp_if->variant);
405406
tmp += sizeof(struct bootrec_exp_if);
406407
}
407408
break;
@@ -427,22 +428,13 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
427428
goto err;
428429
}
429430

430-
switch (priv->rxhw) {
431-
case 4: /* XBow */
431+
priv->rxhw = synth & 0x07;
432+
if (priv->rxhw == 4)
432433
p54_init_xbow_synth(dev);
433-
case 1: /* Indigo? */
434-
case 2: /* Duette */
435-
dev->wiphy->bands[IEEE80211_BAND_5GHZ] = &band_5GHz;
436-
case 3: /* Frisbee */
437-
case 5: /* Longbow */
434+
if (!(synth & 0x40))
438435
dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band_2GHz;
439-
break;
440-
default:
441-
printk(KERN_ERR "%s: unsupported RF-Chip\n",
442-
wiphy_name(dev->wiphy));
443-
err = -EINVAL;
444-
goto err;
445-
}
436+
if (!(synth & 0x80))
437+
dev->wiphy->bands[IEEE80211_BAND_5GHZ] = &band_5GHz;
446438

447439
if (!is_valid_ether_addr(dev->wiphy->perm_addr)) {
448440
u8 perm_addr[ETH_ALEN];

0 commit comments

Comments
 (0)