diff options
-rw-r--r-- | include/net/bluetooth/bluetooth.h | 9 | ||||
-rw-r--r-- | net/bluetooth/lib.c | 19 |
2 files changed, 25 insertions, 3 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 7d77545fdd64..0cfa75bdd609 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -76,9 +76,12 @@ struct bt_power { | |||
76 | #define BT_POWER_FORCE_ACTIVE_OFF 0 | 76 | #define BT_POWER_FORCE_ACTIVE_OFF 0 |
77 | #define BT_POWER_FORCE_ACTIVE_ON 1 | 77 | #define BT_POWER_FORCE_ACTIVE_ON 1 |
78 | 78 | ||
79 | #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) | 79 | __attribute__((format (printf, 2, 3))) |
80 | #define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) | 80 | int bt_printk(const char *level, const char *fmt, ...); |
81 | #define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) | 81 | |
82 | #define BT_INFO(fmt, arg...) bt_printk(KERN_INFO, pr_fmt(fmt), ##arg) | ||
83 | #define BT_ERR(fmt, arg...) bt_printk(KERN_ERR, pr_fmt(fmt), ##arg) | ||
84 | #define BT_DBG(fmt, arg...) pr_debug(fmt "\n", ##arg) | ||
82 | 85 | ||
83 | /* Connection and socket states */ | 86 | /* Connection and socket states */ |
84 | enum { | 87 | enum { |
diff --git a/net/bluetooth/lib.c b/net/bluetooth/lib.c index 4e7cf8b0bd87..86a6bed229df 100644 --- a/net/bluetooth/lib.c +++ b/net/bluetooth/lib.c | |||
@@ -150,3 +150,22 @@ int bt_to_errno(__u16 code) | |||
150 | } | 150 | } |
151 | } | 151 | } |
152 | EXPORT_SYMBOL(bt_to_errno); | 152 | EXPORT_SYMBOL(bt_to_errno); |
153 | |||
154 | int bt_printk(const char *level, const char *format, ...) | ||
155 | { | ||
156 | struct va_format vaf; | ||
157 | va_list args; | ||
158 | int r; | ||
159 | |||
160 | va_start(args, format); | ||
161 | |||
162 | vaf.fmt = format; | ||
163 | vaf.va = &args; | ||
164 | |||
165 | r = printk("%sBluetooth: %pV\n", level, &vaf); | ||
166 | |||
167 | va_end(args); | ||
168 | |||
169 | return r; | ||
170 | } | ||
171 | EXPORT_SYMBOL(bt_printk); | ||