43 #include <linux/slab.h>
44 #include <linux/export.h>
56 static u8 uwb_est_size;
57 static u8 uwb_est_used;
187 uwb_est = kcalloc(uwb_est_size,
sizeof(uwb_est[0]),
GFP_KERNEL);
192 uwb_est_00_00xx,
ARRAY_SIZE(uwb_est_00_00xx));
196 uwb_est_01_00xx,
ARRAY_SIZE(uwb_est_01_00xx));
207 uwb_est_size = uwb_est_used = 0;
217 int uwb_est_grow(
void)
219 size_t actual_size = uwb_est_size *
sizeof(uwb_est[0]);
223 memcpy(
new, uwb_est, actual_size);
224 memset(
new + actual_size, 0, actual_size);
265 if (uwb_est_used == uwb_est_size) {
266 result = uwb_est_grow();
271 type_event_high = type << 8 | event_high;
272 for (itr = 0; itr < uwb_est_used; itr++)
273 if (uwb_est[itr].type_event_high < type
274 && uwb_est[itr].vendor < vendor
275 && uwb_est[itr].product < product)
279 if (itr < uwb_est_used)
280 memmove(&uwb_est[itr+1], &uwb_est[itr], uwb_est_used - itr);
312 struct uwb_est est_cmp = {
320 for (itr = 0; itr < uwb_est_used; itr++)
321 if (!
memcmp(&uwb_est[itr], &est_cmp,
sizeof(est_cmp)))
327 if (itr < uwb_est_used - 1)
328 memmove(&uwb_est[itr], &uwb_est[itr+1], uwb_est_used - itr - 1);
364 if (event_low >= est->
entries) {
365 dev_err(dev,
"EST %p 0x%04x/%04x/%04x[%u]: event %u out of range\n",
371 entry = &est->
entry[event_low];
373 dev_err(dev,
"EST %p 0x%04x/%04x/%04x[%u]: event %u unknown\n",
384 size_t type_size = 0;
387 switch (entry->
type) {
392 if (offset + type_size > rceb_size) {
393 dev_err(dev,
"EST %p 0x%04x/%04x/%04x[%u]: "
394 "not enough data to read extra size\n",
401 switch (entry->
type) {
439 u8 *ptr = (
u8 *) rceb;
443 if (rceb_size <
sizeof(*rceb))
446 type_event_high = rceb->
bEventType << 8 | (
event & 0xff00) >> 8;
447 for (itr = 0; itr < uwb_est_used; itr++) {
448 if (uwb_est[itr].type_event_high != type_event_high)
450 size = uwb_est_get_size(rc, &uwb_est[itr],
451 event & 0x00ff, rceb, rceb_size);
456 dev_dbg(dev,
"event 0x%02x/%04x/%02x: no handlers available; "
457 "RCEB %02x %02x %02x %02x\n",
461 ptr[0], ptr[1], ptr[2], ptr[3]);