最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

how to add debug control for a driver module

tmp_todo crifan 609浏览 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,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
57 queries in 0.115 seconds, using 18.78MB memory