Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134147
b: refs/heads/master
c: 39c3c2f
h: refs/heads/master
i:
  134145: 152d331
  134143: 2deca3f
v: v3
  • Loading branch information
Gabor Juhos authored and John W. Linville committed Jan 29, 2009
1 parent 73981f7 commit ecc1262
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 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: 88d15707644fad1a137af7a17b00da6135f1c1a8
refs/heads/master: 39c3c2f2de6bccf698bfb5b9c4f56ddf99de0dbc
7 changes: 7 additions & 0 deletions trunk/drivers/net/wireless/ath9k/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ enum PROT_MODE {

struct ath_bus_ops {
void (*read_cachesize)(struct ath_softc *sc, int *csz);
void (*cleanup)(struct ath_softc *sc);
};

struct ath_softc {
Expand All @@ -704,6 +705,7 @@ struct ath_softc {
struct tasklet_struct bcon_tasklet;
struct ath_hal *sc_ah;
void __iomem *mem;
int irq;
spinlock_t sc_resetlock;
struct mutex mutex;

Expand Down Expand Up @@ -760,4 +762,9 @@ static inline void ath_read_cachesize(struct ath_softc *sc, int *csz)
sc->bus_ops->read_cachesize(sc, csz);
}

static inline void ath_bus_cleanup(struct ath_softc *sc)
{
sc->bus_ops->cleanup(sc);
}

#endif /* CORE_H */
37 changes: 23 additions & 14 deletions trunk/drivers/net/wireless/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static struct pci_device_id ath_pci_id_table[] __devinitdata = {
};

static void ath_detach(struct ath_softc *sc);
static void ath_cleanup(struct ath_softc *sc);

/* return bus cachesize in 4B word units */

Expand Down Expand Up @@ -1267,13 +1268,7 @@ static int ath_start_rfkill_poll(struct ath_softc *sc)
rfkill_free(sc->rf_kill.rfkill);

/* Deinitialize the device */
ath_detach(sc);
if (to_pci_dev(sc->dev)->irq)
free_irq(to_pci_dev(sc->dev)->irq, sc);
pci_iounmap(to_pci_dev(sc->dev), sc->mem);
pci_release_region(to_pci_dev(sc->dev), 0);
pci_disable_device(to_pci_dev(sc->dev));
ieee80211_free_hw(sc->hw);
ath_cleanup(sc);
return -EIO;
} else {
sc->sc_flags |= SC_OP_RFKILL_REGISTERED;
Expand All @@ -1284,6 +1279,14 @@ static int ath_start_rfkill_poll(struct ath_softc *sc)
}
#endif /* CONFIG_RFKILL */

static void ath_cleanup(struct ath_softc *sc)
{
ath_detach(sc);
free_irq(sc->irq, sc);
ath_bus_cleanup(sc);
ieee80211_free_hw(sc->hw);
}

static void ath_detach(struct ath_softc *sc)
{
struct ieee80211_hw *hw = sc->hw;
Expand Down Expand Up @@ -2534,8 +2537,18 @@ ath_rf_name(u16 rf_version)
return "????";
}

static void ath_pci_cleanup(struct ath_softc *sc)
{
struct pci_dev *pdev = to_pci_dev(sc->dev);

pci_iounmap(pdev, sc->mem);
pci_release_region(pdev, 0);
pci_disable_device(pdev);
}

static struct ath_bus_ops ath_pci_bus_ops = {
.read_cachesize = ath_pci_read_cachesize,
.cleanup = ath_pci_cleanup,
};

static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
Expand Down Expand Up @@ -2642,6 +2655,8 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto bad4;
}

sc->irq = pdev->irq;

ah = sc->sc_ah;
printk(KERN_INFO
"%s: Atheros AR%s MAC/BB Rev:%x "
Expand Down Expand Up @@ -2672,13 +2687,7 @@ static void ath_pci_remove(struct pci_dev *pdev)
struct ieee80211_hw *hw = pci_get_drvdata(pdev);
struct ath_softc *sc = hw->priv;

ath_detach(sc);
if (pdev->irq)
free_irq(pdev->irq, sc);
pci_iounmap(pdev, sc->mem);
pci_release_region(pdev, 0);
pci_disable_device(pdev);
ieee80211_free_hw(hw);
ath_cleanup(sc);
}

#ifdef CONFIG_PM
Expand Down

0 comments on commit ecc1262

Please sign in to comment.