aboutsummaryrefslogtreecommitdiff
path: root/net/bluetooth/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/lib.c')
-rw-r--r--net/bluetooth/lib.c62
1 files changed, 42 insertions, 20 deletions
diff --git a/net/bluetooth/lib.c b/net/bluetooth/lib.c
index b826d1bf10d..941ad7530ed 100644
--- a/net/bluetooth/lib.c
+++ b/net/bluetooth/lib.c
@@ -24,12 +24,9 @@
/* Bluetooth kernel library. */
-#include <linux/module.h>
+#define pr_fmt(fmt) "Bluetooth: " fmt
-#include <linux/kernel.h>
-#include <linux/stddef.h>
-#include <linux/string.h>
-#include <asm/errno.h>
+#include <linux/export.h>
#include <net/bluetooth/bluetooth.h>
@@ -44,22 +41,8 @@ void baswap(bdaddr_t *dst, bdaddr_t *src)
}
EXPORT_SYMBOL(baswap);
-char *batostr(bdaddr_t *ba)
-{
- static char str[2][18];
- static int i = 1;
-
- i ^= 1;
- sprintf(str[i], "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
- ba->b[5], ba->b[4], ba->b[3],
- ba->b[2], ba->b[1], ba->b[0]);
-
- return str[i];
-}
-EXPORT_SYMBOL(batostr);
-
/* Bluetooth error codes to Unix errno mapping */
-int bt_err(__u16 code)
+int bt_to_errno(__u16 code)
{
switch (code) {
case 0:
@@ -75,6 +58,7 @@ int bt_err(__u16 code)
return EIO;
case 0x04:
+ case 0x3c:
return EHOSTDOWN;
case 0x05:
@@ -149,4 +133,42 @@ int bt_err(__u16 code)
return ENOSYS;
}
}
+EXPORT_SYMBOL(bt_to_errno);
+
+int bt_info(const char *format, ...)
+{
+ struct va_format vaf;
+ va_list args;
+ int r;
+
+ va_start(args, format);
+
+ vaf.fmt = format;
+ vaf.va = &args;
+
+ r = pr_info("%pV", &vaf);
+
+ va_end(args);
+
+ return r;
+}
+EXPORT_SYMBOL(bt_info);
+
+int bt_err(const char *format, ...)
+{
+ struct va_format vaf;
+ va_list args;
+ int r;
+
+ va_start(args, format);
+
+ vaf.fmt = format;
+ vaf.va = &args;
+
+ r = pr_err("%pV", &vaf);
+
+ va_end(args);
+
+ return r;
+}
EXPORT_SYMBOL(bt_err);