This source file includes following definitions.
- free_ep_req
1
2
3
4
5
6
7
8
9
10
11
12
13 #ifndef __U_F_H__
14 #define __U_F_H__
15
16 #include <linux/usb/gadget.h>
17
18
19 #define vla_group(groupname) size_t groupname##__next = 0
20 #define vla_group_size(groupname) groupname##__next
21
22 #define vla_item(groupname, type, name, n) \
23 size_t groupname##_##name##__offset = ({ \
24 size_t align_mask = __alignof__(type) - 1; \
25 size_t offset = (groupname##__next + align_mask) & ~align_mask;\
26 size_t size = (n) * sizeof(type); \
27 groupname##__next = offset + size; \
28 offset; \
29 })
30
31 #define vla_item_with_sz(groupname, type, name, n) \
32 size_t groupname##_##name##__sz = (n) * sizeof(type); \
33 size_t groupname##_##name##__offset = ({ \
34 size_t align_mask = __alignof__(type) - 1; \
35 size_t offset = (groupname##__next + align_mask) & ~align_mask;\
36 size_t size = groupname##_##name##__sz; \
37 groupname##__next = offset + size; \
38 offset; \
39 })
40
41 #define vla_ptr(ptr, groupname, name) \
42 ((void *) ((char *)ptr + groupname##_##name##__offset))
43
44 struct usb_ep;
45 struct usb_request;
46
47
48
49
50
51
52
53
54
55
56
57
58
59 struct usb_request *alloc_ep_req(struct usb_ep *ep, size_t len);
60
61
62 static inline void free_ep_req(struct usb_ep *ep, struct usb_request *req)
63 {
64 WARN_ON(req->buf == NULL);
65 kfree(req->buf);
66 req->buf = NULL;
67 usb_ep_free_request(ep, req);
68 }
69
70 #endif