diff options
author | Michael Buesch <mb@bu3sch.de> | 2007-12-09 22:34:59 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 15:05:58 -0800 |
commit | 8ed7fc48eb31e583bb31c2bcfdd3a9c557bad5d0 (patch) | |
tree | 43ece4c73d9e563c9a06b8fd7cde8cc8f72bbabb /drivers/net/wireless/b43/tables.c | |
parent | bb54244be7d12c2a5985226061d598edb49c9078 (diff) | |
download | lwn-8ed7fc48eb31e583bb31c2bcfdd3a9c557bad5d0.tar.gz lwn-8ed7fc48eb31e583bb31c2bcfdd3a9c557bad5d0.zip |
b43: Fix ofdmtab write regression
commit f04b3787bbce4567e28069a9ec97dcd804626ac7 introduced
a regression for the ofdmtable writing.
It incorrectly removed the writing of the high 16bits for
a 32bit table write and initialized the direction identifier
too late.
This patch does also some cleanups to make the code much more
readable and adds a few comments, so non rocket scientists are
also able to understand what this address caching is all about.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/tables.c')
-rw-r--r-- | drivers/net/wireless/b43/tables.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/net/wireless/b43/tables.c b/drivers/net/wireless/b43/tables.c index be9c7eb94ac4..fd5595ba5e8b 100644 --- a/drivers/net/wireless/b43/tables.c +++ b/drivers/net/wireless/b43/tables.c @@ -381,13 +381,17 @@ u16 b43_ofdmtab_read16(struct b43_wldev *dev, u16 table, u16 offset) u16 addr; addr = table + offset; - if (addr - 1 != phy->ofdm_addr || phy->ofdm_valid != 1) { + if ((phy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_READ) || + (addr - 1 != phy->ofdmtab_addr)) { + /* The hardware has a different address in memory. Update it. */ b43_phy_write(dev, B43_PHY_OTABLECTL, addr); - phy->ofdm_valid = 1; + phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_READ; } - phy->ofdm_addr = addr; + phy->ofdmtab_addr = addr; return b43_phy_read(dev, B43_PHY_OTABLEI); + + /* Some compiletime assertions... */ assert_sizes(); } @@ -398,11 +402,13 @@ void b43_ofdmtab_write16(struct b43_wldev *dev, u16 table, u16 addr; addr = table + offset; - if (addr - 1 != phy->ofdm_addr || phy->ofdm_valid != 2) { + if ((phy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_WRITE) || + (addr -1 != phy->ofdmtab_addr)) { + /* The hardware has a different address in memory. Update it. */ b43_phy_write(dev, B43_PHY_OTABLECTL, addr); - phy->ofdm_valid = 2; + phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_WRITE; } - phy->ofdm_addr = addr; + phy->ofdmtab_addr = addr; b43_phy_write(dev, B43_PHY_OTABLEI, value); } @@ -413,11 +419,13 @@ u32 b43_ofdmtab_read32(struct b43_wldev *dev, u16 table, u16 offset) u16 addr; addr = table + offset; - if (addr - 1 != phy->ofdm_addr || phy->ofdm_valid != 1) { + if ((phy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_READ) || + (addr - 1 != phy->ofdmtab_addr)) { + /* The hardware has a different address in memory. Update it. */ b43_phy_write(dev, B43_PHY_OTABLECTL, addr); - phy->ofdm_valid = 1; + phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_READ; } - phy->ofdm_addr = addr; + phy->ofdmtab_addr = addr; ret = b43_phy_read(dev, B43_PHY_OTABLEQ); ret <<= 16; ret |= b43_phy_read(dev, B43_PHY_OTABLEI); @@ -432,13 +440,16 @@ void b43_ofdmtab_write32(struct b43_wldev *dev, u16 table, u16 addr; addr = table + offset; - if (addr - 1 != phy->ofdm_addr || phy->ofdm_valid != 2) { + if ((phy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_WRITE) || + (addr - 1 != phy->ofdmtab_addr)) { + /* The hardware has a different address in memory. Update it. */ b43_phy_write(dev, B43_PHY_OTABLECTL, addr); - phy->ofdm_valid = 2; + phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_WRITE; } - phy->ofdm_addr = addr; + phy->ofdmtab_addr = addr; b43_phy_write(dev, B43_PHY_OTABLEI, value); + b43_phy_write(dev, B43_PHY_OTABLEQ, (value >> 16)); } u16 b43_gtab_read(struct b43_wldev *dev, u16 table, u16 offset) |