]> git.karo-electronics.de Git - karo-tx-linux.git/commit
rt2x00: convert rt2800_rfcsr_read return type
authorArnd Bergmann <arnd@arndb.de>
Wed, 17 May 2017 14:46:54 +0000 (16:46 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 24 May 2017 13:45:32 +0000 (16:45 +0300)
commit16d571bb0fe6aa7fed82e19166ca1542026c9c06
treeb09ea5478b12d8bed508038cb547ad058aa7eec8
parent6b81745e36e346e8aa936219d0311b384313bee3
rt2x00: convert rt2800_rfcsr_read return type

With CONFIG_KASAN enabled and gcc-7, we get a warning about rather high
stack usage (with a private patch set I have to turn on this warning,
which I intend to get into the next kernel release):

wireless/ralink/rt2x00/rt2800lib.c: In function 'rt2800_bw_filter_calibration':
wireless/ralink/rt2x00/rt2800lib.c:7990:1: error: the frame size of 2144 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]

The problem is that KASAN inserts a redzone around each local variable
that gets passed by reference, and the newly added function has a lot
of them.

This is a semi-automated conversion to change rt2800_rfcsr_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:\(rt2800_rfcsr_read(.*, .*\), &\(.*\));:\2 = \1);:' \
    -i 's:\(rt2800_rfcsr_read_bank(.*, .*\), &\(.*\));:\2 = \1);:' \
        drivers/net/wireless/ralink/rt2x00/rt2800lib.c

Fixes: 41977e86c984 ("rt2x00: add support for MT7620")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ralink/rt2x00/rt2800lib.c