[U-Boot] [PATCH v1 06/41] net: mvpp2: simplify MVPP2_PRS_RI_* definitions
Joe Hershberger
joe.hershberger at gmail.com
Tue Mar 21 17:01:27 UTC 2017
On Tue, Mar 21, 2017 at 9:27 AM, Stefan Roese <sr at denx.de> wrote:
> From: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
>
> 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: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
> Signed-off-by: Stefan Roese <sr at denx.de>
Acked-by: Joe Hershberger <joe.hershberger at ni.com>
More information about the U-Boot
mailing list