Subject: [RFC][PATCH 10/11] dwc-xlgmac: fix big-endian breakage
Users of XLGMAC_SET_REG_BITS_LE() expect it to take le32 and return le32.
Signed-off-by Al Viro <[email protected]>
--- drivers/net/ethernet/synopsys/dwc-xlgmac.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/synopsys/dwc-xlgmac.h +3 -3
@@ -106,7 +106,7 @@#define XLGMAC_GET_REG_BITS_LE (var, pos, len) ({ \ typeof(pos) _pos = (pos); \ typeof(len) _len = (len); \ - typeof(var) _var = le32_to_cpu((var)); \ + u32 _var = le32_to_cpu((var)); \ ((_var) & GENMASK(_pos + _len - 1, _pos)) >> (_pos); \ })
@@ -125,8 +125,8 @@typeof (len) _len = (len); \typeof (val) _val = (val); \ _val = (_val << _pos) &GENMASK (_pos + _len -1 , _pos); \ - _var = (_var & ~GENMASK (_pos + _len -1 , _pos)) | _val; \ -cpu_to_le32 (_var); \ + (_var & ~cpu_to_le32 (GENMASK (_pos + _len -1 , _pos))) | \ +cpu_to_le32 (_val); \ })struct xlgmac_pdata ;
Signature · 1 line
2.11.0
Jie Deng
Acked-byQuoted 22 lines · Al Viro
Users of
XLGMAC_SET_REG_BITS_LE()expect it to take le32 and return le32.Signed-off-by Al Viro <[email protected]>--- drivers/net/ethernet/synopsys/dwc-xlgmac.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/net/ethernet/synopsys/dwc-xlgmac.h +1
-1@@ -106,7 +106,7 @@#define XLGMAC_GET_REG_BITS_LE (var, pos, len) ({ \ typeof(pos) _pos = (pos); \ typeof(len) _len = (len); \ - typeof(var) _var = le32_to_cpu((var)); \ + u32 _var = le32_to_cpu((var)); \ ((_var) & GENMASK(_pos + _len - 1, _pos)) >> (_pos); \ })
drivers/net/ethernet/synopsys/dwc-xlgmac.h line 132
Quoted 10 lines
drivers/net/ethernet/synopsys/dwc-xlgmac.h +2
-2@@ -125,8 +125,8 @@typeof (len) _len = (len); \typeof (val) _val = (val); \ _val = (_val << _pos) &GENMASK (_pos + _len -1 , _pos); \ - _var = (_var & ~GENMASK (_pos + _len -1 , _pos)) | _val; \ -cpu_to_le32 (_var); \ + (_var & ~cpu_to_le32 (GENMASK (_pos + _len -1 , _pos))) | \ +cpu_to_le32 (_val); \ })struct xlgmac_pdata ;
Thanks for your patch.
Acked-by Jie Deng <[email protected]>