diff mbox

[U-Boot,v2,02/10] net: e1000: Fix build warnings for 32-bit

Message ID 1440595055-26333-2-git-send-email-bmeng.cn@gmail.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng Aug. 26, 2015, 1:17 p.m. UTC
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@gmail.com>

---

Changes in v2:
- Use lower_32_bits() and upper_32_bits()

 drivers/net/e1000.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Simon Glass Aug. 26, 2015, 1:35 p.m. UTC | #1
Hi,

On 26 August 2015 at 06:17, Bin Meng <bmeng.cn@gmail.com> 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@gmail.com>
>
> ---
>
> Changes in v2:
> - Use lower_32_bits() and upper_32_bits()
>
>  drivers/net/e1000.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

I'd like to pick this up for u-boot-x86 as it fixes warnings in most x86 boards.

Regards,
Simon
Joe Hershberger Aug. 26, 2015, 2:42 p.m. UTC | #2
Hi Bin,

On Wed, Aug 26, 2015 at 8:17 AM, Bin Meng <bmeng.cn@gmail.com> 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@gmail.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Simon Glass Aug. 26, 2015, 2:56 p.m. UTC | #3
On 26 August 2015 at 07:42, Joe Hershberger <joe.hershberger@gmail.com> wrote:
> Hi Bin,
>
> On Wed, Aug 26, 2015 at 8:17 AM, Bin Meng <bmeng.cn@gmail.com> 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@gmail.com>
>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>

Applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 6f74d30..7b830ff 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -4978,8 +4978,8 @@  e1000_configure_tx(struct e1000_hw *hw)
 	unsigned long tipg, tarc;
 	uint32_t ipgr1, ipgr2;
 
-	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, lower_32_bits((unsigned long)tx_base));
+	E1000_WRITE_REG(hw, TDBAH, upper_32_bits((unsigned long)tx_base));
 
 	E1000_WRITE_REG(hw, TDLEN, 128);
 
@@ -5103,6 +5103,7 @@  e1000_configure_rx(struct e1000_hw *hw)
 {
 	unsigned long rctl, ctrl_ext;
 	rx_tail = 0;
+
 	/* make sure receives are disabled while setting up the descriptors */
 	rctl = E1000_READ_REG(hw, RCTL);
 	E1000_WRITE_REG(hw, RCTL, rctl & ~E1000_RCTL_EN);
@@ -5122,8 +5123,8 @@  e1000_configure_rx(struct e1000_hw *hw)
 		E1000_WRITE_FLUSH(hw);
 	}
 	/* Setup the Base and Length of the Rx Descriptor Ring */
-	E1000_WRITE_REG(hw, RDBAL, (unsigned long)rx_base & 0xffffffff);
-	E1000_WRITE_REG(hw, RDBAH, (unsigned long)rx_base >> 32);
+	E1000_WRITE_REG(hw, RDBAL, lower_32_bits((unsigned long)rx_base));
+	E1000_WRITE_REG(hw, RDBAH, upper_32_bits((unsigned long)rx_base));
 
 	E1000_WRITE_REG(hw, RDLEN, 128);