2 * Copyright (c) 2011 Samsung Electronics
3 * Lukasz Majewski <l.majewski@samsung.com>
5 * This is a Linux kernel compatibility layer for USB Gadget
7 * SPDX-License-Identifier: GPL-2.0+
10 #ifndef __LIN_COMPAT_H__
11 #define __LIN_COMPAT_H__
13 #include <linux/compat.h>
16 #define spin_lock_init(...)
17 #define spin_lock(...)
18 #define spin_lock_irqsave(lock, flags) do { debug("%lu\n", flags); } while (0)
19 #define spin_unlock(...)
20 #define spin_unlock_irqrestore(lock, flags) do {flags = 0; } while (0)
21 #define disable_irq(...)
22 #define enable_irq(...)
24 #define mutex_init(...)
25 #define mutex_lock(...)
26 #define mutex_unlock(...)
32 #define ENOTSUPP 524 /* Operation is not supported */
34 #define BITS_PER_BYTE 8
35 #define BITS_TO_LONGS(nr) \
36 DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
37 #define DECLARE_BITMAP(name, bits) \
38 unsigned long name[BITS_TO_LONGS(bits)]
40 #define small_const_nbits(nbits) \
41 (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
43 static inline void bitmap_zero(unsigned long *dst, int nbits)
45 if (small_const_nbits(nbits))
48 int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
53 #define dma_cache_maint(addr, size, mode) cache_flush()
54 void cache_flush(void);
56 #endif /* __LIN_COMPAT_H__ */