1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2011 Samsung Electronics
4 * Lukasz Majewski <l.majewski@samsung.com>
6 * This is a Linux kernel compatibility layer for USB Gadget
9 #ifndef __LIN_COMPAT_H__
10 #define __LIN_COMPAT_H__
12 #include <linux/bitops.h>
13 #include <linux/compat.h>
16 #define DECLARE_BITMAP(name, bits) \
17 unsigned long name[BITS_TO_LONGS(bits)]
19 #define small_const_nbits(nbits) \
20 (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
22 static inline void bitmap_zero(unsigned long *dst, int nbits)
24 if (small_const_nbits(nbits))
27 int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
32 #define dma_cache_maint(addr, size, mode) cache_flush()
33 void cache_flush(void);
35 #endif /* __LIN_COMPAT_H__ */