[U-Boot] [PATCH] CPCI750: Fix GCC 4.6 warning in board/esd/cpci750/mv_eth.c

Reinhard Arlt reinhard.arlt at esd.eu
Fri Nov 18 19:43:21 CET 2011


From: Reinhard Arlt <reinhard.arlt at esd.eu>

This patch fix the GCC 4.6 warnings in 

Signed-off-by: Reinhard Arlt <reinhard.arlt at esd.eu>

--

diff --git a/board/esd/cpci750/mv_eth.c b/board/esd/cpci750/mv_eth.c
index 781ad23..69b4a91 100644
--- a/board/esd/cpci750/mv_eth.c
+++ b/board/esd/cpci750/mv_eth.c
@@ -100,6 +100,8 @@ extern void NetReceive (volatile uchar *, int);
 
 extern unsigned int INTERNAL_REG_BASE_ADDR;
 
+u32 port_status;
+
 /*************************************************
  *Helper functions - used inside the driver only *
  *************************************************/
@@ -422,7 +424,7 @@ static int mv64360_eth_real_open (struct eth_device *dev)
 	ETH_PORT_INFO *ethernet_private;
 	struct mv64360_eth_priv *port_private;
 	unsigned int port_num;
-	u32 port_status, phy_reg_data;
+	u32 phy_reg_data;
 
 	ethernet_private = (ETH_PORT_INFO *) dev->priv;
 	/* ronen - when we update the MAC env params we only update dev->enetaddr
@@ -638,15 +640,6 @@ static int mv64360_eth_free_rx_rings (struct eth_device *dev)
 
 int mv64360_eth_stop (struct eth_device *dev)
 {
-	ETH_PORT_INFO *ethernet_private;
-	struct mv64360_eth_priv *port_private;
-	unsigned int port_num;
-
-	ethernet_private = (ETH_PORT_INFO *) dev->priv;
-	port_private =
-		(struct mv64360_eth_priv *) ethernet_private->port_private;
-	port_num = port_private->port_num;
-
 	/* Disable all gigE address decoder */
 	MV_REG_WRITE (MV64360_ETH_BASE_ADDR_ENABLE_REG, 0x3f);
 	DP (printf ("%s Ethernet stop called ... \n", __FUNCTION__));
@@ -716,7 +709,6 @@ int mv64360_eth_xmit (struct eth_device *dev, volatile void *dataPtr,
 {
 	ETH_PORT_INFO *ethernet_private;
 	struct mv64360_eth_priv *port_private;
-	unsigned int port_num;
 	PKT_INFO pkt_info;
 	ETH_FUNC_RET_STATUS status;
 	struct net_device_stats *stats;
@@ -725,7 +717,6 @@ int mv64360_eth_xmit (struct eth_device *dev, volatile void *dataPtr,
 	ethernet_private = (ETH_PORT_INFO *) dev->priv;
 	port_private =
 		(struct mv64360_eth_priv *) ethernet_private->port_private;
-	port_num = port_private->port_num;
 
 	stats = port_private->stats;
 
@@ -801,7 +792,6 @@ int mv64360_eth_receive (struct eth_device *dev)
 {
 	ETH_PORT_INFO *ethernet_private;
 	struct mv64360_eth_priv *port_private;
-	unsigned int port_num;
 	PKT_INFO pkt_info;
 	struct net_device_stats *stats;
 
@@ -809,7 +799,6 @@ int mv64360_eth_receive (struct eth_device *dev)
 	ethernet_private = (ETH_PORT_INFO *) dev->priv;
 	port_private =
 		(struct mv64360_eth_priv *) ethernet_private->port_private;
-	port_num = port_private->port_num;
 	stats = port_private->stats;
 
 	while ((eth_port_receive (ethernet_private, ETH_Q0, &pkt_info) ==
@@ -900,12 +889,10 @@ static struct net_device_stats *mv64360_eth_get_stats (struct eth_device *dev)
 {
 	ETH_PORT_INFO *ethernet_private;
 	struct mv64360_eth_priv *port_private;
-	unsigned int port_num;
 
 	ethernet_private = (ETH_PORT_INFO *) dev->priv;
 	port_private =
 		(struct mv64360_eth_priv *) ethernet_private->port_private;
-	port_num = port_private->port_num;
 
 	mv64360_eth_update_stat (dev);
 
@@ -927,24 +914,21 @@ static void mv64360_eth_update_stat (struct eth_device *dev)
 	ETH_PORT_INFO *ethernet_private;
 	struct mv64360_eth_priv *port_private;
 	struct net_device_stats *stats;
-	unsigned int port_num;
-	volatile unsigned int dummy;
 
 	ethernet_private = (ETH_PORT_INFO *) dev->priv;
 	port_private =
 		(struct mv64360_eth_priv *) ethernet_private->port_private;
-	port_num = port_private->port_num;
 	stats = port_private->stats;
 
 	/* These are false updates */
 	stats->rx_packets += (unsigned long)
-		eth_read_mib_counter (ethernet_private->port_num,
-				      ETH_MIB_GOOD_FRAMES_RECEIVED);
+		eth_read_mib_counter(ethernet_private->port_num,
+				     ETH_MIB_GOOD_FRAMES_RECEIVED);
 	stats->tx_packets += (unsigned long)
-		eth_read_mib_counter (ethernet_private->port_num,
-				      ETH_MIB_GOOD_FRAMES_SENT);
+		eth_read_mib_counter(ethernet_private->port_num,
+				     ETH_MIB_GOOD_FRAMES_SENT);
 	stats->rx_bytes += (unsigned long)
-		eth_read_mib_counter (ethernet_private->port_num,
+		eth_read_mib_counter(ethernet_private->port_num,
 				      ETH_MIB_GOOD_OCTETS_RECEIVED_LOW);
 	/*
 	 * Ideally this should be as follows -
@@ -956,41 +940,41 @@ static void mv64360_eth_update_stat (struct eth_device *dev)
 	 * But the unsigned long in PowerPC and MIPS are 32bit. So the next read
 	 * is just a dummy read for proper work of the GigE port
 	 */
-	dummy = eth_read_mib_counter (ethernet_private->port_num,
+	port_status = eth_read_mib_counter(ethernet_private->port_num,
 				      ETH_MIB_GOOD_OCTETS_RECEIVED_HIGH);
 	stats->tx_bytes += (unsigned long)
-		eth_read_mib_counter (ethernet_private->port_num,
-				      ETH_MIB_GOOD_OCTETS_SENT_LOW);
-	dummy = eth_read_mib_counter (ethernet_private->port_num,
-				      ETH_MIB_GOOD_OCTETS_SENT_HIGH);
+		eth_read_mib_counter(ethernet_private->port_num,
+				     ETH_MIB_GOOD_OCTETS_SENT_LOW);
+	port_status = eth_read_mib_counter(ethernet_private->port_num,
+					   ETH_MIB_GOOD_OCTETS_SENT_HIGH);
 	stats->rx_errors += (unsigned long)
-		eth_read_mib_counter (ethernet_private->port_num,
-				      ETH_MIB_MAC_RECEIVE_ERROR);
+		eth_read_mib_counter(ethernet_private->port_num,
+				     ETH_MIB_MAC_RECEIVE_ERROR);
 
 	/* Rx dropped is for received packet with CRC error */
 	stats->rx_dropped +=
-		(unsigned long) eth_read_mib_counter (ethernet_private->
-						      port_num,
-						      ETH_MIB_BAD_CRC_EVENT);
+		(unsigned long) eth_read_mib_counter(ethernet_private->
+						     port_num,
+						     ETH_MIB_BAD_CRC_EVENT);
 	stats->multicast += (unsigned long)
-		eth_read_mib_counter (ethernet_private->port_num,
-				      ETH_MIB_MULTICAST_FRAMES_RECEIVED);
+		eth_read_mib_counter(ethernet_private->port_num,
+				     ETH_MIB_MULTICAST_FRAMES_RECEIVED);
 	stats->collisions +=
-		(unsigned long) eth_read_mib_counter (ethernet_private->
-						      port_num,
-						      ETH_MIB_COLLISION) +
-		(unsigned long) eth_read_mib_counter (ethernet_private->
-						      port_num,
-						      ETH_MIB_LATE_COLLISION);
+		(unsigned long) eth_read_mib_counter(ethernet_private->
+						     port_num,
+						     ETH_MIB_COLLISION) +
+		(unsigned long) eth_read_mib_counter(ethernet_private->
+						     port_num,
+						     ETH_MIB_LATE_COLLISION);
 	/* detailed rx errors */
 	stats->rx_length_errors +=
-		(unsigned long) eth_read_mib_counter (ethernet_private->
-						      port_num,
-						      ETH_MIB_UNDERSIZE_RECEIVED)
+		(unsigned long) eth_read_mib_counter(ethernet_private->
+						     port_num,
+						     ETH_MIB_UNDERSIZE_RECEIVED)
 		+
-		(unsigned long) eth_read_mib_counter (ethernet_private->
-						      port_num,
-						      ETH_MIB_OVERSIZE_RECEIVED);
+		(unsigned long) eth_read_mib_counter(ethernet_private->
+						     port_num,
+						     ETH_MIB_OVERSIZE_RECEIVED);
 	/* detailed tx errors */
 }
 
@@ -1009,12 +993,10 @@ static void mv64360_eth_print_stat (struct eth_device *dev)
 	ETH_PORT_INFO *ethernet_private;
 	struct mv64360_eth_priv *port_private;
 	struct net_device_stats *stats;
-	unsigned int port_num;
 
 	ethernet_private = (ETH_PORT_INFO *) dev->priv;
 	port_private =
 		(struct mv64360_eth_priv *) ethernet_private->port_private;
-	port_num = port_private->port_num;
 	stats = port_private->stats;
 
 	/* These are false updates */
@@ -2066,12 +2048,11 @@ static void eth_port_init_mac_tables (ETH_PORT eth_port_num)
 static void eth_clear_mib_counters (ETH_PORT eth_port_num)
 {
 	int i;
-	unsigned int dummy;
 
 	/* Perform dummy reads from MIB counters */
 	for (i = ETH_MIB_GOOD_OCTETS_RECEIVED_LOW; i < ETH_MIB_LATE_COLLISION;
 	     i += 4)
-		dummy = MV_REG_READ ((MV64360_ETH_MIB_COUNTERS_BASE
+		port_status = MV_REG_READ((MV64360_ETH_MIB_COUNTERS_BASE
 				      (eth_port_num) + i));
 
 	return;



More information about the U-Boot mailing list