DEBUG macro

Vernon Sauder vernoninhand at
Thu Nov 6 21:07:01 EST 2008


The MTD code uses DEBUG as a print macro but the rest of the kernel code
expects it to be a flag that enables pr_debug. This causes a warning
(DEBUG redefined) when including mtd headers (i.e. physmap.h) from
platform code.

I suspect that I am not the first to report this. Has this been
discussed already? What is the current thinking about the best way

Ugly example code to workaround the warning:
 * OK, we need a HACK to get rid of a DEBUG define in mtd.h
 * Declare a local, undeclare the global, then redefine the global
#ifdef DEBUG
 #define local_DEBUG
 #undef DEBUG
#include <linux/mtd/physmap.h>
#undef DEBUG
#ifdef local_DEBUG
#define DEBUG
/* end of HACK */


More information about the linux-mtd mailing list