Commit aea8baa1 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Kalle Valo

rt2x00: convert rt2x00_rf_read return type

This is a semi-automated conversion to change rt2x00_rf_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:\(\<rt2x00_rf_read\>(.*, .*\), &\(.*\));:\2 = \1);:' \
	drivers/net/wireless/ralink/rt2x00/rt*
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 16d571bb
...@@ -199,7 +199,7 @@ static const struct rt2x00debug rt2400pci_rt2x00debug = { ...@@ -199,7 +199,7 @@ static const struct rt2x00debug rt2400pci_rt2x00debug = {
.word_count = BBP_SIZE / sizeof(u8), .word_count = BBP_SIZE / sizeof(u8),
}, },
.rf = { .rf = {
.read = _rt2x00_rf_read, .read = rt2x00_rf_read,
.write = rt2400pci_rf_write, .write = rt2400pci_rf_write,
.word_base = RF_BASE, .word_base = RF_BASE,
.word_size = sizeof(u32), .word_size = sizeof(u32),
......
...@@ -199,7 +199,7 @@ static const struct rt2x00debug rt2500pci_rt2x00debug = { ...@@ -199,7 +199,7 @@ static const struct rt2x00debug rt2500pci_rt2x00debug = {
.word_count = BBP_SIZE / sizeof(u8), .word_count = BBP_SIZE / sizeof(u8),
}, },
.rf = { .rf = {
.read = _rt2x00_rf_read, .read = rt2x00_rf_read,
.write = rt2500pci_rf_write, .write = rt2500pci_rf_write,
.word_base = RF_BASE, .word_base = RF_BASE,
.word_size = sizeof(u32), .word_size = sizeof(u32),
...@@ -556,7 +556,7 @@ static void rt2500pci_config_txpower(struct rt2x00_dev *rt2x00dev, ...@@ -556,7 +556,7 @@ static void rt2500pci_config_txpower(struct rt2x00_dev *rt2x00dev,
{ {
u32 rf3; u32 rf3;
rt2x00_rf_read(rt2x00dev, 3, &rf3); rf3 = rt2x00_rf_read(rt2x00dev, 3);
rt2x00_set_field32(&rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); rt2x00_set_field32(&rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower));
rt2500pci_rf_write(rt2x00dev, 3, rf3); rt2500pci_rf_write(rt2x00dev, 3, rf3);
} }
......
...@@ -268,7 +268,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = { ...@@ -268,7 +268,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = {
.word_count = BBP_SIZE / sizeof(u8), .word_count = BBP_SIZE / sizeof(u8),
}, },
.rf = { .rf = {
.read = _rt2x00_rf_read, .read = rt2x00_rf_read,
.write = rt2500usb_rf_write, .write = rt2500usb_rf_write,
.word_base = RF_BASE, .word_base = RF_BASE,
.word_size = sizeof(u32), .word_size = sizeof(u32),
...@@ -639,7 +639,7 @@ static void rt2500usb_config_txpower(struct rt2x00_dev *rt2x00dev, ...@@ -639,7 +639,7 @@ static void rt2500usb_config_txpower(struct rt2x00_dev *rt2x00dev,
{ {
u32 rf3; u32 rf3;
rt2x00_rf_read(rt2x00dev, 3, &rf3); rf3 = rt2x00_rf_read(rt2x00dev, 3);
rt2x00_set_field32(&rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower)); rt2x00_set_field32(&rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower));
rt2500usb_rf_write(rt2x00dev, 3, rf3); rt2500usb_rf_write(rt2x00dev, 3, rf3);
} }
......
...@@ -1265,7 +1265,7 @@ const struct rt2x00debug rt2800_rt2x00debug = { ...@@ -1265,7 +1265,7 @@ const struct rt2x00debug rt2800_rt2x00debug = {
.word_count = BBP_SIZE / sizeof(u8), .word_count = BBP_SIZE / sizeof(u8),
}, },
.rf = { .rf = {
.read = _rt2x00_rf_read, .read = rt2x00_rf_read,
.write = rt2800_rf_write, .write = rt2800_rf_write,
.word_base = RF_BASE, .word_base = RF_BASE,
.word_size = sizeof(u32), .word_size = sizeof(u32),
......
...@@ -1049,15 +1049,8 @@ struct rt2x00_bar_list_entry { ...@@ -1049,15 +1049,8 @@ struct rt2x00_bar_list_entry {
* Generic RF access. * Generic RF access.
* The RF is being accessed by word index. * The RF is being accessed by word index.
*/ */
static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev, static inline u32 rt2x00_rf_read(struct rt2x00_dev *rt2x00dev,
const unsigned int word, u32 *data) const unsigned int word)
{
BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
*data = rt2x00dev->rf[word - 1];
}
static inline u32 _rt2x00_rf_read(struct rt2x00_dev *rt2x00dev,
const unsigned int word)
{ {
BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32)); BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
return rt2x00dev->rf[word - 1]; return rt2x00dev->rf[word - 1];
......
...@@ -236,7 +236,7 @@ static const struct rt2x00debug rt61pci_rt2x00debug = { ...@@ -236,7 +236,7 @@ static const struct rt2x00debug rt61pci_rt2x00debug = {
.word_count = BBP_SIZE / sizeof(u8), .word_count = BBP_SIZE / sizeof(u8),
}, },
.rf = { .rf = {
.read = _rt2x00_rf_read, .read = rt2x00_rf_read,
.write = rt61pci_rf_write, .write = rt61pci_rf_write,
.word_base = RF_BASE, .word_base = RF_BASE,
.word_size = sizeof(u32), .word_size = sizeof(u32),
...@@ -922,10 +922,10 @@ static void rt61pci_config_txpower(struct rt2x00_dev *rt2x00dev, ...@@ -922,10 +922,10 @@ static void rt61pci_config_txpower(struct rt2x00_dev *rt2x00dev,
{ {
struct rf_channel rf; struct rf_channel rf;
rt2x00_rf_read(rt2x00dev, 1, &rf.rf1); rf.rf1 = rt2x00_rf_read(rt2x00dev, 1);
rt2x00_rf_read(rt2x00dev, 2, &rf.rf2); rf.rf2 = rt2x00_rf_read(rt2x00dev, 2);
rt2x00_rf_read(rt2x00dev, 3, &rf.rf3); rf.rf3 = rt2x00_rf_read(rt2x00dev, 3);
rt2x00_rf_read(rt2x00dev, 4, &rf.rf4); rf.rf4 = rt2x00_rf_read(rt2x00dev, 4);
rt61pci_config_channel(rt2x00dev, &rf, txpower); rt61pci_config_channel(rt2x00dev, &rf, txpower);
} }
......
...@@ -181,7 +181,7 @@ static const struct rt2x00debug rt73usb_rt2x00debug = { ...@@ -181,7 +181,7 @@ static const struct rt2x00debug rt73usb_rt2x00debug = {
.word_count = BBP_SIZE / sizeof(u8), .word_count = BBP_SIZE / sizeof(u8),
}, },
.rf = { .rf = {
.read = _rt2x00_rf_read, .read = rt2x00_rf_read,
.write = rt73usb_rf_write, .write = rt73usb_rf_write,
.word_base = RF_BASE, .word_base = RF_BASE,
.word_size = sizeof(u32), .word_size = sizeof(u32),
...@@ -805,10 +805,10 @@ static void rt73usb_config_txpower(struct rt2x00_dev *rt2x00dev, ...@@ -805,10 +805,10 @@ static void rt73usb_config_txpower(struct rt2x00_dev *rt2x00dev,
{ {
struct rf_channel rf; struct rf_channel rf;
rt2x00_rf_read(rt2x00dev, 1, &rf.rf1); rf.rf1 = rt2x00_rf_read(rt2x00dev, 1);
rt2x00_rf_read(rt2x00dev, 2, &rf.rf2); rf.rf2 = rt2x00_rf_read(rt2x00dev, 2);
rt2x00_rf_read(rt2x00dev, 3, &rf.rf3); rf.rf3 = rt2x00_rf_read(rt2x00dev, 3);
rt2x00_rf_read(rt2x00dev, 4, &rf.rf4); rf.rf4 = rt2x00_rf_read(rt2x00dev, 4);
rt73usb_config_channel(rt2x00dev, &rf, txpower); rt73usb_config_channel(rt2x00dev, &rf, txpower);
} }
......
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