From 3718582a663e035af5d2634cd537a012e20cdb3f Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Fri, 20 Feb 2009 19:30:10 +0100 Subject: [PATCH] b43: Convert usage of b43_radio_mask() This patch converts code to use the new b43_radio_mask() API. The semantic patch that makes this change is as follows: // @@ expression dev, addr, mask; @@ -b43_radio_write16(dev, addr, b43_radio_read16(dev, addr) & mask); +b43_radio_mask(dev, addr, mask); // Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- drivers/net/wireless/b43/lo.c | 6 ++---- drivers/net/wireless/b43/phy_a.c | 23 ++++++++++------------- drivers/net/wireless/b43/phy_g.c | 16 +++++----------- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/drivers/net/wireless/b43/lo.c b/drivers/net/wireless/b43/lo.c index c5e07fc2d069..70c39bbbcf1f 100644 --- a/drivers/net/wireless/b43/lo.c +++ b/drivers/net/wireless/b43/lo.c @@ -231,8 +231,7 @@ static void lo_measure_txctl_values(struct b43_wldev *dev) reg = lo_txctl_register_table(dev, &mask, NULL); mask = ~mask; - b43_radio_write16(dev, reg, b43_radio_read16(dev, reg) - & mask); + b43_radio_mask(dev, reg, mask); if (has_tx_magnification(phy)) { int i, j; @@ -269,8 +268,7 @@ static void lo_measure_txctl_values(struct b43_wldev *dev) } else { lo->tx_magn = 0; lo->tx_bias = 0; - b43_radio_write16(dev, 0x52, b43_radio_read16(dev, 0x52) - & 0xFFF0); /* TX bias == 0 */ + b43_radio_mask(dev, 0x52, 0xFFF0); /* TX bias == 0 */ } lo->txctl_measured_time = jiffies; } diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c index b07df38d5c21..4f052ebf06da 100644 --- a/drivers/net/wireless/b43/phy_a.c +++ b/drivers/net/wireless/b43/phy_a.c @@ -134,12 +134,10 @@ static void aphy_channel_switch(struct b43_wldev *dev, unsigned int channel) b43_radio_write16(dev, 0x003A, (b43_radio_read16(dev, 0x003A) & 0xFF20) | freq_r3A_value(freq)); - b43_radio_write16(dev, 0x003D, - b43_radio_read16(dev, 0x003D) & 0x00FF); + b43_radio_mask(dev, 0x003D, 0x00FF); b43_radio_write16(dev, 0x0081, (b43_radio_read16(dev, 0x0081) & 0xFF7F) | 0x0080); - b43_radio_write16(dev, 0x0035, - b43_radio_read16(dev, 0x0035) & 0xFFEF); + b43_radio_mask(dev, 0x0035, 0xFFEF); b43_radio_write16(dev, 0x0035, (b43_radio_read16(dev, 0x0035) & 0xFFEF) | 0x0010); b43_radio_set_tx_iq(dev); @@ -160,10 +158,10 @@ static void b43_radio_init2060(struct b43_wldev *dev) b43_radio_write16(dev, 0x0082, 0x0080); b43_radio_write16(dev, 0x0080, 0x0000); b43_radio_write16(dev, 0x003F, 0x00DA); - b43_radio_write16(dev, 0x0005, b43_radio_read16(dev, 0x0005) & ~0x0008); - b43_radio_write16(dev, 0x0081, b43_radio_read16(dev, 0x0081) & ~0x0010); - b43_radio_write16(dev, 0x0081, b43_radio_read16(dev, 0x0081) & ~0x0020); - b43_radio_write16(dev, 0x0081, b43_radio_read16(dev, 0x0081) & ~0x0020); + b43_radio_mask(dev, 0x0005, ~0x0008); + b43_radio_mask(dev, 0x0081, ~0x0010); + b43_radio_mask(dev, 0x0081, ~0x0020); + b43_radio_mask(dev, 0x0081, ~0x0020); msleep(1); /* delay 400usec */ b43_radio_write16(dev, 0x0081, @@ -172,9 +170,9 @@ static void b43_radio_init2060(struct b43_wldev *dev) b43_radio_write16(dev, 0x0005, (b43_radio_read16(dev, 0x0005) & ~0x0008) | 0x0008); - b43_radio_write16(dev, 0x0085, b43_radio_read16(dev, 0x0085) & ~0x0010); - b43_radio_write16(dev, 0x0005, b43_radio_read16(dev, 0x0005) & ~0x0008); - b43_radio_write16(dev, 0x0081, b43_radio_read16(dev, 0x0081) & ~0x0040); + b43_radio_mask(dev, 0x0085, ~0x0010); + b43_radio_mask(dev, 0x0005, ~0x0008); + b43_radio_mask(dev, 0x0081, ~0x0040); b43_radio_write16(dev, 0x0081, (b43_radio_read16(dev, 0x0081) & ~0x0040) | 0x0040); b43_radio_write16(dev, 0x0005, @@ -247,8 +245,7 @@ static void b43_phy_ww(struct b43_wldev *dev) best_s = curr_s; } b43_phy_write(dev, B43_PHY_PWRDOWN, b); - b43_radio_write16(dev, 0x0004, - b43_radio_read16(dev, 0x0004) & 0xFFFB); + b43_radio_mask(dev, 0x0004, 0xFFFB); b43_radio_write16(dev, 0x0013, best_s); b43_ofdmtab_write16(dev, B43_OFDMTAB_AGC1_R1, 0, 0xFFEC); b43_phy_write(dev, B43_PHY_OFDM(0xB7), 0x1E80); diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c index c8e4342cbd0f..8bad858c2d7a 100644 --- a/drivers/net/wireless/b43/phy_g.c +++ b/drivers/net/wireless/b43/phy_g.c @@ -489,8 +489,7 @@ static void b43_calc_nrssi_offset(struct b43_wldev *dev) if (saved == 0xFFFF) saved = 4; } else { - b43_radio_write16(dev, 0x007A, - b43_radio_read16(dev, 0x007A) & 0x007F); + b43_radio_mask(dev, 0x007A, 0x007F); if (phy->rev != 1) { /* Not in specs, but needed to prevent PPC machine check */ b43_phy_set(dev, 0x0814, 0x0001); b43_phy_mask(dev, 0x0815, 0xFFFE); @@ -626,8 +625,7 @@ static void b43_calc_nrssi_slope(struct b43_wldev *dev) } b43_radio_set(dev, 0x007A, 0x0070); b43_set_all_gains(dev, 0, 8, 0); - b43_radio_write16(dev, 0x007A, - b43_radio_read16(dev, 0x007A) & 0x00F7); + b43_radio_mask(dev, 0x007A, 0x00F7); if (phy->rev >= 2) { b43_phy_maskset(dev, 0x0811, 0xFFCF, 0x0030); b43_phy_maskset(dev, 0x0812, 0xFFCF, 0x0010); @@ -639,8 +637,7 @@ static void b43_calc_nrssi_slope(struct b43_wldev *dev) if (nrssi0 >= 0x0020) nrssi0 -= 0x0040; - b43_radio_write16(dev, 0x007A, - b43_radio_read16(dev, 0x007A) & 0x007F); + b43_radio_mask(dev, 0x007A, 0x007F); if (phy->rev >= 2) { b43_phy_maskset(dev, 0x0003, 0xFF9F, 0x0040); } @@ -1803,8 +1800,7 @@ static void b43_calc_loopback_gain(struct b43_wldev *dev) b43_phy_set(dev, B43_PHY_RFOVERVAL, 0x8000); } } - b43_radio_write16(dev, 0x7A, b43_radio_read16(dev, 0x7A) - & 0x00F7); + b43_radio_mask(dev, 0x7A, 0x00F7); j = 0; loop_i_max = (phy->radio_rev == 8) ? 15 : 9; @@ -1992,9 +1988,7 @@ static void b43_phy_init_pctl(struct b43_wldev *dev) } } if (phy->radio_ver == 0x2050 && phy->analog == 0) { - b43_radio_write16(dev, 0x0076, - b43_radio_read16(dev, 0x0076) - & 0xFF7B); + b43_radio_mask(dev, 0x0076, 0xFF7B); } else { b43_set_txpower_g(dev, &old_bbatt, &old_rfatt, old_tx_control); -- 2.30.2