Skip to contentSkip to conversation

drivers/net/mvgbe.c: Fix GCC 4.6 warnings

PATCH New Anatolij Gustschin 3 participants 3 messages Nov 19, 2011 – Dec 5, 2011 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/net/mvgbe.c: Fix GCC 4.6 warnings

Fix:
mvgbe.c: In function 'mvgbe_send':
mvgbe.c:555:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] mvgbe.c: In function 'mvgbe_recv':
mvgbe.c:640:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

---
 drivers/net/mvgbe.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/net/mvgbe.c +6 -3
index fd13428..de7cdd7 100644
@@ -531,6 +531,7 @@ static int mvgbe_send(struct eth_device *dev, void *dataptr,
 	struct mvgbe_txdesc *p_txdesc = dmvgbe->p_txdesc;
 	void *p = (void *)dataptr;
 	u32 cmd_sts;
+	u32 txuq0_reg_addr;
 
 	/* Copy buffer if it's misaligned */
 	if ((u32) dataptr & 0x07) {
@@ -552,7 +553,8 @@ static int mvgbe_send(struct eth_device *dev, void *dataptr,
 	p_txdesc->byte_cnt = datasize;
 
 	/* Set this tc desc as zeroth TXUQ */
-	MVGBE_REG_WR(regs->tcqdp[TXUQ], (u32) p_txdesc);
+	txuq0_reg_addr = (u32)&regs->tcqdp[TXUQ];
+	writel((u32) p_txdesc, txuq0_reg_addr);
 
 	/* ensure tx desc writes above are performed before we start Tx DMA */
 	isb();
@@ -583,6 +585,7 @@ static int mvgbe_recv(struct eth_device *dev)
 	struct mvgbe_rxdesc *p_rxdesc_curr = dmvgbe->p_rxdesc_curr;
 	u32 cmd_sts;
 	u32 timeout = 0;
+	u32 rxdesc_curr_addr;
 
 	/* wait untill rx packet available or timeout */
 	do {
@@ -637,8 +640,8 @@ static int mvgbe_recv(struct eth_device *dev)
 	p_rxdesc_curr->buf_size = PKTSIZE_ALIGN;
 	p_rxdesc_curr->byte_cnt = 0;
 
-	writel((unsigned)p_rxdesc_curr->nxtdesc_p,
-		(u32) &dmvgbe->p_rxdesc_curr);
+	rxdesc_curr_addr = (u32)&dmvgbe->p_rxdesc_curr;
+	writel((unsigned)p_rxdesc_curr->nxtdesc_p, rxdesc_curr_addr);
 
 	return 0;
 }
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 drivers/net/mvgbe.c: Fix GCC 4.6 warnings

Quoted 68 lines

-----Original Message-----
From: Anatolij Gustschin [mailto:agust at denx.de]
Sent: Sunday, November 20, 2011 12:30 AM
To: u-boot at lists.denx.de
Cc: Prafulla Wadaskar
Subject: [PATCH] drivers/net/mvgbe.c: Fix GCC 4.6 warnings

Fix:
mvgbe.c: In function 'mvgbe_send':
mvgbe.c:555:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] mvgbe.c: In function 'mvgbe_recv':
mvgbe.c:640:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

---
 drivers/net/mvgbe.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/net/mvgbe.c +1 -0
index fd13428..de7cdd7 100644
@@ -531,6 +531,7 @@ static int mvgbe_send(struct eth_device
 *dev, void *dataptr,
 	struct mvgbe_txdesc *p_txdesc = dmvgbe->p_txdesc;
 	void *p = (void *)dataptr;
 	u32 cmd_sts;
+	u32 txuq0_reg_addr;
 
 	/* Copy buffer if it's misaligned */
drivers/net/mvgbe.c +2 -1
 	if ((u32) dataptr & 0x07) {
@@ -552,7 +553,8 @@ static int mvgbe_send(struct eth_device
 *dev, void *dataptr,
 	p_txdesc->byte_cnt = datasize;
 
 	/* Set this tc desc as zeroth TXUQ */
-	MVGBE_REG_WR(regs->tcqdp[TXUQ], (u32) p_txdesc);
+	txuq0_reg_addr = (u32)&regs->tcqdp[TXUQ];
+	writel((u32) p_txdesc, txuq0_reg_addr);
 
 	/* ensure tx desc writes above are performed before we

start Tx DMA */

drivers/net/mvgbe.c +1 -0
 	isb();
@@ -583,6 +585,7 @@ static int mvgbe_recv(struct eth_device
 *dev)
 	struct mvgbe_rxdesc *p_rxdesc_curr = dmvgbe->p_rxdesc_curr;
 	u32 cmd_sts;
 	u32 timeout = 0;
+	u32 rxdesc_curr_addr;
 
 	/* wait untill rx packet available or timeout */
drivers/net/mvgbe.c +2 -2
 	do {
@@ -637,8 +640,8 @@ static int mvgbe_recv(struct eth_device
 *dev)
 	p_rxdesc_curr->buf_size = PKTSIZE_ALIGN;
 	p_rxdesc_curr->byte_cnt = 0;
 
-	writel((unsigned)p_rxdesc_curr->nxtdesc_p,
-		(u32) &dmvgbe->p_rxdesc_curr);
+	rxdesc_curr_addr = (u32)&dmvgbe->p_rxdesc_curr;
+	writel((unsigned)p_rxdesc_curr->nxtdesc_p,
 rxdesc_curr_addr);
 
Quoted 2 lines

return 0;
}

Regards..
Prafulla . .

Quoted 2 lines

--
1.7.5.4

#2 lore raw

PATCH 1/1 drivers/net/mvgbe.c: Fix GCC 4.6 warnings

In reply to Anatolij Gustschin

Dear Anatolij Gustschin,

Quoted 8 lines · In message <[email protected]> you wrote:

Fix:
mvgbe.c: In function 'mvgbe_send':
mvgbe.c:555:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] mvgbe.c: In function 'mvgbe_recv':
mvgbe.c:640:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Quoted 5 lines
---
 drivers/net/mvgbe.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Your csh still thinks true is false. Write to your vendor  today  and
tell them that next year Configure ought to "rm /bin/csh" unless they
fix  their blasted shell. :-)
                 - Larry Wall in Configure from the perl distribution