This source file includes following definitions.
- baswap
- bt_to_errno
- bt_info
- bt_warn
- bt_err
- bt_err_ratelimited
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #define pr_fmt(fmt) "Bluetooth: " fmt
28
29 #include <linux/export.h>
30
31 #include <net/bluetooth/bluetooth.h>
32
33 void baswap(bdaddr_t *dst, const bdaddr_t *src)
34 {
35 const unsigned char *s = (const unsigned char *)src;
36 unsigned char *d = (unsigned char *)dst;
37 unsigned int i;
38
39 for (i = 0; i < 6; i++)
40 d[i] = s[5 - i];
41 }
42 EXPORT_SYMBOL(baswap);
43
44
45 int bt_to_errno(__u16 code)
46 {
47 switch (code) {
48 case 0:
49 return 0;
50
51 case 0x01:
52 return EBADRQC;
53
54 case 0x02:
55 return ENOTCONN;
56
57 case 0x03:
58 return EIO;
59
60 case 0x04:
61 case 0x3c:
62 return EHOSTDOWN;
63
64 case 0x05:
65 return EACCES;
66
67 case 0x06:
68 return EBADE;
69
70 case 0x07:
71 return ENOMEM;
72
73 case 0x08:
74 return ETIMEDOUT;
75
76 case 0x09:
77 return EMLINK;
78
79 case 0x0a:
80 return EMLINK;
81
82 case 0x0b:
83 return EALREADY;
84
85 case 0x0c:
86 return EBUSY;
87
88 case 0x0d:
89 case 0x0e:
90 case 0x0f:
91 return ECONNREFUSED;
92
93 case 0x10:
94 return ETIMEDOUT;
95
96 case 0x11:
97 case 0x27:
98 case 0x29:
99 case 0x20:
100 return EOPNOTSUPP;
101
102 case 0x12:
103 return EINVAL;
104
105 case 0x13:
106 case 0x14:
107 case 0x15:
108 return ECONNRESET;
109
110 case 0x16:
111 return ECONNABORTED;
112
113 case 0x17:
114 return ELOOP;
115
116 case 0x18:
117 return EACCES;
118
119 case 0x1a:
120 return EPROTONOSUPPORT;
121
122 case 0x1b:
123 return ECONNREFUSED;
124
125 case 0x19:
126 case 0x1e:
127 case 0x23:
128 case 0x24:
129 case 0x25:
130 return EPROTO;
131
132 default:
133 return ENOSYS;
134 }
135 }
136 EXPORT_SYMBOL(bt_to_errno);
137
138 void bt_info(const char *format, ...)
139 {
140 struct va_format vaf;
141 va_list args;
142
143 va_start(args, format);
144
145 vaf.fmt = format;
146 vaf.va = &args;
147
148 pr_info("%pV", &vaf);
149
150 va_end(args);
151 }
152 EXPORT_SYMBOL(bt_info);
153
154 void bt_warn(const char *format, ...)
155 {
156 struct va_format vaf;
157 va_list args;
158
159 va_start(args, format);
160
161 vaf.fmt = format;
162 vaf.va = &args;
163
164 pr_warn("%pV", &vaf);
165
166 va_end(args);
167 }
168 EXPORT_SYMBOL(bt_warn);
169
170 void bt_err(const char *format, ...)
171 {
172 struct va_format vaf;
173 va_list args;
174
175 va_start(args, format);
176
177 vaf.fmt = format;
178 vaf.va = &args;
179
180 pr_err("%pV", &vaf);
181
182 va_end(args);
183 }
184 EXPORT_SYMBOL(bt_err);
185
186 void bt_err_ratelimited(const char *format, ...)
187 {
188 struct va_format vaf;
189 va_list args;
190
191 va_start(args, format);
192
193 vaf.fmt = format;
194 vaf.va = &args;
195
196 pr_err_ratelimited("%pV", &vaf);
197
198 va_end(args);
199 }
200 EXPORT_SYMBOL(bt_err_ratelimited);