[U-Boot] [PATCH 2/9] net: e1000: Fix build warnings for 32-bit

Scott Wood scottwood at freescale.com
Tue Aug 25 19:57:55 CEST 2015


On Tue, 2015-08-25 at 00:22 -0700, Bin Meng wrote:
> commit 6497e37 "net: e1000: Support 64-bit physical address" causes
> compiler warnings on 32-bit U-Boot build below.
> 
> drivers/net/e1000.c: In function 'e1000_configure_tx':
> drivers/net/e1000.c:4982:2: warning: right shift count >= width of type 
> [enabled by default]
> drivers/net/e1000.c: In function 'e1000_configure_rx':
> drivers/net/e1000.c:5126:2: warning: right shift count >= width of type 
> [enabled by default]
> 
> This commit fixes the build warnings.
> 
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
> ---
> 
>  drivers/net/e1000.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
> index 6f74d30..a467280 100644
> --- a/drivers/net/e1000.c
> +++ b/drivers/net/e1000.c
> @@ -4977,9 +4977,10 @@ e1000_configure_tx(struct e1000_hw *hw)
>       unsigned long tctl;
>       unsigned long tipg, tarc;
>       uint32_t ipgr1, ipgr2;
> +     uint64_t tdba = (unsigned long)tx_base;
>  
> -     E1000_WRITE_REG(hw, TDBAL, (unsigned long)tx_base & 0xffffffff);
> -     E1000_WRITE_REG(hw, TDBAH, (unsigned long)tx_base >> 32);
> +     E1000_WRITE_REG(hw, TDBAL, (uint32_t)(tdba & 0xffffffff));
> +     E1000_WRITE_REG(hw, TDBAH, (uint32_t)(tdba >> 32));

You could use upper_32_bits()/lower_32_bits().

-Scott



More information about the U-Boot mailing list