Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Lukasz Majewski | ac3c831 | 2011-10-27 10:36:46 +0200 | [diff] [blame] | 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 |
Lukasz Majewski | ac3c831 | 2011-10-27 10:36:46 +0200 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef __LIN_COMPAT_H__ |
| 10 | #define __LIN_COMPAT_H__ |
| 11 | |
Masahiro Yamada | 14fecf9 | 2017-11-22 02:38:11 +0900 | [diff] [blame] | 12 | #include <linux/bitops.h> |
Mike Frysinger | 1f19e3f | 2012-04-26 02:34:44 +0000 | [diff] [blame] | 13 | #include <linux/compat.h> |
| 14 | |
Lukasz Majewski | ac3c831 | 2011-10-27 10:36:46 +0200 | [diff] [blame] | 15 | /* common */ |
Lukasz Majewski | 1dc6a67 | 2012-05-02 17:47:02 +0200 | [diff] [blame] | 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 | |
Lukasz Majewski | ac3c831 | 2011-10-27 10:36:46 +0200 | [diff] [blame] | 32 | #define dma_cache_maint(addr, size, mode) cache_flush() |
| 33 | void cache_flush(void); |
| 34 | |
| 35 | #endif /* __LIN_COMPAT_H__ */ |