aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2017-07-30 08:09:38 +0100
committerDaniel Thompson <daniel.thompson@linaro.org>2017-07-31 17:26:27 +0100
commit25d892b4b84a38a500a2213f04ed98f8b5d0f091 (patch)
tree4c07dc3ebc0f8fbdf13bbb3391039e8fee8e3d09
parent39ec44379ffc31a78b987d8fb67e96f544d938b5 (diff)
include: usb: lin_gadget_compat: RDA support
-rw-r--r--include/usb/lin_gadget_compat.h33
1 files changed, 20 insertions, 13 deletions
diff --git a/include/usb/lin_gadget_compat.h b/include/usb/lin_gadget_compat.h
index fce3be7e80..5bdcb8d797 100644
--- a/include/usb/lin_gadget_compat.h
+++ b/include/usb/lin_gadget_compat.h
@@ -23,6 +23,8 @@
#ifndef __LIN_COMPAT_H__
#define __LIN_COMPAT_H__
+#include <linux/compat.h>
+
/* common */
#define spin_lock_init(...)
#define spin_lock(...)
@@ -36,26 +38,31 @@
#define mutex_lock(...)
#define mutex_unlock(...)
-#define WARN_ON(x) if (x) {printf("WARNING in %s line %d\n" \
- , __FILE__, __LINE__); }
-
-#define KERN_WARNING
-#define KERN_ERR
-#define KERN_NOTICE
-#define KERN_DEBUG
-
#define GFP_KERNEL 0
#define IRQ_HANDLED 1
#define ENOTSUPP 524 /* Operation is not supported */
-#define kmalloc(size, type) memalign(CONFIG_SYS_CACHELINE_SIZE, size)
-#define kfree(addr) free(addr)
-#define mdelay(n) ({unsigned long msec = (n); while (msec--) udelay(1000); })
+#define BITS_PER_BYTE 8
+#define BITS_TO_LONGS(nr) \
+ DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
+#define DECLARE_BITMAP(name, bits) \
+ unsigned long name[BITS_TO_LONGS(bits)]
+
+#define small_const_nbits(nbits) \
+ (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
+
+static inline void bitmap_zero(unsigned long *dst, int nbits)
+{
+ if (small_const_nbits(nbits))
+ *dst = 0UL;
+ else {
+ int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
+ memset(dst, 0, len);
+ }
+}
-#define __iomem
-#define min_t min
#define dma_cache_maint(addr, size, mode) cache_flush()
void cache_flush(void);