bna: remove oper_state_cbfn from struct bna_rxf
[linux/fpc-iii.git] / drivers / usb / gadget / u_f.h
blob1d5f0eb685521c3a3ce6942571b78413161c54ef
1 /*
2 * u_f.h
4 * Utility definitions for USB functions
6 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
7 * http://www.samsung.com
9 * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
16 #ifndef __U_F_H__
17 #define __U_F_H__
19 /* Variable Length Array Macros **********************************************/
20 #define vla_group(groupname) size_t groupname##__next = 0
21 #define vla_group_size(groupname) groupname##__next
23 #define vla_item(groupname, type, name, n) \
24 size_t groupname##_##name##__offset = ({ \
25 size_t align_mask = __alignof__(type) - 1; \
26 size_t offset = (groupname##__next + align_mask) & ~align_mask;\
27 size_t size = (n) * sizeof(type); \
28 groupname##__next = offset + size; \
29 offset; \
32 #define vla_item_with_sz(groupname, type, name, n) \
33 size_t groupname##_##name##__sz = (n) * sizeof(type); \
34 size_t groupname##_##name##__offset = ({ \
35 size_t align_mask = __alignof__(type) - 1; \
36 size_t offset = (groupname##__next + align_mask) & ~align_mask;\
37 size_t size = groupname##_##name##__sz; \
38 groupname##__next = offset + size; \
39 offset; \
42 #define vla_ptr(ptr, groupname, name) \
43 ((void *) ((char *)ptr + groupname##_##name##__offset))
45 struct usb_ep;
46 struct usb_request;
48 struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len);
50 #endif /* __U_F_H__ */