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");
….