[U-Boot] [PATCH v2 09/10] net: cosmetic: tftp.* checkpatch compliance

Joe Hershberger joe.hershberger at ni.com
Wed Mar 28 01:42:23 CEST 2012


Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
Cc: Joe Hershberger <joe.hershberger at gmail.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Mike Frysinger <vapier at gentoo.org>
---
Changes for v2:
   - Split into smaller patches

 include/net.h |    4 ++++
 net/tftp.c    |   30 ++++++++++++++----------------
 net/tftp.h    |    2 +-
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/include/net.h b/include/net.h
index f87ef8c..e39d88b 100644
--- a/include/net.h
+++ b/include/net.h
@@ -395,6 +395,10 @@ extern IPaddr_t	NetNtpServerIP;			/* the ip address to NTP */
 extern int NetTimeOffset;			/* offset time from UTC */
 #endif
 
+#if defined(CONFIG_MCAST_TFTP)
+extern IPaddr_t Mcast_addr;
+#endif
+
 /* Initialize the network adapter */
 extern int NetLoop(enum proto_t);
 
diff --git a/net/tftp.c b/net/tftp.c
index e62f229..bc7fe05 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -11,6 +11,9 @@
 #include <net.h>
 #include "tftp.h"
 #include "bootp.h"
+#ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
+#include <flash.h>
+#endif
 
 /* Well known TFTP port # */
 #define WELL_KNOWN_PORT	69
@@ -112,10 +115,6 @@ static char default_filename[DEFAULT_NAME_LEN];
 
 static char tftp_filename[MAX_LEN];
 
-#ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
-extern flash_info_t flash_info[];
-#endif
-
 /* 512 is poor choice for ethernet, MTU is typically 1500.
  * Minus eth.hdrs thats 1468.  Can get 2x better throughput with
  * almost-MTU block sizes.  At least try... fall back to 512 if need be.
@@ -137,7 +136,6 @@ static unsigned *Bitmap;
 static int PrevBitmapHole, Mapsize = MTFTP_BITMAPSIZE;
 static uchar ProhibitMcast, MasterClient;
 static uchar Multicast;
-extern IPaddr_t Mcast_addr;
 static int Mcast_port;
 static ulong TftpEndingBlock; /* can get 'last' block before done..*/
 
@@ -157,7 +155,7 @@ mcast_cleanup(void)
 
 #endif	/* CONFIG_MCAST_TFTP */
 
-static __inline__ void
+static inline void
 store_block(unsigned block, uchar *src, unsigned len)
 {
 	ulong offset = block * TftpBlkSize + TftpBlockWrapOffset;
@@ -182,8 +180,7 @@ store_block(unsigned block, uchar *src, unsigned len)
 			NetState = NETLOOP_FAIL;
 			return;
 		}
-	}
-	else
+	} else
 #endif /* CONFIG_SYS_DIRECT_FLASH_TFTP */
 	{
 		(void)memcpy((void *)(load_addr + offset), src, len);
@@ -357,12 +354,14 @@ TftpSend(void)
 				0, TftpBlkSizeOption, 0);
 #ifdef CONFIG_MCAST_TFTP
 		/* Check all preconditions before even trying the option */
-		if (!ProhibitMcast
-		 && (Bitmap = malloc(Mapsize))
-		 && eth_get_dev()->mcast) {
-			free(Bitmap);
-			Bitmap = NULL;
-			pkt += sprintf((char *)pkt, "multicast%c%c", 0, 0);
+		if (!ProhibitMcast) {
+			Bitmap = malloc(Mapsize);
+			if (Bitmap && eth_get_dev()->mcast) {
+				free(Bitmap);
+				Bitmap = NULL;
+				pkt += sprintf((char *)pkt, "multicast%c%c",
+					0, 0);
+			}
 		}
 #endif /* CONFIG_MCAST_TFTP */
 		len = pkt - xp;
@@ -630,8 +629,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
 				mcast_cleanup();
 				NetState = NETLOOP_SUCCESS;
 			}
-		}
-		else
+		} else
 #endif
 		if (len < TftpBlkSize)
 			tftp_complete();
diff --git a/net/tftp.h b/net/tftp.h
index c51aa25..18e4c9c 100644
--- a/net/tftp.h
+++ b/net/tftp.h
@@ -19,7 +19,7 @@
 void TftpStart(enum proto_t protocol);	/* Begin TFTP get/put */
 
 #ifdef CONFIG_CMD_TFTPSRV
-extern void	TftpStartServer(void);	/* Wait for incoming TFTP put */
+extern void TftpStartServer(void);	/* Wait for incoming TFTP put */
 #endif
 
 /**********************************************************************/
-- 
1.6.0.2



More information about the U-Boot mailing list