DEBUG macro

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


All,

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
forward?

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
#endif
#include <linux/mtd/physmap.h>
#undef DEBUG
#ifdef local_DEBUG
#define DEBUG
#endif
/* end of HACK */


Regards,
Vern



More information about the linux-mtd mailing list