Patchwork [U-Boot] net: Armada100: Fix compilation warnings

login
register
mail settings
Submitter Ajay Bhargav
Date Oct. 31, 2011, 11:19 a.m.
Message ID <1320059977-27416-1-git-send-email-ajay.bhargav@einfochips.com>
Download mbox | patch
Permalink /patch/122785/
State Awaiting Upstream
Delegated to: Prafulla Wadaskar
Headers show

Comments

Ajay Bhargav - Oct. 31, 2011, 11:19 a.m.
This patch fix compilation warnings for Armada100 FEC driver

Ref:
warning: dereferencing type-punned pointer will break
strict-aliasing rules

Signed-off-by: Ajay Bhargav <ajay.bhargav@einfochips.com>
---
 drivers/net/armada100_fec.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
Anatolij Gustschin - Nov. 19, 2011, 10:08 p.m.
Hi Praffula,

On Mon, 31 Oct 2011 16:49:37 +0530
Ajay Bhargav <ajay.bhargav@einfochips.com> wrote:

> This patch fix compilation warnings for Armada100 FEC driver
> 
> Ref:
> warning: dereferencing type-punned pointer will break
> strict-aliasing rules
> 
> Signed-off-by: Ajay Bhargav <ajay.bhargav@einfochips.com>
> ---
>  drivers/net/armada100_fec.c |   14 ++++++++++----
>  1 files changed, 10 insertions(+), 4 deletions(-)

Acked-by: Anatolij Gustschin <agust@denx.de>

Could you apply this patch and send a pull request?

Thanks,
Anatolij
Prafulla Wadaskar - Nov. 21, 2011, 10:32 a.m.
> -----Original Message-----
> From: Anatolij Gustschin [mailto:agust@denx.de]
> Sent: Sunday, November 20, 2011 3:39 AM
> To: Prafulla Wadaskar
> Cc: Ajay Bhargav; u-boot@lists.denx.de
> Subject: Re: [U-Boot] [PATCH] net: Armada100: Fix compilation
> warnings
> 
> Hi Praffula,
> 
> On Mon, 31 Oct 2011 16:49:37 +0530
> Ajay Bhargav <ajay.bhargav@einfochips.com> wrote:
> 
> > This patch fix compilation warnings for Armada100 FEC driver
> >
> > Ref:
> > warning: dereferencing type-punned pointer will break
> > strict-aliasing rules
> >
> > Signed-off-by: Ajay Bhargav <ajay.bhargav@einfochips.com>
> > ---
> >  drivers/net/armada100_fec.c |   14 ++++++++++----
> >  1 files changed, 10 insertions(+), 4 deletions(-)
> 
> Acked-by: Anatolij Gustschin <agust@denx.de>
> 
> Could you apply this patch and send a pull request?
> 

Applied to u-boot-marvell.git master branch

Regards..
Prafulla . .

Patch

diff --git a/drivers/net/armada100_fec.c b/drivers/net/armada100_fec.c
index fbf9763..1a54362 100644
--- a/drivers/net/armada100_fec.c
+++ b/drivers/net/armada100_fec.c
@@ -440,6 +440,7 @@  static int armdfec_init(struct eth_device *dev, bd_t *bd)
 	struct armdfec_device *darmdfec = to_darmdfec(dev);
 	struct armdfec_reg *regs = darmdfec->regs;
 	int phy_adr;
+	u32 temp;
 
 	armdfec_init_rx_desc_ring(darmdfec);
 
@@ -479,9 +480,12 @@  static int armdfec_init(struct eth_device *dev, bd_t *bd)
 	update_hash_table_mac_address(darmdfec, NULL, dev->enetaddr);
 
 	/* Update TX and RX queue descriptor register */
-	writel((u32)darmdfec->p_txdesc, &regs->txcdp[TXQ]);
-	writel((u32)darmdfec->p_rxdesc, &regs->rxfdp[RXQ]);
-	writel((u32)darmdfec->p_rxdesc_curr, &regs->rxcdp[RXQ]);
+	temp = (u32)&regs->txcdp[TXQ];
+	writel((u32)darmdfec->p_txdesc, temp);
+	temp = (u32)&regs->rxfdp[RXQ];
+	writel((u32)darmdfec->p_rxdesc, temp);
+	temp = (u32)&regs->rxcdp[RXQ];
+	writel((u32)darmdfec->p_rxdesc_curr, temp);
 
 	/* Enable Interrupts */
 	writel(ALL_INTS, &regs->im);
@@ -614,6 +618,7 @@  static int armdfec_recv(struct eth_device *dev)
 	struct rx_desc *p_rxdesc_curr = darmdfec->p_rxdesc_curr;
 	u32 cmd_sts;
 	u32 timeout = 0;
+	u32 temp;
 
 	/* wait untill rx packet available or timeout */
 	do {
@@ -667,7 +672,8 @@  static int armdfec_recv(struct eth_device *dev)
 	p_rxdesc_curr->buf_size = PKTSIZE_ALIGN;
 	p_rxdesc_curr->byte_cnt = 0;
 
-	writel((u32)p_rxdesc_curr->nxtdesc_p, (u32)&darmdfec->p_rxdesc_curr);
+	temp = (u32)&darmdfec->p_rxdesc_curr;
+	writel((u32)p_rxdesc_curr->nxtdesc_p, temp);
 
 	return 0;
 }