Skip to contentSkip to conversation

CLEANUP: Cleanup of misc remaining things found

PATCH New Marek Vasut 2 participants 15 messages Oct 25, 2011 – Oct 27, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover CLEANUP: Cleanup of misc remaining things found

This series fixes the warnings generated by new debug() macro implementation, which will be merged after this series. This series fixes the problems before the macro is reworked to avoid smooth transition. Most of the problems fixed by this series are printf() formating related problems.

Marek Vasut (7):
GCC4.6: Squash warnings in LzmaTools.c
GCC4.6: Drop dead code from yaffs_guts.c
GCC4.6: Squash warnings in yaffs_guts.c
GCC4.6: Squash warning in tegra2 board.c
GCC4.6: Squash warnings in omap4 clocks.c
GCC4.6: Remove debugX() usage from spc1920 hpi
DEBUG: Fix debug macros

 arch/arm/cpu/armv7/omap4/clocks.c |    4 +-
 arch/arm/cpu/armv7/tegra2/board.c |    2 +-
 board/spc1920/hpi.c               |   68 ++++++++--------
 fs/yaffs2/yaffs_guts.c            |  161 ++-----------------------------------
 include/common.h                  |   26 ++++---
 lib/lzma/LzmaTools.c              |   14 ++--
 6 files changed, 66 insertions(+), 209 deletions(-)
Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
Signature · 1 line
1.7.6.3
#1 lore raw

PATCH 1/7 GCC4.6: Squash warnings in LzmaTools.c

LzmaTools.c: In function 'lzmaBuffToBuffDecompress':
LzmaTools.c:70:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *'
LzmaTools.c:71:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *'
LzmaTools.c:72:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *'
LzmaTools.c:73:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *'
LzmaTools.c:74:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *'
LzmaTools.c:110:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'SizeT'
LzmaTools.c:111:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'SizeT'

Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 lib/lzma/LzmaTools.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
lib/lzma/LzmaTools.c +7 -7
index 8860bfb..2eafad2 100644
@@ -67,11 +67,11 @@ int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize,
     ELzmaStatus state;
     SizeT compressedSize = (SizeT)(length - LZMA_PROPS_SIZE);
 
-    debug ("LZMA: Image address............... 0x%lx\n", inStream);
-    debug ("LZMA: Properties address.......... 0x%lx\n", inStream + LZMA_PROPERTIES_OFFSET);
-    debug ("LZMA: Uncompressed size address... 0x%lx\n", inStream + LZMA_SIZE_OFFSET);
-    debug ("LZMA: Compressed data address..... 0x%lx\n", inStream + LZMA_DATA_OFFSET);
-    debug ("LZMA: Destination address......... 0x%lx\n", outStream);
+    debug ("LZMA: Image address............... 0x%p\n", inStream);
+    debug ("LZMA: Properties address.......... 0x%p\n", inStream + LZMA_PROPERTIES_OFFSET);
+    debug ("LZMA: Uncompressed size address... 0x%p\n", inStream + LZMA_SIZE_OFFSET);
+    debug ("LZMA: Compressed data address..... 0x%p\n", inStream + LZMA_DATA_OFFSET);
+    debug ("LZMA: Destination address......... 0x%p\n", outStream);
 
     memset(&state, 0, sizeof(state));
 
@@ -107,8 +107,8 @@ int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize,
         }
     }
 
-    debug ("LZMA: Uncompresed size............ 0x%lx\n", outSizeFull);
-    debug ("LZMA: Compresed size.............. 0x%lx\n", compressedSize);
+    debug ("LZMA: Uncompresed size............ 0x%x\n", outSizeFull);
+    debug ("LZMA: Compresed size.............. 0x%x\n", compressedSize);
 
     g_Alloc.Alloc = SzAlloc;
     g_Alloc.Free = SzFree;
Signature · 1 line
1.7.6.3
#2 lore raw

PATCH 1/7 GCC4.6: Squash warnings in LzmaTools.c

Dear Marek Vasut,

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

LzmaTools.c: In function 'lzmaBuffToBuffDecompress':
LzmaTools.c:70:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *'
LzmaTools.c:71:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *'
LzmaTools.c:72:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *'
LzmaTools.c:73:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *'
LzmaTools.c:74:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *'
LzmaTools.c:110:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'SizeT'
LzmaTools.c:111:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'SizeT'

Quoted 7 lines
Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 lib/lzma/LzmaTools.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 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
O Staat!   Wie tief dir alle Besten fluchen!  Du bist kein Ziel.  Der
Mensch mu? weiter suchen.                     - Christian Morgenstern
#3 lore raw

PATCH 2/7 GCC4.6: Drop dead code from yaffs_guts.c

In reply to Marek Vasut

Drop yaffs_DeleteWorker():
yaffs_guts.c:1556:12: warning: 'yaffs_DeleteWorker' defined but not used

Drop yaffs_VerifyTnodeWorker():
yaffs_guts.c:600:12: warning: 'yaffs_VerifyTnodeWorker' defined but not used

Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 fs/yaffs2/yaffs_guts.c |  149 ------------------------------------------------
 1 files changed, 0 insertions(+), 149 deletions(-)
fs/yaffs2/yaffs_guts.c +0 -149
index c67a085..68422e2 100644
@@ -78,8 +78,6 @@ static int yaffs_UpdateObjectHeader(yaffs_Object * in, const YCHAR * name,
 				    int force, int isShrink, int shadows);
 static void yaffs_RemoveObjectFromDirectory(yaffs_Object * obj);
 static int yaffs_CheckStructures(void);
-static int yaffs_DeleteWorker(yaffs_Object * in, yaffs_Tnode * tn, __u32 level,
-			      int chunkOffset, int *limit);
 static int yaffs_DoGenericObjectDeletion(yaffs_Object * in);
 
 static yaffs_BlockInfo *yaffs_GetBlockInfo(yaffs_Device * dev, int blockNo);
@@ -595,55 +593,6 @@ static void yaffs_VerifyObjectHeader(yaffs_Object *obj, yaffs_ObjectHeader *oh,
 		 obj->objectId));
 }
 
-
-
-static int yaffs_VerifyTnodeWorker(yaffs_Object * obj, yaffs_Tnode * tn,
-					__u32 level, int chunkOffset)
-{
-	int i;
-	yaffs_Device *dev = obj->myDev;
-	int ok = 1;
-
-	if (tn) {
-		if (level > 0) {
-
-			for (i = 0; i < YAFFS_NTNODES_INTERNAL && ok; i++){
-				if (tn->internal[i]) {
-					ok = yaffs_VerifyTnodeWorker(obj,
-							tn->internal[i],
-							level - 1,
-							(chunkOffset<<YAFFS_TNODES_INTERNAL_BITS) + i);
-				}
-			}
-		} else if (level == 0) {
-			int i;
-			yaffs_ExtendedTags tags;
-			__u32 objectId = obj->objectId;
-
-			chunkOffset <<=  YAFFS_TNODES_LEVEL0_BITS;
-
-			for(i = 0; i < YAFFS_NTNODES_LEVEL0; i++){
-				__u32 theChunk = yaffs_GetChunkGroupBase(dev,tn,i);
-
-				if(theChunk > 0){
-					/* T(~0,(TSTR("verifying (%d:%d) %d"TENDSTR),tags.objectId,tags.chunkId,theChunk)); */
-					yaffs_ReadChunkWithTagsFromNAND(dev,theChunk,NULL, &tags);
-					if(tags.objectId != objectId || tags.chunkId != chunkOffset){
-						T(~0,(TSTR("Object %d chunkId %d NAND mismatch chunk %d tags (%d:%d)"TENDSTR),
-							objectId, chunkOffset, theChunk,
-							tags.objectId, tags.chunkId));
-					}
-				}
-				chunkOffset++;
-			}
-		}
-	}
-
-	return ok;
-
-}
-
-
 static void yaffs_VerifyFile(yaffs_Object *obj)
 {
 	int requiredTallness;
@@ -1546,104 +1495,6 @@ static int yaffs_FindChunkInGroup(yaffs_Device * dev, int theChunk,
 	return -1;
 }
 
-
-/* DeleteWorker scans backwards through the tnode tree and deletes all the
- * chunks and tnodes in the file
- * Returns 1 if the tree was deleted.
- * Returns 0 if it stopped early due to hitting the limit and the delete is incomplete.
- */
-
-static int yaffs_DeleteWorker(yaffs_Object * in, yaffs_Tnode * tn, __u32 level,
-			      int chunkOffset, int *limit)
-{
-	int i;
-	int chunkInInode;
-	int theChunk;
-	yaffs_ExtendedTags tags;
-	int foundChunk;
-	yaffs_Device *dev = in->myDev;
-
-	int allDone = 1;
-
-	if (tn) {
-		if (level > 0) {
-
-			for (i = YAFFS_NTNODES_INTERNAL - 1; allDone && i >= 0;
-			     i--) {
-				if (tn->internal[i]) {
-					if (limit && (*limit) < 0) {
-						allDone = 0;
-					} else {
-						allDone =
-						    yaffs_DeleteWorker(in,
-								       tn->
-								       internal
-								       [i],
-								       level -
-								       1,
-								       (chunkOffset
-									<<
-									YAFFS_TNODES_INTERNAL_BITS)
-								       + i,
-								       limit);
-					}
-					if (allDone) {
-						yaffs_FreeTnode(dev,
-								tn->
-								internal[i]);
-						tn->internal[i] = NULL;
-					}
-				}
-
-			}
-			return (allDone) ? 1 : 0;
-		} else if (level == 0) {
-			int hitLimit = 0;
-
-			for (i = YAFFS_NTNODES_LEVEL0 - 1; i >= 0 && !hitLimit;
-			     i--) {
-				theChunk = yaffs_GetChunkGroupBase(dev,tn,i);
-				if (theChunk) {
-
-					chunkInInode =
-					    (chunkOffset <<
-					     YAFFS_TNODES_LEVEL0_BITS) + i;
-
-					foundChunk =
-					    yaffs_FindChunkInGroup(dev,
-								   theChunk,
-								   &tags,
-								   in->objectId,
-								   chunkInInode);
-
-					if (foundChunk > 0) {
-						yaffs_DeleteChunk(dev,
-								  foundChunk, 1,
-								  __LINE__);
-						in->nDataChunks--;
-						if (limit) {
-							*limit = *limit - 1;
-							if (*limit <= 0) {
-								hitLimit = 1;
-							}
-						}
-
-					}
-
-					yaffs_PutLevel0Tnode(dev,tn,i,0);
-				}
-
-			}
-			return (i < 0) ? 1 : 0;
-
-		}
-
-	}
-
-	return 1;
-
-}
-
 static void yaffs_SoftDeleteChunk(yaffs_Device * dev, int chunk)
 {
 
Signature · 1 line
1.7.6.3
#4 lore raw

PATCH 2/7 GCC4.6: Drop dead code from yaffs_guts.c

Dear Marek Vasut,

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

Drop yaffs_DeleteWorker():
yaffs_guts.c:1556:12: warning: 'yaffs_DeleteWorker' defined but not used

Drop yaffs_VerifyTnodeWorker():
yaffs_guts.c:600:12: warning: 'yaffs_VerifyTnodeWorker' defined but not used

Quoted 7 lines
Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 fs/yaffs2/yaffs_guts.c |  149 ------------------------------------------------
 1 files changed, 0 insertions(+), 149 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 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
"Spock, did you see the looks on their faces?"
"Yes, Captain, a sort of vacant contentment."
#5 lore raw

PATCH 3/7 GCC4.6: Squash warnings in yaffs_guts.c

In reply to Marek Vasut

yaffs_guts.c: In function 'yaffs_ReadDataFromFile':
yaffs_guts.c:4461:8: warning: 'chunk' may be used uninitialized in this function yaffs_guts.c:4462:8: warning: 'start' may be used uninitialized in this function yaffs_guts.c: In function 'yaffs_WriteDataToFile':
yaffs_guts.c:4581:8: warning: 'chunk' may be used uninitialized in this function yaffs_guts.c:4582:8: warning: 'start' may be used uninitialized in this function yaffs_guts.c: In function 'yaffs_ResizeFile':
yaffs_guts.c:4816:8: warning: 'newSizeOfPartialChunk' may be used uninitialized in this function
yaffs_guts.c:4817:8: warning: 'newFullChunks' may be used uninitialized in this function

Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
Cc William Juul <[email protected]>
---
 fs/yaffs2/yaffs_guts.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
fs/yaffs2/yaffs_guts.c +6 -6
index 68422e2..c4329af 100644
@@ -4456,8 +4456,8 @@ int yaffs_ReadDataFromFile(yaffs_Object * in, __u8 * buffer, loff_t offset,
 			   int nBytes)
 {
 
-	__u32 chunk;
-	__u32 start;
+	__u32 chunk = 0;
+	__u32 start = 0;
 	int nToCopy;
 	int n = nBytes;
 	int nDone = 0;
@@ -4576,8 +4576,8 @@ int yaffs_WriteDataToFile(yaffs_Object * in, const __u8 * buffer, loff_t offset,
 			  int nBytes, int writeThrough)
 {
 
-	__u32 chunk;
-	__u32 start;
+	__u32 chunk = 0;
+	__u32 start = 0;
 	int nToCopy;
 	int n = nBytes;
 	int nDone = 0;
@@ -4811,8 +4811,8 @@ int yaffs_ResizeFile(yaffs_Object * in, loff_t newSize)
 {
 
 	int oldFileSize = in->variant.fileVariant.fileSize;
-	__u32 newSizeOfPartialChunk;
-	__u32 newFullChunks;
+	__u32 newSizeOfPartialChunk = 0;
+	__u32 newFullChunks = 0;
 
 	yaffs_Device *dev = in->myDev;
 
Signature · 1 line
1.7.6.3
#6 lore raw

PATCH 3/7 GCC4.6: Squash warnings in yaffs_guts.c

Dear Marek Vasut,

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

yaffs_guts.c: In function 'yaffs_ReadDataFromFile':
yaffs_guts.c:4461:8: warning: 'chunk' may be used uninitialized in this function yaffs_guts.c:4462:8: warning: 'start' may be used uninitialized in this function yaffs_guts.c: In function 'yaffs_WriteDataToFile':
yaffs_guts.c:4581:8: warning: 'chunk' may be used uninitialized in this function yaffs_guts.c:4582:8: warning: 'start' may be used uninitialized in this function yaffs_guts.c: In function 'yaffs_ResizeFile':
yaffs_guts.c:4816:8: warning: 'newSizeOfPartialChunk' may be used uninitialized in this function
yaffs_guts.c:4817:8: warning: 'newFullChunks' may be used uninitialized in this function

Quoted 8 lines
Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
Cc William Juul <[email protected]>
---
 fs/yaffs2/yaffs_guts.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 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
I'm frequently appalled by the low regard you Earthmen have for life.
	-- Spock, "The Galileo Seven", stardate 2822.3
#7 lore raw

PATCH 4/7 GCC4.6: Squash warning in tegra2 board.c

In reply to Marek Vasut

board.c:43:2: warning: format '%08lX' expects type 'long unsigned int', but argument 2 has type 'u32'

Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 arch/arm/cpu/armv7/tegra2/board.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/tegra2/board.c +1 -1
index 9061d18..751102d 100644
@@ -40,7 +40,7 @@ unsigned int query_sdram_size(void)
 	u32 reg;
 
 	reg = readl(&pmc->pmc_scratch20);
-	debug("pmc->pmc_scratch20 (ODMData) = 0x%08lX\n", reg);
+	debug("pmc->pmc_scratch20 (ODMData) = 0x%08x\n", reg);
 
 	/* bits 31:28 in OdmData are used for RAM size  */
 	switch ((reg) >> 28) {
Signature · 1 line
1.7.6.3
#8 lore raw

PATCH 4/7 GCC4.6: Squash warning in tegra2 board.c

Dear Marek Vasut,

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

board.c:43:2: warning: format '%08lX' expects type 'long unsigned int', but argument 2 has type 'u32'

Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 arch/arm/cpu/armv7/tegra2/board.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 8 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
Ill-chosen abstraction is particularly evident in the design  of  the
ADA  runtime  system.  The  interface to the ADA runtime system is so
opaque that it is impossible to model  or  predict  its  performance,
making it effectively useless for real-time systems.
                              - Marc D.  Donner and David H. Jameson.
#9 lore raw

PATCH 5/7 GCC4.6: Squash warnings in omap4 clocks.c

In reply to Marek Vasut

clocks.c:606:2: warning: format '%08x' expects type 'unsigned int', but argument 2 has type 'u32 * const'
clocks.c:633:2: warning: format '%08x' expects type 'unsigned int', but argument 2 has type 'u32 * const'

Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 arch/arm/cpu/armv7/omap4/clocks.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/omap4/clocks.c +2 -2
index 4f0e0cd..095ba39 100644
@@ -603,7 +603,7 @@ static inline void enable_clock_domain(u32 *const clkctrl_reg, u32 enable_mode)
 {
 	clrsetbits_le32(clkctrl_reg, CD_CLKCTRL_CLKTRCTRL_MASK,
 			enable_mode << CD_CLKCTRL_CLKTRCTRL_SHIFT);
-	debug("Enable clock domain - 0x%08x\n", clkctrl_reg);
+	debug("Enable clock domain - %p\n", clkctrl_reg);
 }
 
 static inline void wait_for_clk_enable(u32 *clkctrl_addr)
@@ -630,7 +630,7 @@ static inline void enable_clock_module(u32 *const clkctrl_addr, u32 enable_mode,
 {
 	clrsetbits_le32(clkctrl_addr, MODULE_CLKCTRL_MODULEMODE_MASK,
 			enable_mode << MODULE_CLKCTRL_MODULEMODE_SHIFT);
-	debug("Enable clock module - 0x%08x\n", clkctrl_addr);
+	debug("Enable clock module - %p\n", clkctrl_addr);
 	if (wait_for_enable)
 		wait_for_clk_enable(clkctrl_addr);
 }
Signature · 1 line
1.7.6.3
#10 lore raw

PATCH 5/7 GCC4.6: Squash warnings in omap4 clocks.c

Dear Marek Vasut,

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

clocks.c:606:2: warning: format '%08x' expects type 'unsigned int', but argument 2 has type 'u32 * const'
clocks.c:633:2: warning: format '%08x' expects type 'unsigned int', but argument 2 has type 'u32 * const'

Quoted 7 lines
Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 arch/arm/cpu/armv7/omap4/clocks.c |    4 ++--
 1 files changed, 2 insertions(+), 2 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
There are 2 Kinds of planes: Fighters, and targets.
There are 2 Kinds of boats: Submarines, and targets.
There are 2 Kinds of 4x4's: Jeeps and SOB's (Some other brand)
There are 2 Kinds of OS's: Unix, and brain-farts.
#11 lore raw

PATCH 6/7 GCC4.6: Remove debugX() usage from spc1920 hpi

In reply to Marek Vasut
Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 board/spc1920/hpi.c |   68 +++++++++++++++++++++++++-------------------------
 1 files changed, 34 insertions(+), 34 deletions(-)
board/spc1920/hpi.c +34 -34
index 26d0f9c..9d8ec10 100644
@@ -234,13 +234,13 @@ static int hpi_write_inc(u32 addr, u32 *data, u32 count)
 	HPI_HPIA_1 = addr1;
 	HPI_HPIA_2 = addr2;
 
-	debugX(4, "writing from data=0x%lx to 0x%lx\n",
+	debug("writing from data=0x%lx to 0x%lx\n",
 		(ulong)data, (ulong)(data+count));
 
 	for(i=0; i<count; i++) {
 		HPI_HPID_INC_1 = (u16) ((data[i] >> 16) & 0xffff);
 		HPI_HPID_INC_2 = (u16) (data[i] & 0xffff);
-		debugX(4, "hpi_write_inc: data1=0x%x, data2=0x%x\n",
+		debug("hpi_write_inc: data1=0x%x, data2=0x%x\n",
 		       (u16) ((data[i] >> 16) & 0xffff),
 		       (u16) (data[i] & 0xffff));
 	}
@@ -273,7 +273,7 @@ static int hpi_read_inc(u32 addr, u32 *buf, u32 count)
 	for(i=0; i<count; i++) {
 		data1 = HPI_HPID_INC_1;
 		data2 = HPI_HPID_INC_2;
-		debugX(4, "hpi_read_inc: data1=0x%x, data2=0x%x\n", data1, data2);
+		debug("hpi_read_inc: data1=0x%x, data2=0x%x\n", data1, data2);
 		buf[i] = (((u32) data1) << 16) | (data2 & 0xffff);
 	}
 
@@ -354,9 +354,9 @@ int hpi_test(void)
 	u32 test_data[HPI_TEST_CHUNKSIZE];
 	u32 read_data[HPI_TEST_CHUNKSIZE];
 
-	debugX(2, "hpi_test: activating hpi...");
+	debug("hpi_test: activating hpi...");
 	hpi_activate();
-	debugX(2, "OK.\n");
+	debug("OK.\n");
 
 #if 0
 	/* Dump the first 1024 bytes
@@ -372,22 +372,22 @@ int hpi_test(void)
 	/* HPIA read-write test
 	 *
 	 */
-	debugX(1, "hpi_test: starting HPIA read-write tests...\n");
+	debug("hpi_test: starting HPIA read-write tests...\n");
 	err |= hpi_write_addr_test(0xdeadc0de);
 	err |= hpi_write_addr_test(0xbeefd00d);
 	err |= hpi_write_addr_test(0xabcd1234);
 	err |= hpi_write_addr_test(0xaaaaaaaa);
 	if(err) {
-		debugX(1, "hpi_test: HPIA read-write tests: *** FAILED ***\n");
+		debug("hpi_test: HPIA read-write tests: *** FAILED ***\n");
 		return -1;
 	}
-	debugX(1, "hpi_test: HPIA read-write tests: OK\n");
+	debug("hpi_test: HPIA read-write tests: OK\n");
 
 
 	/* read write test using nonincremental data regs
 	 *
 	 */
-	debugX(1, "hpi_test: starting nonincremental tests...\n");
+	debug("hpi_test: starting nonincremental tests...\n");
 	for(i=HPI_TEST_START; i<HPI_TEST_END; i+=4) {
 		err |= hpi_read_write_test(i, pattern);
 
@@ -400,16 +400,16 @@ int hpi_test(void)
 		err |= hpi_read_write_test(i, pattern);
 
 		if(err) {
-			debugX(1, "hpi_test: nonincremental tests *** FAILED ***\n");
+			debug("hpi_test: nonincremental tests *** FAILED ***\n");
 			return -1;
 		}
 	}
-	debugX(1, "hpi_test: nonincremental test OK\n");
+	debug("hpi_test: nonincremental test OK\n");
 
 	/* read write a chunk of data using nonincremental data regs
 	 *
 	 */
-	debugX(1, "hpi_test: starting nonincremental chunk tests...\n");
+	debug("hpi_test: starting nonincremental chunk tests...\n");
 	pattern = HPI_TEST_PATTERN;
 	for(i=HPI_TEST_START; i<HPI_TEST_END; i+=4) {
 		hpi_write_noinc(i, pattern);
@@ -426,7 +426,7 @@ int hpi_test(void)
 		tmp = hpi_read_noinc(i);
 
 		if(tmp != pattern) {
-			debugX(1, "hpi_test: noninc chunk test *** FAILED *** @ 0x%x, written=0x%x, read=0x%x\n", i, pattern, tmp);
+			debug("hpi_test: noninc chunk test *** FAILED *** @ 0x%x, written=0x%x, read=0x%x\n", i, pattern, tmp);
 			err = -1;
 		}
 		/* stolen from cmd_mem.c */
@@ -438,23 +438,23 @@ int hpi_test(void)
 	}
 	if(err)
 		return -1;
-	debugX(1, "hpi_test: nonincremental chunk test OK\n");
+	debug("hpi_test: nonincremental chunk test OK\n");
 
 
 #ifdef DO_TINY_TEST
 	/* small verbose test using autoinc and nonautoinc to compare
 	 *
 	 */
-	debugX(1, "hpi_test: tiny_autoinc_test...\n");
+	debug("hpi_test: tiny_autoinc_test...\n");
 	hpi_tiny_autoinc_test();
-	debugX(1, "hpi_test: tiny_autoinc_test done\n");
+	debug("hpi_test: tiny_autoinc_test done\n");
 #endif /* DO_TINY_TEST */
 
 
 	/* $%& write a chunk of data using the autoincremental regs
 	 *
 	 */
-	debugX(1, "hpi_test: starting autoinc test %d chunks with 0x%x bytes...\n",
+	debug("hpi_test: starting autoinc test %d chunks with 0x%x bytes...\n",
 	       ((HPI_TEST_END - HPI_TEST_START) / HPI_TEST_CHUNKSIZE),
 	       HPI_TEST_CHUNKSIZE);
 
@@ -462,9 +462,9 @@ int hpi_test(void)
 	    i < ((HPI_TEST_END - HPI_TEST_START) / HPI_TEST_CHUNKSIZE);
 	    i++) {
 		/* generate the pattern data */
-		debugX(3, "generating pattern data: ");
+		debug("generating pattern data: ");
 		for(ii = 0; ii < HPI_TEST_CHUNKSIZE; ii++) {
-			debugX(3, "0x%x ", pattern);
+			debug("0x%x ", pattern);
 
 			test_data[ii] = pattern;
 			read_data[ii] = 0x0; /* zero to be sure */
@@ -476,24 +476,24 @@ int hpi_test(void)
 				pattern = ~pattern;
 			}
 		}
-		debugX(3, "done\n");
+		debug("done\n");
 
-		debugX(2, "Writing autoinc data @ 0x%x\n", i);
+		debug("Writing autoinc data @ 0x%x\n", i);
 		hpi_write_inc(i, test_data, HPI_TEST_CHUNKSIZE);
 
-		debugX(2, "Reading autoinc data @ 0x%x\n", i);
+		debug("Reading autoinc data @ 0x%x\n", i);
 		hpi_read_inc(i, read_data, HPI_TEST_CHUNKSIZE);
 
 		/* compare */
 		for(ii = 0; ii < HPI_TEST_CHUNKSIZE; ii++) {
-			debugX(3, "hpi_test_autoinc: @ 0x%x, written=0x%x, read=0x%x", i+ii, test_data[ii], read_data[ii]);
+			debug("hpi_test_autoinc: @ 0x%x, written=0x%x, read=0x%x", i+ii, test_data[ii], read_data[ii]);
 			if(read_data[ii] != test_data[ii]) {
-				debugX(0, "hpi_test: autoinc test @ 0x%x, written=0x%x, read=0x%x *** FAILED ***\n", i+ii, test_data[ii], read_data[ii]);
+				debug("hpi_test: autoinc test @ 0x%x, written=0x%x, read=0x%x *** FAILED ***\n", i+ii, test_data[ii], read_data[ii]);
 				return -1;
 			}
 		}
 	}
-	debugX(1, "hpi_test: autoinc test OK\n");
+	debug("hpi_test: autoinc test OK\n");
 
 	return 0;
 }
@@ -510,22 +510,22 @@ int hpi_test(void)
 		0x0009000a, 0x000b000c, 0x000d000e, 0x000f0001
 	};
 
-	debugX(0, "hpi_test: activating hpi...");
+	debug("hpi_test: activating hpi...");
 	hpi_activate();
-	debugX(0, "OK.\n");
+	debug("OK.\n");
 
 	while(1) {
 		led9(1);
-		debugX(0, " writing to autoinc...\n");
+		debug(" writing to autoinc...\n");
 		hpi_write_inc(TINY_AUTOINC_BASE_ADDR,
 			      dummy_data, TINY_AUTOINC_DATA_SIZE);
 
-		debugX(0, " reading from autoinc...\n");
+		debug(" reading from autoinc...\n");
 		hpi_read_inc(TINY_AUTOINC_BASE_ADDR,
 			     read_data, TINY_AUTOINC_DATA_SIZE);
 
 		for(i=0; i < (TINY_AUTOINC_DATA_SIZE); i++) {
-			debugX(0, " written=0x%x, read(inc)=0x%x\n",
+			debug(" written=0x%x, read(inc)=0x%x\n",
 			       dummy_data[i], read_data[i]);
 		}
 		led9(0);
@@ -546,11 +546,11 @@ static int hpi_write_addr_test(u32 addr)
 	read_back = (((u32) HPI_HPIA_1)<<16) | ((u32) HPI_HPIA_2);
 
 	if(read_back == addr) {
-		debugX(2, " hpi_write_addr_test OK: written=0x%x, read=0x%x\n",
+		debug(" hpi_write_addr_test OK: written=0x%x, read=0x%x\n",
 		       addr, read_back);
 		return 0;
 	} else {
-		debugX(0, " hpi_write_addr_test *** FAILED ***: written=0x%x, read=0x%x\n",
+		debug(" hpi_write_addr_test *** FAILED ***: written=0x%x, read=0x%x\n",
 		      addr, read_back);
 		return -1;
 	}
@@ -567,10 +567,10 @@ static int hpi_read_write_test(u32 addr, u32 data)
 	read_back = hpi_read_noinc(addr);
 
 	if(read_back == data) {
-		debugX(2, " hpi_read_write_test: OK, addr=0x%x written=0x%x, read=0x%x\n", addr, data, read_back);
+		debug(" hpi_read_write_test: OK, addr=0x%x written=0x%x, read=0x%x\n", addr, data, read_back);
 		return 0;
 	} else {
-		debugX(0, " hpi_read_write_test: *** FAILED ***, addr=0x%x written=0x%x, read=0x%x\n", addr, data, read_back);
+		debug(" hpi_read_write_test: *** FAILED ***, addr=0x%x written=0x%x, read=0x%x\n", addr, data, read_back);
 		return -1;
 	}
 
Signature · 1 line
1.7.6.3
#12 lore raw

PATCH 6/7 GCC4.6: Remove debugX() usage from spc1920 hpi

Dear Marek Vasut,

Quoted 7 lines · In message <[email protected]> you wrote:
Cc Wolfgang Denk <[email protected]>
Cc Simon Glass <[email protected]>
Cc Mike Frysinger <[email protected]>
---
 board/spc1920/hpi.c |   68 +++++++++++++++++++++++++-------------------------
 1 files changed, 34 insertions(+), 34 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 9 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
I don't care if you *ARE* on a bondage-and-discipline  post-technical
system  pawned off by the nation's largest oughta-be-illegal monopoly
who cannot escape the sins of their forefathers -- namely, using  the
wrong  slash for directories when the C language and its brethren use
it for something else that's very important.
         -- Tom Christiansen in <[email protected]>
#13 lore raw

PATCH 7/7 DEBUG: Fix debug macros

In reply to Marek Vasut

The current implementation of debug doesn't play well with GCC4.6. This implementation also fixes GCC4.6 complaints about unused variables while maintaining code size.

Also, drop the debugX() as that's not used anywhere anymore.

---
 include/common.h |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)
include/common.h +16 -10
index a1683a2..e0d0af6 100644
@@ -116,21 +116,27 @@ typedef volatile unsigned char	vu_char;
 #include <flash.h>
 #include <image.h>
 
-#ifdef	DEBUG
-#define debug(fmt,args...)	printf (fmt ,##args)
-#define debugX(level,fmt,args...) if (DEBUG>=level) printf(fmt,##args);
-#else
-#define debug(fmt,args...)
-#define debugX(level,fmt,args...)
-#endif	/* DEBUG */
-
 #ifdef DEBUG
-# define _DEBUG 1
+#define _DEBUG	1
 #else
-# define _DEBUG 0
+#define _DEBUG	0
 #endif
 
 /*
+ * Output a debug text when condition "cond" is met. The "cond" should be
+ * computed by a preprocessor in the best case, allowing for the best
+ * optimization.
+ */
+#define debug_cond(cond, fmt, args...)		\
+	do {					\
+		if (cond)			\
+			printf(fmt, ##args);	\
+	} while (0)
+
+#define debug(fmt, args...)			\
+	debug_cond(_DEBUG, fmt, ##args)
+
+/*
  * An assertion is run-time check done in debug mode only. If DEBUG is not
  * defined then it is skipped. If DEBUG is defined and the assertion fails,
  * then it calls panic*( which may or may not reset/halt U-Boot (see
Signature · 1 line
1.7.6.3
#14 lore raw

PATCH 7/7 DEBUG: Fix debug macros

Dear Marek Vasut,

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

The current implementation of debug doesn't play well with GCC4.6. This implementation also fixes GCC4.6 complaints about unused variables while maintaining code size.

Also, drop the debugX() as that's not used anywhere anymore.

Quoted 7 lines
---
 include/common.h |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 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
Worlds may change, galaxies disintegrate, but a woman always  remains
a woman.
	-- Kirk, "The Conscience of the King", stardate 2818.9