|
[原因] (若有误还请指教)
由于dev_dbg在include\linux\device.h中定义为- #if <font color="#ff0000">defined(DEBUG)</font>
- #define dev_dbg(dev, format, arg...) \
- dev_printk(<font color="#ff00ff">KERN_DEBUG</font>, dev, format, ##arg)
- #elif defined(CONFIG_DYNAMIC_DEBUG)
- ...
复制代码
1. define DEBUG
由于soc-core.c并非直接引用device.h,而是由platform_device.h去include device.h
因此在#include <linux/platform_device.h>前加入#define DEBUG才能将DEBUG参数加入
但是也发现有人在#include <linux/platform_device.h>后,加入了#undefine DEBUG,尚未确定其影响
2. 将printk级别降至最低的KERN_DEBUG
kernel中printk的级别在include\linux\printk.h中定义如下
- #define KERN_EMERG "<0>" /* system is unusable */
- #define KERN_ALERT "<1>" /* action must be taken immediately */
- #define KERN_CRIT "<2>" /* critical conditions */
- #define KERN_ERR "<3>" /* error conditions */
- #define KERN_WARNING "<4>" /* warning conditions */
- #define KERN_NOTICE "<5>" /* normal but significant condition */
- #define KERN_INFO "<6>" /* informational */
- #define KERN_DEBUG "<7>" /* debug-level messages */
复制代码 而dev_dbg则是属于最低层的log级别KERN_DEBUG
因此需要在include\linux\printk.c中更改log显示级别
printk.c中之原代码如下
- /* We show everything that is MORE important than this.. */
- #define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */
- #define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */
复制代码 因此需将DEFAULT_CONSOLE_LOGLEVEL改成8
|
|