31 #include <linux/kernel.h>
33 #include <linux/slab.h>
35 #include <linux/export.h>
43 const char *__strerror[] = {
48 "beacon is too large",
50 "unsupported power level",
51 "time out (wa) or invalid ie data (whci)",
52 "beacon size exceeded",
57 "no more asie notification",
67 return "unknown error";
68 return __strerror[
code];
73 u8 expected_type,
u16 expected_event,
88 needtofree = rc->
filter_cmd(rc, &cmd, &cmd_size);
89 if (needtofree < 0 && needtofree != -
ENOANO) {
90 dev_err(dev,
"%s: filter error: %d\n",
91 cmd_name, needtofree);
97 neh =
uwb_rc_neh_add(rc, cmd, expected_type, expected_event, cb, arg);
99 result = PTR_ERR(neh);
103 result = rc->
cmd(rc, cmd, cmd_size);
113 return result < 0 ? result : 0;
123 static void uwb_rc_cmd_done(
struct uwb_rc *
rc,
void *
arg,
128 if (reply_size > 0) {
173 u8 expected_type,
u16 expected_event,
180 init_completion(&
params.completion);
185 expected_type, expected_event,
186 uwb_rc_cmd_done, &
params);
195 if (
params.reply_size < 0)
196 dev_err(dev,
"%s: confirmation event 0x%02x/%04x/%02x "
197 "reception failed: %d\n", cmd_name,
227 struct uwb_rccb *cmd,
size_t cmd_size,
228 struct uwb_rceb *reply,
size_t reply_size)
233 result = __uwb_rc_cmd(rc, cmd_name,
234 cmd, cmd_size, reply, reply_size,
237 if (result > 0 && result < reply_size) {
238 dev_err(dev,
"%s: not enough data returned for decoding reply "
239 "(%zu bytes received vs at least %zu needed)\n",
240 cmd_name, result, reply_size);
270 struct uwb_rccb *cmd,
size_t cmd_size,
271 u8 expected_type,
u16 expected_event,
274 return __uwb_rc_cmd(rc, cmd_name, cmd, cmd_size,
NULL, 0,
275 expected_type, expected_event, preply);
295 size_t cmd_size =
sizeof(*cmd);
305 result =
uwb_rc_cmd(rc,
"RESET", cmd, cmd_size,
306 &reply.
rceb,
sizeof(reply));
311 "RESET: command execution failed: %s (%d)\n",
357 evt->
rc = __uwb_rc_get(rc);