mmc: rtsx_pci: Enable MMC_CAP_ERASE to allow erase/discard/trim requests
[linux/fpc-iii.git] / drivers / usb / gadget / u_f.h
blob4247cc098a8915c49286ff4c57978f77d89f1125
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 #include <linux/usb/gadget.h>
21 /* Variable Length Array Macros **********************************************/
22 #define vla_group(groupname) size_t groupname##__next = 0
23 #define vla_group_size(groupname) groupname##__next
25 #define vla_item(groupname, type, name, n) \
26 size_t groupname##_##name##__offset = ({ \
27 size_t align_mask = __alignof__(type) - 1; \
28 size_t offset = (groupname##__next + align_mask) & ~align_mask;\
29 size_t size = (n) * sizeof(type); \
30 groupname##__next = offset + size; \
31 offset; \
34 #define vla_item_with_sz(groupname, type, name, n) \
35 size_t groupname##_##name##__sz = (n) * sizeof(type); \
36 size_t groupname##_##name##__offset = ({ \
37 size_t align_mask = __alignof__(type) - 1; \
38 size_t offset = (groupname##__next + align_mask) & ~align_mask;\
39 size_t size = groupname##_##name##__sz; \
40 groupname##__next = offset + size; \
41 offset; \
44 #define vla_ptr(ptr, groupname, name) \
45 ((void *) ((char *)ptr + groupname##_##name##__offset))
47 struct usb_ep;
48 struct usb_request;
50 /* Requests allocated via alloc_ep_req() must be freed by free_ep_req(). */
51 struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len);
52 static inline void free_ep_req(struct usb_ep *ep, struct usb_request *req)
54 kfree(req->buf);
55 usb_ep_free_request(ep, req);
58 #endif /* __U_F_H__ */