最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

how to add debug control for a driver module

tmp_todo crifan 1855浏览 0评论

how to add debug control for a driver module

such as:

1. add config option in Kconfig:

config AS352X_AFE_CHG_DBG
bool "AS352x afe charger debugging"
depends on AS352X_AFE_CHG != n
help
   This is an option for use by developers; most people should
   say N here. This enables AS352x afe charger driver debugging.

in which:
AS352X_AFE_CHG != n
means:
for AS352X_AFE_CHG is tristate, so
AS352X_AFE_CHG != n =>> AS352X_AFE_CHG==y(build into kernel) or AS352X_AFE_CHG==m(module)

2.add micro in C file:

the corresponding config micro is:
CONFIG + config name
–>>CONFIG_AS352X_AFE_CHG_DBG

use it to control the debug func:

#ifdef CONFIG_AS352X_AFE_CHG_DBG
#define AS352XCHG_DBG(args…) printk( args)
#else
#define AS352XCHG_DBG(args…)
#endif

and add needed debug code:
….
AS352XCHG_DBG(KERN_WARNING "chg:cdev_add is OK.n");

….

转载请注明:在路上 » how to add debug control for a driver module

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
80 queries in 0.159 seconds, using 22.04MB memory