diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2020-05-06 10:57:52 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2020-05-11 13:16:27 +0300 |
commit | e625e50ceee18bc1e3fb1a6375e089405a797a4d (patch) | |
tree | 861f2b11aa43e544c77c071ddc8909d9c59cb5b9 /net/bluetooth/lib.c | |
parent | a10c907ce0e5e138c3da091fcb7c3d109a15aec5 (diff) | |
download | linux-e625e50ceee18bc1e3fb1a6375e089405a797a4d.tar.xz |
Bluetooth: Introduce debug feature when dynamic debug is disabled
In case dynamic debug is disabled, this feature allows a vendor platform
to provide debug statement printing.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/lib.c')
-rw-r--r-- | net/bluetooth/lib.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/net/bluetooth/lib.c b/net/bluetooth/lib.c index c09e0a3a0ed9..5326f41a58b7 100644 --- a/net/bluetooth/lib.c +++ b/net/bluetooth/lib.c @@ -183,6 +183,39 @@ void bt_err(const char *format, ...) } EXPORT_SYMBOL(bt_err); +#ifdef CONFIG_BT_FEATURE_DEBUG +static bool debug_enable; + +void bt_dbg_set(bool enable) +{ + debug_enable = enable; +} + +bool bt_dbg_get(void) +{ + return debug_enable; +} + +void bt_dbg(const char *format, ...) +{ + struct va_format vaf; + va_list args; + + if (likely(!debug_enable)) + return; + + va_start(args, format); + + vaf.fmt = format; + vaf.va = &args; + + printk(KERN_DEBUG pr_fmt("%pV"), &vaf); + + va_end(args); +} +EXPORT_SYMBOL(bt_dbg); +#endif + void bt_warn_ratelimited(const char *format, ...) { struct va_format vaf; |