summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/phy_a.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-09-02 13:00:34 +0200
committerJohn W. Linville <linville@tuxdriver.com>2008-09-05 16:17:49 -0400
commitfb11137af83b7b66c7aab8dbc5f09d2c95684fed (patch)
tree08251ad486eb4c115f56ee4ddfb56a80c2d7c287 /drivers/net/wireless/b43/phy_a.c
parent7cb770729ba895f73253dfcd46c3fcba45d896f9 (diff)
b43: Split PHY alloc and init
This splits the PHY allocation from the PHY init. This is needed in order to properly support Analog handling. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/phy_a.c')
-rw-r--r--drivers/net/wireless/b43/phy_a.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
index 2ca8353aa9a..c9f00ace46a 100644
--- a/drivers/net/wireless/b43/phy_a.c
+++ b/drivers/net/wireless/b43/phy_a.c
@@ -391,8 +391,6 @@ static int b43_aphy_op_allocate(struct b43_wldev *dev)
return -ENOMEM;
dev->phy.a = aphy;
- //TODO init struct b43_phy_a
-
err = b43_aphy_init_tssi2dbm_table(dev);
if (err)
goto err_free_aphy;
@@ -406,30 +404,47 @@ err_free_aphy:
return err;
}
-static int b43_aphy_op_init(struct b43_wldev *dev)
+static void b43_aphy_op_prepare_structs(struct b43_wldev *dev)
{
- struct b43_phy_a *aphy = dev->phy.a;
+ struct b43_phy *phy = &dev->phy;
+ struct b43_phy_a *aphy = phy->a;
+ const void *tssi2dbm;
+ int tgt_idle_tssi;
- b43_phy_inita(dev);
- aphy->initialised = 1;
+ /* tssi2dbm table is constant, so it is initialized at alloc time.
+ * Save a copy of the pointer. */
+ tssi2dbm = aphy->tssi2dbm;
+ tgt_idle_tssi = aphy->tgt_idle_tssi;
+
+ /* Zero out the whole PHY structure. */
+ memset(aphy, 0, sizeof(*aphy));
+
+ aphy->tssi2dbm = tssi2dbm;
+ aphy->tgt_idle_tssi = tgt_idle_tssi;
+
+ //TODO init struct b43_phy_a
- return 0;
}
-static void b43_aphy_op_exit(struct b43_wldev *dev)
+static void b43_aphy_op_free(struct b43_wldev *dev)
{
- struct b43_phy_a *aphy = dev->phy.a;
+ struct b43_phy *phy = &dev->phy;
+ struct b43_phy_a *aphy = phy->a;
- if (aphy->initialised) {
- //TODO
- aphy->initialised = 0;
- }
- //TODO
kfree(aphy->tssi2dbm);
+ aphy->tssi2dbm = NULL;
+
kfree(aphy);
dev->phy.a = NULL;
}
+static int b43_aphy_op_init(struct b43_wldev *dev)
+{
+ b43_phy_inita(dev);
+
+ return 0;
+}
+
static inline u16 adjust_phyreg(struct b43_wldev *dev, u16 offset)
{
/* OFDM registers are base-registers for the A-PHY. */
@@ -608,8 +623,9 @@ static void b43_aphy_op_pwork_60sec(struct b43_wldev *dev)
const struct b43_phy_operations b43_phyops_a = {
.allocate = b43_aphy_op_allocate,
+ .free = b43_aphy_op_free,
+ .prepare_structs = b43_aphy_op_prepare_structs,
.init = b43_aphy_op_init,
- .exit = b43_aphy_op_exit,
.phy_read = b43_aphy_op_read,
.phy_write = b43_aphy_op_write,
.radio_read = b43_aphy_op_radio_read,