]> git.sur5r.net Git - u-boot/commitdiff
at91_emac: fix compile warning
authorandreas.devel@googlemail.com <andreas.devel@googlemail.com>
Thu, 9 Jun 2011 00:22:54 +0000 (00:22 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Tue, 21 Jun 2011 20:26:22 +0000 (22:26 +0200)
This patch removes the warning

---8<---
at91_emac.c: In function 'at91emac_write_hwaddr':
at91_emac.c:487:2: warning: dereferencing type-punned pointer will break strict-aliasing rules
--->8---

Signed-off-by: Andreas Bießmann <andreas.devel@gmail.com>
drivers/net/at91_emac.c

index b09ff8c4d159d19abb81c7bd06690b98f5b65f93..97d273999af0514375557ae1de9bfd32603588ec 100644 (file)
@@ -481,11 +481,13 @@ static int at91emac_write_hwaddr(struct eth_device *netdev)
        dev = (emac_device *) netdev->priv;
 
        writel(1 << ATMEL_ID_EMAC, &pmc->pcer);
-       DEBUG_AT91EMAC("init MAC-ADDR %x%x \n",
-               cpu_to_le16(*((u16 *)(netdev->enetaddr + 4))),
-               cpu_to_le32(*((u32 *)netdev->enetaddr)));
-       writel(cpu_to_le32(*((u32 *)netdev->enetaddr)), &emac->sa2l);
-       writel(cpu_to_le16(*((u16 *)(netdev->enetaddr + 4))), &emac->sa2h);
+       DEBUG_AT91EMAC("init MAC-ADDR %02x:%02x:%02x:%02x:%02x:%02x\n",
+               netdev->enetaddr[5], netdev->enetaddr[4], netdev->enetaddr[3],
+               netdev->enetaddr[2], netdev->enetaddr[1], netdev->enetaddr[0]);
+       writel( (netdev->enetaddr[0] | netdev->enetaddr[1] << 8 |
+                       netdev->enetaddr[2] << 16 | netdev->enetaddr[3] << 24),
+                       &emac->sa2l);
+       writel((netdev->enetaddr[4] | netdev->enetaddr[5] << 8), &emac->sa2h);
        DEBUG_AT91EMAC("init MAC-ADDR %x%x \n",
                readl(&emac->sa2h), readl(&emac->sa2l));
        return 0;