dyndbg: cleanup dynamic usage in ib_srp.c
Subsystems (3)
Jason Baron
maintainerPATCH 1/1 dyndbg: cleanup dynamic usage in ib_srp.c
Currently, in dynamic_debug.h we only provide DEFINE_DYNAMIC_DEBUG_METADATA() and DYNAMIC_DEBUG_BRANCH() definitions if CONFIG_DYNAMIC_CORE is enabled. Thus, drivers such as infiniband srp (see: drivers/infiniband/ulp/srp/ib_srp.c) must provide their own definitions for !CONFIG_DYNAMIC_CORE.
Thus, let's move this !CONFIG_DYNAMIC_CORE case into dynamic_debug.h. However, the dynamic debug interfaces should really only be defined if CONFIG_DYNAMIC_DEBUG is set or CONFIG_DYNAMIC_CORE is set along with DYNAMIC_DEBUG_MODULE, (see:Documentation/admin-guide/dynamic-debug-howto.rst). Thus, the undefined case becomes: !((CONFIG_DYNAMIC_DEBUG || (CONFIG_DYNAMIC_CORE && DYNAMIC_DEBUG_MODULE)).
With those changes in place, we can remove the !CONFIG_DYNAMIC_CORE case from ib_srp.c
This change was prompted by a build breakeage in ib_srp.c stemming from the inclusion of dynamic_debug.h unconditionally in module.h, due to commit 7deabd674988 ("dyndbg: use the module notifier callbacks"). In that case, if we have CONFIG_DYNAMIC_CORE=y and CONFIG_DYNAMIC_DEBUG=n then the definitions for DEFINE_DYNAMIC_DEBUG_METADATA() and DYNAMIC_DEBUG_BRANCH() are defined once in ib_srp.c and then again in the dynamic_debug.h. This had been working prior to the above referenced commit because dynamic_debug.h was only pulled into ib_srp.c conditinally via printk.h if CONFIG_DYNAMIC_DEBUG was set.
--- drivers/infiniband/ulp/srp/ib_srp.c | 5 --- include/linux/dynamic_debug.h | 59 ++++++++++++++++++----------- 2 files changed, 37 insertions(+), 27 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +0 -5
@@ -62,11 +62,6 @@ MODULE_AUTHOR("Roland Dreier");MODULE_DESCRIPTION ("InfiniBand SCSI RDMA Protocol initiator" );MODULE_LICENSE ("Dual BSD/GPL" ); -#if !defined(CONFIG_DYNAMIC_DEBUG ) -#define DEFINE_DYNAMIC_DEBUG_METADATA (name, fmt) -#define DYNAMIC_DEBUG_BRANCH (descriptor) false -#endif -static unsigned int srp_sg_tablesize;static unsigned int cmd_sg_entries;static unsigned int indirect_sg_entries;
include/linux/dynamic_debug.h +37 -22
98 lines not on this page · raw message
Signature · 1 line
2.17.1
Luis Chamberlain
AppliedQuoted 27 lines · Jason Baron
Currently, in
dynamic_debug.hwe only provideDEFINE_DYNAMIC_DEBUG_METADATA()andDYNAMIC_DEBUG_BRANCH()definitions ifCONFIG_DYNAMIC_COREis enabled. Thus, drivers such as infiniband srp (see:drivers/infiniband/ulp/srp/ib_srp.c) must provide their own definitions for !CONFIG_DYNAMIC_CORE.Thus, let's move this !CONFIG_DYNAMIC_CORE case into
dynamic_debug.h. However, the dynamic debug interfaces should really only be defined ifCONFIG_DYNAMIC_DEBUGis set orCONFIG_DYNAMIC_COREis set along withDYNAMIC_DEBUG_MODULE, (see:Documentation/admin-guide/dynamic-debug-howto.rst). Thus, the undefined case becomes: !((CONFIG_DYNAMIC_DEBUG || (CONFIG_DYNAMIC_CORE&&DYNAMIC_DEBUG_MODULE)).
With those changes in place, we can remove the !CONFIG_DYNAMIC_CORE case fromib_srp.cThis change was prompted by a build breakeage in
ib_srp.cstemming from the inclusion ofdynamic_debug.hunconditionally inmodule.h, due to commit7deabd674988("dyndbg: use the module notifier callbacks"). In that case, if we haveCONFIG_DYNAMIC_CORE=yandCONFIG_DYNAMIC_DEBUG=nthen the definitions forDEFINE_DYNAMIC_DEBUG_METADATA()andDYNAMIC_DEBUG_BRANCH()are defined once inib_srp.cand then again in thedynamic_debug.h. This had been working prior to the above referenced commit becausedynamic_debug.hwas only pulled intoib_srp.cconditinally viaprintk.hifCONFIG_DYNAMIC_DEBUGwas set.
Quoted 9 lines
Cc Jim Cromie <[email protected]>Cc Luis Chamberlain <[email protected]>Cc Vincenzo Palazzo <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Bart Van Assche <[email protected]>Fixes 7deabd674988 ("dyndbg: use the module notifier callbacks")Reported-by kernel test robot <[email protected]>Signed-off-by Jason Baron <[email protected]>
Thanks, applied and pushed to modules-next!
Luis