Commit 5fbbe378 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Kalle Valo

rt2x00: convert rt2*_bbp_read return type

This is a semi-automated conversion to change *_bbp_read()
to return the register contents instead of passing them by value,
resulting in much better object code. The majority of the patch
was done using:

sed -i 's:\(\<rt.*_bbp_read\>(.*, .*\), &\(.*\));:\2 = \1);:' \
    -i 's:\(\<rt.*_bbp_dcoc_read\>(.*, .*\), &\(.*\));:\2 = \1);:' \
    -i 's:= _\(rt.*_bbp_read\):\1:' drivers/net/wireless/ralink/rt2x00/*
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent eebd68e7
...@@ -77,10 +77,11 @@ static void rt2400pci_bbp_write(struct rt2x00_dev *rt2x00dev, ...@@ -77,10 +77,11 @@ static void rt2400pci_bbp_write(struct rt2x00_dev *rt2x00dev,
mutex_unlock(&rt2x00dev->csr_mutex); mutex_unlock(&rt2x00dev->csr_mutex);
} }
static void rt2400pci_bbp_read(struct rt2x00_dev *rt2x00dev, static u8 rt2400pci_bbp_read(struct rt2x00_dev *rt2x00dev,
const unsigned int word, u8 *value) const unsigned int word)
{ {
u32 reg; u32 reg;
u8 value;
mutex_lock(&rt2x00dev->csr_mutex); mutex_lock(&rt2x00dev->csr_mutex);
...@@ -103,9 +104,11 @@ static void rt2400pci_bbp_read(struct rt2x00_dev *rt2x00dev, ...@@ -103,9 +104,11 @@ static void rt2400pci_bbp_read(struct rt2x00_dev *rt2x00dev,
WAIT_FOR_BBP(rt2x00dev, &reg); WAIT_FOR_BBP(rt2x00dev, &reg);
} }
*value = rt2x00_get_field32(reg, BBPCSR_VALUE); value = rt2x00_get_field32(reg, BBPCSR_VALUE);
mutex_unlock(&rt2x00dev->csr_mutex); mutex_unlock(&rt2x00dev->csr_mutex);
return value;
} }
static void rt2400pci_rf_write(struct rt2x00_dev *rt2x00dev, static void rt2400pci_rf_write(struct rt2x00_dev *rt2x00dev,
...@@ -164,16 +167,6 @@ static void rt2400pci_eepromregister_write(struct eeprom_93cx6 *eeprom) ...@@ -164,16 +167,6 @@ static void rt2400pci_eepromregister_write(struct eeprom_93cx6 *eeprom)
} }
#ifdef CONFIG_RT2X00_LIB_DEBUGFS #ifdef CONFIG_RT2X00_LIB_DEBUGFS
static u8 _rt2400pci_bbp_read(struct rt2x00_dev *rt2x00dev,
const unsigned int word)
{
u8 value;
rt2400pci_bbp_read(rt2x00dev, word, &value);
return value;
}
static const struct rt2x00debug rt2400pci_rt2x00debug = { static const struct rt2x00debug rt2400pci_rt2x00debug = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.csr = { .csr = {
...@@ -192,7 +185,7 @@ static const struct rt2x00debug rt2400pci_rt2x00debug = { ...@@ -192,7 +185,7 @@ static const struct rt2x00debug rt2400pci_rt2x00debug = {
.word_count = EEPROM_SIZE / sizeof(u16), .word_count = EEPROM_SIZE / sizeof(u16),
}, },
.bbp = { .bbp = {
.read = _rt2400pci_bbp_read, .read = rt2400pci_bbp_read,
.write = rt2400pci_bbp_write, .write = rt2400pci_bbp_write,
.word_base = BBP_BASE, .word_base = BBP_BASE,
.word_size = sizeof(u8), .word_size = sizeof(u8),
...@@ -418,8 +411,8 @@ static void rt2400pci_config_ant(struct rt2x00_dev *rt2x00dev, ...@@ -418,8 +411,8 @@ static void rt2400pci_config_ant(struct rt2x00_dev *rt2x00dev,
BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY || BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
ant->tx == ANTENNA_SW_DIVERSITY); ant->tx == ANTENNA_SW_DIVERSITY);
rt2400pci_bbp_read(rt2x00dev, 4, &r4); r4 = rt2400pci_bbp_read(rt2x00dev, 4);
rt2400pci_bbp_read(rt2x00dev, 1, &r1); r1 = rt2400pci_bbp_read(rt2x00dev, 1);
/* /*
* Configure the TX antenna. * Configure the TX antenna.
...@@ -600,7 +593,7 @@ static void rt2400pci_link_stats(struct rt2x00_dev *rt2x00dev, ...@@ -600,7 +593,7 @@ static void rt2400pci_link_stats(struct rt2x00_dev *rt2x00dev,
/* /*
* Update False CCA count from register. * Update False CCA count from register.
*/ */
rt2400pci_bbp_read(rt2x00dev, 39, &bbp); bbp = rt2400pci_bbp_read(rt2x00dev, 39);
qual->false_cca = bbp; qual->false_cca = bbp;
} }
...@@ -921,7 +914,7 @@ static int rt2400pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) ...@@ -921,7 +914,7 @@ static int rt2400pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)
u8 value; u8 value;
for (i = 0; i < REGISTER_BUSY_COUNT; i++) { for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
rt2400pci_bbp_read(rt2x00dev, 0, &value); value = rt2400pci_bbp_read(rt2x00dev, 0);
if ((value != 0xff) && (value != 0x00)) if ((value != 0xff) && (value != 0x00))
return 0; return 0;
udelay(REGISTER_BUSY_DELAY); udelay(REGISTER_BUSY_DELAY);
......
...@@ -77,10 +77,11 @@ static void rt2500pci_bbp_write(struct rt2x00_dev *rt2x00dev, ...@@ -77,10 +77,11 @@ static void rt2500pci_bbp_write(struct rt2x00_dev *rt2x00dev,
mutex_unlock(&rt2x00dev->csr_mutex); mutex_unlock(&rt2x00dev->csr_mutex);
} }
static void rt2500pci_bbp_read(struct rt2x00_dev *rt2x00dev, static u8 rt2500pci_bbp_read(struct rt2x00_dev *rt2x00dev,
const unsigned int word, u8 *value) const unsigned int word)
{ {
u32 reg; u32 reg;
u8 value;
mutex_lock(&rt2x00dev->csr_mutex); mutex_lock(&rt2x00dev->csr_mutex);
...@@ -103,9 +104,11 @@ static void rt2500pci_bbp_read(struct rt2x00_dev *rt2x00dev, ...@@ -103,9 +104,11 @@ static void rt2500pci_bbp_read(struct rt2x00_dev *rt2x00dev,
WAIT_FOR_BBP(rt2x00dev, &reg); WAIT_FOR_BBP(rt2x00dev, &reg);
} }
*value = rt2x00_get_field32(reg, BBPCSR_VALUE); value = rt2x00_get_field32(reg, BBPCSR_VALUE);
mutex_unlock(&rt2x00dev->csr_mutex); mutex_unlock(&rt2x00dev->csr_mutex);
return value;
} }
static void rt2500pci_rf_write(struct rt2x00_dev *rt2x00dev, static void rt2500pci_rf_write(struct rt2x00_dev *rt2x00dev,
...@@ -164,16 +167,6 @@ static void rt2500pci_eepromregister_write(struct eeprom_93cx6 *eeprom) ...@@ -164,16 +167,6 @@ static void rt2500pci_eepromregister_write(struct eeprom_93cx6 *eeprom)
} }
#ifdef CONFIG_RT2X00_LIB_DEBUGFS #ifdef CONFIG_RT2X00_LIB_DEBUGFS
static u8 _rt2500pci_bbp_read(struct rt2x00_dev *rt2x00dev,
const unsigned int word)
{
u8 value;
rt2500pci_bbp_read(rt2x00dev, word, &value);
return value;
}
static const struct rt2x00debug rt2500pci_rt2x00debug = { static const struct rt2x00debug rt2500pci_rt2x00debug = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.csr = { .csr = {
...@@ -192,7 +185,7 @@ static const struct rt2x00debug rt2500pci_rt2x00debug = { ...@@ -192,7 +185,7 @@ static const struct rt2x00debug rt2500pci_rt2x00debug = {
.word_count = EEPROM_SIZE / sizeof(u16), .word_count = EEPROM_SIZE / sizeof(u16),
}, },
.bbp = { .bbp = {
.read = _rt2500pci_bbp_read, .read = rt2500pci_bbp_read,
.write = rt2500pci_bbp_write, .write = rt2500pci_bbp_write,
.word_base = BBP_BASE, .word_base = BBP_BASE,
.word_size = sizeof(u8), .word_size = sizeof(u8),
...@@ -426,8 +419,8 @@ static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev, ...@@ -426,8 +419,8 @@ static void rt2500pci_config_ant(struct rt2x00_dev *rt2x00dev,
ant->tx == ANTENNA_SW_DIVERSITY); ant->tx == ANTENNA_SW_DIVERSITY);
reg = rt2x00mmio_register_read(rt2x00dev, BBPCSR1); reg = rt2x00mmio_register_read(rt2x00dev, BBPCSR1);
rt2500pci_bbp_read(rt2x00dev, 14, &r14); r14 = rt2500pci_bbp_read(rt2x00dev, 14);
rt2500pci_bbp_read(rt2x00dev, 2, &r2); r2 = rt2500pci_bbp_read(rt2x00dev, 2);
/* /*
* Configure the TX antenna. * Configure the TX antenna.
...@@ -1059,7 +1052,7 @@ static int rt2500pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) ...@@ -1059,7 +1052,7 @@ static int rt2500pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)
u8 value; u8 value;
for (i = 0; i < REGISTER_BUSY_COUNT; i++) { for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
rt2500pci_bbp_read(rt2x00dev, 0, &value); value = rt2500pci_bbp_read(rt2x00dev, 0);
if ((value != 0xff) && (value != 0x00)) if ((value != 0xff) && (value != 0x00))
return 0; return 0;
udelay(REGISTER_BUSY_DELAY); udelay(REGISTER_BUSY_DELAY);
......
...@@ -153,10 +153,11 @@ static void rt2500usb_bbp_write(struct rt2x00_dev *rt2x00dev, ...@@ -153,10 +153,11 @@ static void rt2500usb_bbp_write(struct rt2x00_dev *rt2x00dev,
mutex_unlock(&rt2x00dev->csr_mutex); mutex_unlock(&rt2x00dev->csr_mutex);
} }
static void rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev, static u8 rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev,
const unsigned int word, u8 *value) const unsigned int word)
{ {
u16 reg; u16 reg;
u8 value;
mutex_lock(&rt2x00dev->csr_mutex); mutex_lock(&rt2x00dev->csr_mutex);
...@@ -179,9 +180,11 @@ static void rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev, ...@@ -179,9 +180,11 @@ static void rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev,
reg = rt2500usb_register_read_lock(rt2x00dev, PHY_CSR7); reg = rt2500usb_register_read_lock(rt2x00dev, PHY_CSR7);
} }
*value = rt2x00_get_field16(reg, PHY_CSR7_DATA); value = rt2x00_get_field16(reg, PHY_CSR7_DATA);
mutex_unlock(&rt2x00dev->csr_mutex); mutex_unlock(&rt2x00dev->csr_mutex);
return value;
} }
static void rt2500usb_rf_write(struct rt2x00_dev *rt2x00dev, static void rt2500usb_rf_write(struct rt2x00_dev *rt2x00dev,
...@@ -227,16 +230,6 @@ static void _rt2500usb_register_write(struct rt2x00_dev *rt2x00dev, ...@@ -227,16 +230,6 @@ static void _rt2500usb_register_write(struct rt2x00_dev *rt2x00dev,
rt2500usb_register_write(rt2x00dev, offset, value); rt2500usb_register_write(rt2x00dev, offset, value);
} }
static u8 _rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev,
const unsigned int word)
{
u8 value;
rt2500usb_bbp_read(rt2x00dev, word, &value);
return value;
}
static const struct rt2x00debug rt2500usb_rt2x00debug = { static const struct rt2x00debug rt2500usb_rt2x00debug = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.csr = { .csr = {
...@@ -255,7 +248,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = { ...@@ -255,7 +248,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = {
.word_count = EEPROM_SIZE / sizeof(u16), .word_count = EEPROM_SIZE / sizeof(u16),
}, },
.bbp = { .bbp = {
.read = _rt2500usb_bbp_read, .read = rt2500usb_bbp_read,
.write = rt2500usb_bbp_write, .write = rt2500usb_bbp_write,
.word_base = BBP_BASE, .word_base = BBP_BASE,
.word_size = sizeof(u8), .word_size = sizeof(u8),
...@@ -530,8 +523,8 @@ static void rt2500usb_config_ant(struct rt2x00_dev *rt2x00dev, ...@@ -530,8 +523,8 @@ static void rt2500usb_config_ant(struct rt2x00_dev *rt2x00dev,
BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY || BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
ant->tx == ANTENNA_SW_DIVERSITY); ant->tx == ANTENNA_SW_DIVERSITY);
rt2500usb_bbp_read(rt2x00dev, 2, &r2); r2 = rt2500usb_bbp_read(rt2x00dev, 2);
rt2500usb_bbp_read(rt2x00dev, 14, &r14); r14 = rt2500usb_bbp_read(rt2x00dev, 14);
csr5 = rt2500usb_register_read(rt2x00dev, PHY_CSR5); csr5 = rt2500usb_register_read(rt2x00dev, PHY_CSR5);
csr6 = rt2500usb_register_read(rt2x00dev, PHY_CSR6); csr6 = rt2500usb_register_read(rt2x00dev, PHY_CSR6);
...@@ -903,7 +896,7 @@ static int rt2500usb_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) ...@@ -903,7 +896,7 @@ static int rt2500usb_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)
u8 value; u8 value;
for (i = 0; i < REGISTER_USB_BUSY_COUNT; i++) { for (i = 0; i < REGISTER_USB_BUSY_COUNT; i++) {
rt2500usb_bbp_read(rt2x00dev, 0, &value); value = rt2500usb_bbp_read(rt2x00dev, 0);
if ((value != 0xff) && (value != 0x00)) if ((value != 0xff) && (value != 0x00))
return 0; return 0;
udelay(REGISTER_BUSY_DELAY); udelay(REGISTER_BUSY_DELAY);
...@@ -1391,7 +1384,7 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev) ...@@ -1391,7 +1384,7 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
* Switch lower vgc bound to current BBP R17 value, * Switch lower vgc bound to current BBP R17 value,
* lower the value a bit for better quality. * lower the value a bit for better quality.
*/ */
rt2500usb_bbp_read(rt2x00dev, 17, &bbp); bbp = rt2500usb_bbp_read(rt2x00dev, 17);
bbp -= 6; bbp -= 6;
rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_VGC, &word); rt2x00_eeprom_read(rt2x00dev, EEPROM_BBPTUNE_VGC, &word);
......
...@@ -86,10 +86,11 @@ static void rt61pci_bbp_write(struct rt2x00_dev *rt2x00dev, ...@@ -86,10 +86,11 @@ static void rt61pci_bbp_write(struct rt2x00_dev *rt2x00dev,
mutex_unlock(&rt2x00dev->csr_mutex); mutex_unlock(&rt2x00dev->csr_mutex);
} }
static void rt61pci_bbp_read(struct rt2x00_dev *rt2x00dev, static u8 rt61pci_bbp_read(struct rt2x00_dev *rt2x00dev,
const unsigned int word, u8 *value) const unsigned int word)
{ {
u32 reg; u32 reg;
u8 value;
mutex_lock(&rt2x00dev->csr_mutex); mutex_lock(&rt2x00dev->csr_mutex);
...@@ -112,9 +113,11 @@ static void rt61pci_bbp_read(struct rt2x00_dev *rt2x00dev, ...@@ -112,9 +113,11 @@ static void rt61pci_bbp_read(struct rt2x00_dev *rt2x00dev,
WAIT_FOR_BBP(rt2x00dev, &reg); WAIT_FOR_BBP(rt2x00dev, &reg);
} }
*value = rt2x00_get_field32(reg, PHY_CSR3_VALUE); value = rt2x00_get_field32(reg, PHY_CSR3_VALUE);
mutex_unlock(&rt2x00dev->csr_mutex); mutex_unlock(&rt2x00dev->csr_mutex);
return value;
} }
static void rt61pci_rf_write(struct rt2x00_dev *rt2x00dev, static void rt61pci_rf_write(struct rt2x00_dev *rt2x00dev,
...@@ -202,15 +205,6 @@ static void rt61pci_eepromregister_write(struct eeprom_93cx6 *eeprom) ...@@ -202,15 +205,6 @@ static void rt61pci_eepromregister_write(struct eeprom_93cx6 *eeprom)
} }
#ifdef CONFIG_RT2X00_LIB_DEBUGFS #ifdef CONFIG_RT2X00_LIB_DEBUGFS
static u8 _rt61pci_bbp_read(struct rt2x00_dev *rt2x00dev, const unsigned int word)
{
u8 value;
rt61pci_bbp_read(rt2x00dev, word, &value);
return value;
}
static const struct rt2x00debug rt61pci_rt2x00debug = { static const struct rt2x00debug rt61pci_rt2x00debug = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.csr = { .csr = {
...@@ -229,7 +223,7 @@ static const struct rt2x00debug rt61pci_rt2x00debug = { ...@@ -229,7 +223,7 @@ static const struct rt2x00debug rt61pci_rt2x00debug = {
.word_count = EEPROM_SIZE / sizeof(u16), .word_count = EEPROM_SIZE / sizeof(u16),
}, },
.bbp = { .bbp = {
.read = _rt61pci_bbp_read, .read = rt61pci_bbp_read,
.write = rt61pci_bbp_write, .write = rt61pci_bbp_write,
.word_base = BBP_BASE, .word_base = BBP_BASE,
.word_size = sizeof(u8), .word_size = sizeof(u8),
...@@ -639,9 +633,9 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, ...@@ -639,9 +633,9 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
u8 r4; u8 r4;
u8 r77; u8 r77;
rt61pci_bbp_read(rt2x00dev, 3, &r3); r3 = rt61pci_bbp_read(rt2x00dev, 3);
rt61pci_bbp_read(rt2x00dev, 4, &r4); r4 = rt61pci_bbp_read(rt2x00dev, 4);
rt61pci_bbp_read(rt2x00dev, 77, &r77); r77 = rt61pci_bbp_read(rt2x00dev, 77);
rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, rt2x00_rf(rt2x00dev, RF5325)); rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, rt2x00_rf(rt2x00dev, RF5325));
...@@ -685,9 +679,9 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev, ...@@ -685,9 +679,9 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
u8 r4; u8 r4;
u8 r77; u8 r77;
rt61pci_bbp_read(rt2x00dev, 3, &r3); r3 = rt61pci_bbp_read(rt2x00dev, 3);
rt61pci_bbp_read(rt2x00dev, 4, &r4); r4 = rt61pci_bbp_read(rt2x00dev, 4);
rt61pci_bbp_read(rt2x00dev, 77, &r77); r77 = rt61pci_bbp_read(rt2x00dev, 77);
rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, rt2x00_rf(rt2x00dev, RF2529)); rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, rt2x00_rf(rt2x00dev, RF2529));
rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
...@@ -739,9 +733,9 @@ static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev, ...@@ -739,9 +733,9 @@ static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev,
u8 r4; u8 r4;
u8 r77; u8 r77;
rt61pci_bbp_read(rt2x00dev, 3, &r3); r3 = rt61pci_bbp_read(rt2x00dev, 3);
rt61pci_bbp_read(rt2x00dev, 4, &r4); r4 = rt61pci_bbp_read(rt2x00dev, 4);
rt61pci_bbp_read(rt2x00dev, 77, &r77); r77 = rt61pci_bbp_read(rt2x00dev, 77);
/* /*
* Configure the RX antenna. * Configure the RX antenna.
...@@ -884,7 +878,7 @@ static void rt61pci_config_channel(struct rt2x00_dev *rt2x00dev, ...@@ -884,7 +878,7 @@ static void rt61pci_config_channel(struct rt2x00_dev *rt2x00dev,
smart = !(rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527)); smart = !(rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527));
rt61pci_bbp_read(rt2x00dev, 3, &r3); r3 = rt61pci_bbp_read(rt2x00dev, 3);
rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart); rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart);
rt61pci_bbp_write(rt2x00dev, 3, r3); rt61pci_bbp_write(rt2x00dev, 3, r3);
...@@ -1658,7 +1652,7 @@ static int rt61pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) ...@@ -1658,7 +1652,7 @@ static int rt61pci_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)
u8 value; u8 value;
for (i = 0; i < REGISTER_BUSY_COUNT; i++) { for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
rt61pci_bbp_read(rt2x00dev, 0, &value); value = rt61pci_bbp_read(rt2x00dev, 0);
if ((value != 0xff) && (value != 0x00)) if ((value != 0xff) && (value != 0x00))
return 0; return 0;
udelay(REGISTER_BUSY_DELAY); udelay(REGISTER_BUSY_DELAY);
......
...@@ -84,10 +84,11 @@ static void rt73usb_bbp_write(struct rt2x00_dev *rt2x00dev, ...@@ -84,10 +84,11 @@ static void rt73usb_bbp_write(struct rt2x00_dev *rt2x00dev,
mutex_unlock(&rt2x00dev->csr_mutex); mutex_unlock(&rt2x00dev->csr_mutex);
} }
static void rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev, static u8 rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev,
const unsigned int word, u8 *value) const unsigned int word)
{ {
u32 reg; u32 reg;
u8 value;
mutex_lock(&rt2x00dev->csr_mutex); mutex_lock(&rt2x00dev->csr_mutex);
...@@ -110,9 +111,11 @@ static void rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev, ...@@ -110,9 +111,11 @@ static void rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev,
WAIT_FOR_BBP(rt2x00dev, &reg); WAIT_FOR_BBP(rt2x00dev, &reg);
} }
*value = rt2x00_get_field32(reg, PHY_CSR3_VALUE); value = rt2x00_get_field32(reg, PHY_CSR3_VALUE);
mutex_unlock(&rt2x00dev->csr_mutex); mutex_unlock(&rt2x00dev->csr_mutex);
return value;
} }
static void rt73usb_rf_write(struct rt2x00_dev *rt2x00dev, static void rt73usb_rf_write(struct rt2x00_dev *rt2x00dev,
...@@ -147,15 +150,6 @@ static void rt73usb_rf_write(struct rt2x00_dev *rt2x00dev, ...@@ -147,15 +150,6 @@ static void rt73usb_rf_write(struct rt2x00_dev *rt2x00dev,
} }
#ifdef CONFIG_RT2X00_LIB_DEBUGFS #ifdef CONFIG_RT2X00_LIB_DEBUGFS
static u8 _rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev, const unsigned int word)
{
u8 value;
rt73usb_bbp_read(rt2x00dev, word, &value);
return value;
}
static const struct rt2x00debug rt73usb_rt2x00debug = { static const struct rt2x00debug rt73usb_rt2x00debug = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.csr = { .csr = {
...@@ -174,7 +168,7 @@ static const struct rt2x00debug rt73usb_rt2x00debug = { ...@@ -174,7 +168,7 @@ static const struct rt2x00debug rt73usb_rt2x00debug = {
.word_count = EEPROM_SIZE / sizeof(u16), .word_count = EEPROM_SIZE / sizeof(u16),
}, },
.bbp = { .bbp = {
.read = _rt73usb_bbp_read, .read = rt73usb_bbp_read,
.write = rt73usb_bbp_write, .write = rt73usb_bbp_write,
.word_base = BBP_BASE, .word_base = BBP_BASE,
.word_size = sizeof(u8), .word_size = sizeof(u8),
...@@ -589,9 +583,9 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev, ...@@ -589,9 +583,9 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
u8 r77; u8 r77;
u8 temp; u8 temp;
rt73usb_bbp_read(rt2x00dev, 3, &r3); r3 = rt73usb_bbp_read(rt2x00dev, 3);
rt73usb_bbp_read(rt2x00dev, 4, &r4); r4 = rt73usb_bbp_read(rt2x00dev, 4);
rt73usb_bbp_read(rt2x00dev, 77, &r77); r77 = rt73usb_bbp_read(rt2x00dev, 77);
rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0);
...@@ -636,9 +630,9 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev, ...@@ -636,9 +630,9 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
u8 r4; u8 r4;
u8 r77; u8 r77;
rt73usb_bbp_read(rt2x00dev, 3, &r3); r3 = rt73usb_bbp_read(rt2x00dev, 3);
rt73usb_bbp_read(rt2x00dev, 4, &r4); r4 = rt73usb_bbp_read(rt2x00dev, 4);
rt73usb_bbp_read(rt2x00dev, 77, &r77); r77 = rt73usb_bbp_read(rt2x00dev, 77);
rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0);
rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
...@@ -771,7 +765,7 @@ static void rt73usb_config_channel(struct rt2x00_dev *rt2x00dev, ...@@ -771,7 +765,7 @@ static void rt73usb_config_channel(struct rt2x00_dev *rt2x00dev,
smart = !(rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527)); smart = !(rt2x00_rf(rt2x00dev, RF5225) || rt2x00_rf(rt2x00dev, RF2527));
rt73usb_bbp_read(rt2x00dev, 3, &r3); r3 = rt73usb_bbp_read(rt2x00dev, 3);
rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart); rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, smart);
rt73usb_bbp_write(rt2x00dev, 3, r3); rt73usb_bbp_write(rt2x00dev, 3, r3);
...@@ -1305,7 +1299,7 @@ static int rt73usb_wait_bbp_ready(struct rt2x00_dev *rt2x00dev) ...@@ -1305,7 +1299,7 @@ static int rt73usb_wait_bbp_ready(struct rt2x00_dev *rt2x00dev)
u8 value; u8 value;
for (i = 0; i < REGISTER_USB_BUSY_COUNT; i++) { for (i = 0; i < REGISTER_USB_BUSY_COUNT; i++) {
rt73usb_bbp_read(rt2x00dev, 0, &value); value = rt73usb_bbp_read(rt2x00dev, 0);
if ((value != 0xff) && (value != 0x00)) if ((value != 0xff) && (value != 0x00))
return 0; return 0;
udelay(REGISTER_BUSY_DELAY); udelay(REGISTER_BUSY_DELAY);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment