mt76: mt7615: Fix build with older compilers
PATCH 1/1 mt76: mt7615: Fix build with older compilers
Some compilers (tested with 4.8.5 from CentOS 7) fail properly process FIELD_GET inside an inline function, which ends up in a BUILD_BUG_ON. Convert inline function to a macro.
Fixes commit bf92e7685100 ("mt76: mt7615: add support for per-chain signal strength reporting")
Reported in https://lkml.org/lkml/2019/9/21/146
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +1 -4
@@ -13,10 +13,7 @@#include "../dma.h" #include "mac.h" -static inline s8 to_rssi (u32 field,u32 rxv) -{ -return (FIELD_GET (field, rxv) -220 ) /2 ; -} +#define to_rssi (field, rxv) ((FIELD_GET(field, rxv) - 220) / 2)static struct mt76_wcid *mt7615_rx_get_wcid (struct mt7615_dev *dev,u8 idx,bool unicast)
Signature · 7 lines
2.18.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hello!
Quoted 1 line · Pablo Greco
Some compilers (tested with 4.8.5 from CentOS 7) fail properly process
Fail to?
Quoted 5 lines
FIELD_GETinside an inline function, which ends up in aBUILD_BUG_ON. Convert inline function to a macro.Fixes commit
bf92e7685100("mt76: mt7615: add support for per-chain signal strength reporting")
Should be:
Do not ever break up the Fixes: line and don't insert empty lines between
it and other tags.
Quoted 4 lines
Reported in https://lkml.org/lkml/2019/9/21/146
Reported-by kbuild test robot <[email protected]>Signed-off-by Pablo Greco <[email protected]>
[...]
MBR, Sergei
Quoted 7 lines · Sergei Shtylyov
Hello!
Quoted 1 line · Pablo Greco
Some compilers (tested with 4.8.5 from CentOS 7) fail properly process
Fail to?
Right
Quoted 4 lines
Quoted 4 lines
FIELD_GETinside an inline function, which ends up in aBUILD_BUG_ON. Convert inline function to a macro.
Quoted 8 lines
Quoted 2 lines
Fixes commit
bf92e7685100("mt76: mt7615: add support for per-chain signal strength reporting")Should be:
Fixes bf92e7685100 ("mt76: mt7615: add support for per-chain signal strength reporting")Do not ever break up the Fixes: line and don't insert empty lines between it and other tags.
Ack, I'll fix those for v2
Quoted 8 lines
Quoted 5 lines
Reported in https://lkml.org/lkml/2019/9/21/146
Reported-by kbuild test robot <[email protected]>Signed-off-by Pablo Greco <[email protected]>[...]
MBR, Sergei
Thanks, Pablo
Quoted 19 lines · Pablo Greco
Some compilers (tested with 4.8.5 from CentOS 7) fail properly process
FIELD_GETinside an inline function, which ends up in aBUILD_BUG_ON. Convert inline function to a macro.Fixes commit
bf92e7685100("mt76: mt7615: add support for per-chain signal strength reporting")
Reported in https://lkml.org/lkml/2019/9/21/146Reported-by kbuild test robot <[email protected]>Signed-off-by Pablo Greco <[email protected]>--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/net/wireless/mediatek/mt76/mt7615/mac.c +0
-0
drivers/net/wireless/mediatek/mt76/mt7615/mac.c line 16
Quoted 8 lines
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +1
-4@@ -13,10 +13,7 @@#include "../dma.h" #include "mac.h" -static inline s8 to_rssi (u32 field,u32 rxv) -{ -return (FIELD_GET (field, rxv) -220 ) /2 ; -} +#define to_rssi (field, rxv) ((FIELD_GET(field, rxv) - 220) / 2)
What about u32_get_bits() instead of FIELD_GET(), would that work? I guess chances for that is slim, but it's always a shame to convert a function to a macro so we should try other methods first.
Or even better if we could fix FIELD_GET() to work with older compilers.
Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 19 lines · Pablo Greco
Some compilers (tested with 4.8.5 from CentOS 7) fail properly process
FIELD_GETinside an inline function, which ends up in aBUILD_BUG_ON. Convert inline function to a macro.Fixes commit
bf92e7685100("mt76: mt7615: add support for per-chain signal strength reporting")
Reported in https://lkml.org/lkml/2019/9/21/146Reported-by kbuild test robot <[email protected]>Signed-off-by Pablo Greco <[email protected]>--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/net/wireless/mediatek/mt76/mt7615/mac.c +0
-0
drivers/net/wireless/mediatek/mt76/mt7615/mac.c line 16
Quoted 8 lines
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +1
-4@@ -13,10 +13,7 @@#include "../dma.h" #include "mac.h" -static inline s8 to_rssi (u32 field,u32 rxv) -{ -return (FIELD_GET (field, rxv) -220 ) /2 ; -} +#define to_rssi (field, rxv) ((FIELD_GET(field, rxv) - 220) / 2)
What about u32_get_bits() instead of FIELD_GET(), would that work? I guess chances for that is slim, but it's always a shame to convert a function to a macro so we should try other methods first.
Or even better if we could fix FIELD_GET() to work with older compilers.
Signature · 6 lines
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
A message that is not in the archive (sent off-list or not yet received): 0101016ec5ed7d91-eac61501-1e4a-42f1-881d-cc2c02eb8372-000000@us-west-2.amazonses.com
Quoted 24 lines · Kalle Valo
Quoted 22 lines · Pablo Greco
Some compilers (tested with 4.8.5 from CentOS 7) fail properly process
FIELD_GETinside an inline function, which ends up in aBUILD_BUG_ON. Convert inline function to a macro.Fixes commit
bf92e7685100("mt76: mt7615: add support for per-chain signal strength reporting")
Reported in https://lkml.org/lkml/2019/9/21/146Reported-by kbuild test robot <[email protected]>Signed-off-by Pablo Greco <[email protected]>--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/net/wireless/mediatek/mt76/mt7615/mac.c +0
-0@@ -13,10 +13,7 @@#include "../dma.h" #include "mac.h"
Quoted 8 lines
drivers/net/wireless/mediatek/mt76/mt7615/mac.c line 16
Quoted 5 lines
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +1
-4-static inline s8 to_rssi (u32 field,u32 rxv) -{ -return (FIELD_GET (field, rxv) -220 ) /2 ; -} +#define to_rssi (field, rxv) ((FIELD_GET(field, rxv) - 220) / 2)What about
u32_get_bits()instead ofFIELD_GET(), would that work? I guess chances for that is slim, but it's always a shame to convert a function to a macro so we should try other methods first.
Anything that doesn't check field at build time should work, but between losing a check, or turning an inline into a macro, I'd rather use the macro.
Quoted 2 lines
Or even better if we could fix
FIELD_GET()to work with older compilers.
The problem is not FIELD_GET itself, is that the compiler is trying to use "field" as a variable, instead as the macro expansion of GENMASK, as if the function wasn't inline. In the linked page you can see this message
BUILD_BUG_ON failed: (((field) + (1ULL << (__builtin_ffsll(field) - 1))) & (((field) + (1ULL << (__builtin_ffsll(field) - 1))) - 1)) != 0 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
which is is not right, because "field" should never be used for that check.
Pablo.