Skip to content

Commit

Permalink
Bluetooth: Add BT_WARN and bt_dev_warn logging macros
Browse files Browse the repository at this point in the history
Add warning logging macros to bluetooth subsystem logs.

Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Frederic Danis authored and Marcel Holtmann committed Sep 24, 2015
1 parent f0ef674 commit 594b31e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/net/bluetooth/bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,23 @@ struct bt_voice {
__printf(1, 2)
void bt_info(const char *fmt, ...);
__printf(1, 2)
void bt_warn(const char *fmt, ...);
__printf(1, 2)
void bt_err(const char *fmt, ...);
__printf(1, 2)
void bt_err_ratelimited(const char *fmt, ...);

#define BT_INFO(fmt, ...) bt_info(fmt "\n", ##__VA_ARGS__)
#define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
#define BT_ERR(fmt, ...) bt_err(fmt "\n", ##__VA_ARGS__)
#define BT_DBG(fmt, ...) pr_debug(fmt "\n", ##__VA_ARGS__)

#define BT_ERR_RATELIMITED(fmt, ...) bt_err_ratelimited(fmt "\n", ##__VA_ARGS__)

#define bt_dev_info(hdev, fmt, ...) \
BT_INFO("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
#define bt_dev_warn(hdev, fmt, ...) \
BT_WARN("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
#define bt_dev_err(hdev, fmt, ...) \
BT_ERR("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
#define bt_dev_dbg(hdev, fmt, ...) \
Expand Down
16 changes: 16 additions & 0 deletions net/bluetooth/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,22 @@ void bt_info(const char *format, ...)
}
EXPORT_SYMBOL(bt_info);

void bt_warn(const char *format, ...)
{
struct va_format vaf;
va_list args;

va_start(args, format);

vaf.fmt = format;
vaf.va = &args;

pr_warn("%pV", &vaf);

va_end(args);
}
EXPORT_SYMBOL(bt_warn);

void bt_err(const char *format, ...)
{
struct va_format vaf;
Expand Down

0 comments on commit 594b31e

Please sign in to comment.