]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
rt2x00: convert rt2x00_rf_read return type
authorArnd Bergmann <arnd@arndb.de>
Wed, 17 May 2017 14:46:55 +0000 (16:46 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 24 May 2017 13:45:33 +0000 (16:45 +0300)
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: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ralink/rt2x00/rt2400pci.c
drivers/net/wireless/ralink/rt2x00/rt2500pci.c
drivers/net/wireless/ralink/rt2x00/rt2500usb.c
drivers/net/wireless/ralink/rt2x00/rt2800lib.c
drivers/net/wireless/ralink/rt2x00/rt2x00.h
drivers/net/wireless/ralink/rt2x00/rt61pci.c
drivers/net/wireless/ralink/rt2x00/rt73usb.c

index 3ba9a1674e1d9d71a706e00a847ef0766ff88e32..d41832292db298c412d54690115220ef1522e054 100644 (file)
@@ -199,7 +199,7 @@ static const struct rt2x00debug rt2400pci_rt2x00debug = {
                .word_count     = BBP_SIZE / sizeof(u8),
        },
        .rf     = {
-               .read           = _rt2x00_rf_read,
+               .read           = rt2x00_rf_read,
                .write          = rt2400pci_rf_write,
                .word_base      = RF_BASE,
                .word_size      = sizeof(u32),
index d9b061b73e83852164756e035c2a660b80594479..232feba0773f6cc180b74846ef3bb7db2f17d3c5 100644 (file)
@@ -199,7 +199,7 @@ static const struct rt2x00debug rt2500pci_rt2x00debug = {
                .word_count     = BBP_SIZE / sizeof(u8),
        },
        .rf     = {
-               .read           = _rt2x00_rf_read,
+               .read           = rt2x00_rf_read,
                .write          = rt2500pci_rf_write,
                .word_base      = RF_BASE,
                .word_size      = sizeof(u32),
@@ -556,7 +556,7 @@ static void rt2500pci_config_txpower(struct rt2x00_dev *rt2x00dev,
 {
        u32 rf3;
 
-       rt2x00_rf_read(rt2x00dev, 3, &rf3);
+       rf3 = rt2x00_rf_read(rt2x00dev, 3);
        rt2x00_set_field32(&rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower));
        rt2500pci_rf_write(rt2x00dev, 3, rf3);
 }
index 5bd160f732deb4fd6b5a8a44367a1f54df5ce14d..9cff9ddafb720030a119303c4a0980872c9d3a49 100644 (file)
@@ -268,7 +268,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = {
                .word_count     = BBP_SIZE / sizeof(u8),
        },
        .rf     = {
-               .read           = _rt2x00_rf_read,
+               .read           = rt2x00_rf_read,
                .write          = rt2500usb_rf_write,
                .word_base      = RF_BASE,
                .word_size      = sizeof(u32),
@@ -639,7 +639,7 @@ static void rt2500usb_config_txpower(struct rt2x00_dev *rt2x00dev,
 {
        u32 rf3;
 
-       rt2x00_rf_read(rt2x00dev, 3, &rf3);
+       rf3 = rt2x00_rf_read(rt2x00dev, 3);
        rt2x00_set_field32(&rf3, RF3_TXPOWER, TXPOWER_TO_DEV(txpower));
        rt2500usb_rf_write(rt2x00dev, 3, rf3);
 }
index 9b8c19dcdb2cea38480a7a1dfc28e5e0d1a6e9be..fef53d6a888af012af117bb8c4b0727d7c4db998 100644 (file)
@@ -1265,7 +1265,7 @@ const struct rt2x00debug rt2800_rt2x00debug = {
                .word_count     = BBP_SIZE / sizeof(u8),
        },
        .rf     = {
-               .read           = _rt2x00_rf_read,
+               .read           = rt2x00_rf_read,
                .write          = rt2800_rf_write,
                .word_base      = RF_BASE,
                .word_size      = sizeof(u32),
index f2ae33bf2ef2da4b509cbcb0163b9cc0b1643d4b..36791f7ae2ce0b6a610a0e0eab989f255fb6fdd7 100644 (file)
@@ -1049,15 +1049,8 @@ struct rt2x00_bar_list_entry {
  * Generic RF access.
  * The RF is being accessed by word index.
  */
-static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev,
-                                 const unsigned int word, u32 *data)
-{
-       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)
+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));
        return rt2x00dev->rf[word - 1];
index efe8a766b25126f790ea3b98527280da377f5df1..147d1d2cc0a657a6bd0578a0789b503fe352f8bf 100644 (file)
@@ -236,7 +236,7 @@ static const struct rt2x00debug rt61pci_rt2x00debug = {
                .word_count     = BBP_SIZE / sizeof(u8),
        },
        .rf     = {
-               .read           = _rt2x00_rf_read,
+               .read           = rt2x00_rf_read,
                .write          = rt61pci_rf_write,
                .word_base      = RF_BASE,
                .word_size      = sizeof(u32),
@@ -922,10 +922,10 @@ static void rt61pci_config_txpower(struct rt2x00_dev *rt2x00dev,
 {
        struct rf_channel rf;
 
-       rt2x00_rf_read(rt2x00dev, 1, &rf.rf1);
-       rt2x00_rf_read(rt2x00dev, 2, &rf.rf2);
-       rt2x00_rf_read(rt2x00dev, 3, &rf.rf3);
-       rt2x00_rf_read(rt2x00dev, 4, &rf.rf4);
+       rf.rf1 = rt2x00_rf_read(rt2x00dev, 1);
+       rf.rf2 = rt2x00_rf_read(rt2x00dev, 2);
+       rf.rf3 = rt2x00_rf_read(rt2x00dev, 3);
+       rf.rf4 = rt2x00_rf_read(rt2x00dev, 4);
 
        rt61pci_config_channel(rt2x00dev, &rf, txpower);
 }
index 5db174922120501d599b65b78a9805fa7c2f07ee..a36dee1a4f20ac1a1e2d255f40f7b8eaccf47285 100644 (file)
@@ -181,7 +181,7 @@ static const struct rt2x00debug rt73usb_rt2x00debug = {
                .word_count     = BBP_SIZE / sizeof(u8),
        },
        .rf     = {
-               .read           = _rt2x00_rf_read,
+               .read           = rt2x00_rf_read,
                .write          = rt73usb_rf_write,
                .word_base      = RF_BASE,
                .word_size      = sizeof(u32),
@@ -805,10 +805,10 @@ static void rt73usb_config_txpower(struct rt2x00_dev *rt2x00dev,
 {
        struct rf_channel rf;
 
-       rt2x00_rf_read(rt2x00dev, 1, &rf.rf1);
-       rt2x00_rf_read(rt2x00dev, 2, &rf.rf2);
-       rt2x00_rf_read(rt2x00dev, 3, &rf.rf3);
-       rt2x00_rf_read(rt2x00dev, 4, &rf.rf4);
+       rf.rf1 = rt2x00_rf_read(rt2x00dev, 1);
+       rf.rf2 = rt2x00_rf_read(rt2x00dev, 2);
+       rf.rf3 = rt2x00_rf_read(rt2x00dev, 3);
+       rf.rf4 = rt2x00_rf_read(rt2x00dev, 4);
 
        rt73usb_config_channel(rt2x00dev, &rf, txpower);
 }