2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as
9 published by the Free Software Foundation;
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED.
25 /* Bluetooth kernel library. */
27 #define pr_fmt(fmt) "Bluetooth: " fmt
29 #include <linux/export.h>
31 #include <net/bluetooth/bluetooth.h>
33 void baswap(bdaddr_t *dst, const bdaddr_t *src)
35 const unsigned char *s = (const unsigned char *)src;
36 unsigned char *d = (unsigned char *)dst;
39 for (i = 0; i < 6; i++)
42 EXPORT_SYMBOL(baswap);
44 /* Bluetooth error codes to Unix errno mapping */
45 int bt_to_errno(__u16 code)
120 return EPROTONOSUPPORT;
136 EXPORT_SYMBOL(bt_to_errno);
138 void bt_info(const char *format, ...)
140 struct va_format vaf;
143 va_start(args, format);
148 pr_info("%pV", &vaf);
152 EXPORT_SYMBOL(bt_info);
154 void bt_warn(const char *format, ...)
156 struct va_format vaf;
159 va_start(args, format);
164 pr_warn("%pV", &vaf);
168 EXPORT_SYMBOL(bt_warn);
170 void bt_err(const char *format, ...)
172 struct va_format vaf;
175 va_start(args, format);
184 EXPORT_SYMBOL(bt_err);
186 #ifdef CONFIG_BT_FEATURE_DEBUG
187 static bool debug_enable;
189 void bt_dbg_set(bool enable)
191 debug_enable = enable;
194 bool bt_dbg_get(void)
199 void bt_dbg(const char *format, ...)
201 struct va_format vaf;
204 if (likely(!debug_enable))
207 va_start(args, format);
212 printk(KERN_DEBUG pr_fmt("%pV"), &vaf);
216 EXPORT_SYMBOL(bt_dbg);
219 void bt_warn_ratelimited(const char *format, ...)
221 struct va_format vaf;
224 va_start(args, format);
229 pr_warn_ratelimited("%pV", &vaf);
233 EXPORT_SYMBOL(bt_warn_ratelimited);
235 void bt_err_ratelimited(const char *format, ...)
237 struct va_format vaf;
240 va_start(args, format);
245 pr_err_ratelimited("%pV", &vaf);
249 EXPORT_SYMBOL(bt_err_ratelimited);