• Thomas Petazzoni's avatar
    net: mvpp2: simplify MVPP2_PRS_RI_* definitions · 8138affc
    Thomas Petazzoni authored
    Some of the MVPP2_PRS_RI_* definitions use the ~(value) syntax, which
    doesn't compile nicely on 64-bit. Moreover, those definitions are in
    fact unneeded, since they are always used in combination with a bit
    mask that ensures only the appropriate bits are modified.
    
    Therefore, such definitions should just be set to 0x0. In addition, as
    suggested by Russell King, we change the _MASK definitions to also use
    the BIT() macro so that it is clear they are related to the values
    defined afterwards.
    
    For example:
    
     #define MVPP2_PRS_RI_L2_CAST_MASK              0x600
     #define MVPP2_PRS_RI_L2_UCAST                  ~(BIT(9) | BIT(10))
     #define MVPP2_PRS_RI_L2_MCAST                  BIT(9)
     #define MVPP2_PRS_RI_L2_BCAST                  BIT(10)
    
    becomes
    
     #define MVPP2_PRS_RI_L2_CAST_MASK              (BIT(9) | BIT(10))
     #define MVPP2_PRS_RI_L2_UCAST                  0x0
     #define MVPP2_PRS_RI_L2_MCAST                  BIT(9)
     #define MVPP2_PRS_RI_L2_BCAST                  BIT(10)
    
    Because the values (MVPP2_PRS_RI_L2_UCAST, MVPP2_PRS_RI_L2_MCAST and
    MVPP2_PRS_RI_L2_BCAST) are always applied with
    MVPP2_PRS_RI_L2_CAST_MASK, and therefore there is no need for
    MVPP2_PRS_RI_L2_UCAST to be defined as ~(BIT(9) | BIT(10)).
    
    It fixes the following warnings when building the driver on a 64-bit
    platform (which is not possible as of this commit, but will be enabled
    in a follow-up commit):
    
    drivers/net/ethernet/marvell/mvpp2.c: In function ‘mvpp2_prs_mac_promisc_set’:
    drivers/net/ethernet/marvell/mvpp2.c:524:33: warning: large integer implicitly truncated to unsigned type [-Woverflow]
     #define MVPP2_PRS_RI_L2_UCAST   ~(BIT(9) | BIT(10))
                                     ^
    drivers/net/ethernet/marvell/mvpp2.c:1459:33: note: in expansion of macro ‘MVPP2_PRS_RI_L2_UCAST’
       mvpp2_prs_sram_ri_update(&pe, MVPP2_PRS_RI_L2_UCAST,
    Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
    Acked-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8138affc
mvpp2.c 179 KB