]> git.ipfire.org Git - thirdparty/u-boot.git/blob - include/usb/lin_gadget_compat.h
usb: gadget: f_sdp: Provide filesize env variable for downloaded images
[thirdparty/u-boot.git] / include / usb / lin_gadget_compat.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * Copyright (c) 2011 Samsung Electronics
4 * Lukasz Majewski <l.majewski@samsung.com>
5 *
6 * This is a Linux kernel compatibility layer for USB Gadget
7 */
8
9 #ifndef __LIN_COMPAT_H__
10 #define __LIN_COMPAT_H__
11
12 #include <linux/bitops.h>
13 #include <linux/compat.h>
14
15 /* common */
16 #define DECLARE_BITMAP(name, bits) \
17 unsigned long name[BITS_TO_LONGS(bits)]
18
19 #define small_const_nbits(nbits) \
20 (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
21
22 static inline void bitmap_zero(unsigned long *dst, int nbits)
23 {
24 if (small_const_nbits(nbits))
25 *dst = 0UL;
26 else {
27 int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
28 memset(dst, 0, len);
29 }
30 }
31
32 #define dma_cache_maint(addr, size, mode) cache_flush()
33 void cache_flush(void);
34
35 #endif /* __LIN_COMPAT_H__ */