From 4ab87e38816eaee1c73765443c265bd9bb732ff1 Mon Sep 17 00:00:00 2001 From: Hemant Agrawal Date: Sat, 16 Sep 2017 16:22:21 +0530 Subject: [PATCH] bus/fslmc: cleanup compat file Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/qbman/include/compat.h | 188 +---------------------- drivers/bus/fslmc/qbman/qbman_private.h | 2 +- 2 files changed, 4 insertions(+), 186 deletions(-) diff --git a/drivers/bus/fslmc/qbman/include/compat.h b/drivers/bus/fslmc/qbman/include/compat.h index 7b69fd1034..8885d60ce0 100644 --- a/drivers/bus/fslmc/qbman/include/compat.h +++ b/drivers/bus/fslmc/qbman/include/compat.h @@ -65,16 +65,9 @@ */ /* Required compiler attributes */ -#define __user #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #define ____cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES))) -#undef container_of -#define container_of(ptr, type, member) ({ \ - typeof(((type *)0)->member)(*__mptr) = (ptr); \ - (type *)((char *)__mptr - offsetof(type, member)); }) -#define __stringify_1(x) #x -#define __stringify(x) __stringify_1(x) #ifdef ARRAY_SIZE #undef ARRAY_SIZE @@ -88,17 +81,8 @@ typedef uint32_t u32; typedef uint64_t u64; typedef uint64_t dma_addr_t; typedef cpu_set_t cpumask_t; -typedef u32 compat_uptr_t; - -static inline void __user *compat_ptr(compat_uptr_t uptr) -{ - return (void __user *)(unsigned long)uptr; -} - -static inline compat_uptr_t ptr_to_compat(void __user *uptr) -{ - return (u32)(unsigned long)uptr; -} +typedef unsigned int gfp_t; +typedef uint32_t phandle; /* I/O operations */ static inline u32 in_be32(volatile void *__p) @@ -124,12 +108,11 @@ static inline void out_be32(volatile void *__p, u32 val) #define pr_warn(fmt, args...) prflush("WARN:" fmt, ##args) #define pr_info(fmt, args...) prflush(fmt, ##args) +#ifdef RTE_LIBRTE_DPAA2_DEBUG_BUS #ifdef pr_debug #undef pr_debug #endif #define pr_debug(fmt, args...) {} -#define might_sleep_if(c) {} -#define msleep(x) {} #define WARN_ON(c, str) \ do { \ static int warned_##__LINE__; \ @@ -147,103 +130,20 @@ do { \ #define ALIGN(x, a) (((x) + ((typeof(x))(a) - 1)) & ~((typeof(x))(a) - 1)) -/****************/ -/* Linked-lists */ -/****************/ - -struct list_head { - struct list_head *prev; - struct list_head *next; -}; - -#define LIST_HEAD(n) \ -struct list_head n = { \ - .prev = &n, \ - .next = &n \ -} - -#define INIT_LIST_HEAD(p) \ -do { \ - struct list_head *__p298 = (p); \ - __p298->next = __p298; \ - __p298->prev = __p298->next; \ -} while (0) -#define list_entry(node, type, member) \ - (type *)((void *)node - offsetof(type, member)) -#define list_empty(p) \ -({ \ - const struct list_head *__p298 = (p); \ - ((__p298->next == __p298) && (__p298->prev == __p298)); \ -}) -#define list_add(p, l) \ -do { \ - struct list_head *__p298 = (p); \ - struct list_head *__l298 = (l); \ - __p298->next = __l298->next; \ - __p298->prev = __l298; \ - __l298->next->prev = __p298; \ - __l298->next = __p298; \ -} while (0) -#define list_add_tail(p, l) \ -do { \ - struct list_head *__p298 = (p); \ - struct list_head *__l298 = (l); \ - __p298->prev = __l298->prev; \ - __p298->next = __l298; \ - __l298->prev->next = __p298; \ - __l298->prev = __p298; \ -} while (0) -#define list_for_each(i, l) \ - for (i = (l)->next; i != (l); i = i->next) -#define list_for_each_safe(i, j, l) \ - for (i = (l)->next, j = i->next; i != (l); \ - i = j, j = i->next) -#define list_for_each_entry(i, l, name) \ - for (i = list_entry((l)->next, typeof(*i), name); &i->name != (l); \ - i = list_entry(i->name.next, typeof(*i), name)) -#define list_for_each_entry_safe(i, j, l, name) \ - for (i = list_entry((l)->next, typeof(*i), name), \ - j = list_entry(i->name.next, typeof(*j), name); \ - &i->name != (l); \ - i = j, j = list_entry(j->name.next, typeof(*j), name)) -#define list_del(i) \ -do { \ - (i)->next->prev = (i)->prev; \ - (i)->prev->next = (i)->next; \ -} while (0) - /* Other miscellaneous interfaces our APIs depend on; */ - #define lower_32_bits(x) ((u32)(x)) #define upper_32_bits(x) ((u32)(((x) >> 16) >> 16)) /* Compiler/type stuff */ -typedef unsigned int gfp_t; -typedef uint32_t phandle; #define __iomem -#define EINTR 4 -#define ENODEV 19 #define GFP_KERNEL 0 #define __raw_readb(p) (*(const volatile unsigned char *)(p)) #define __raw_readl(p) (*(const volatile unsigned int *)(p)) #define __raw_writel(v, p) {*(volatile unsigned int *)(p) = (v); } -/* Completion stuff */ -#define DECLARE_COMPLETION(n) int n = 0 -#define complete(n) { *n = 1; } -#define wait_for_completion(n) \ -do { \ - while (!*n) { \ - bman_poll(); \ - qman_poll(); \ - } \ - *n = 0; \ -} while (0) - /* Allocator stuff */ #define kmalloc(sz, t) malloc(sz) -#define vmalloc(sz) malloc(sz) #define kfree(p) { if (p) free(p); } static inline void *kzalloc(size_t sz, gfp_t __foo __rte_unused) { @@ -269,88 +169,6 @@ static inline void free_page(unsigned long p) free((void *)p); } -/* Bitfield stuff. */ -#define BITS_PER_ULONG (sizeof(unsigned long) << 3) -#define SHIFT_PER_ULONG (((1 << 5) == BITS_PER_ULONG) ? 5 : 6) -#define BITS_MASK(idx) ((unsigned long)1 << ((idx) & (BITS_PER_ULONG - 1))) -#define BITS_IDX(idx) ((idx) >> SHIFT_PER_ULONG) -static inline unsigned long test_bits(unsigned long mask, - volatile unsigned long *p) -{ - return *p & mask; -} - -static inline int test_bit(int idx, volatile unsigned long *bits) -{ - return test_bits(BITS_MASK(idx), bits + BITS_IDX(idx)); -} - -static inline void set_bits(unsigned long mask, volatile unsigned long *p) -{ - *p |= mask; -} - -static inline void set_bit(int idx, volatile unsigned long *bits) -{ - set_bits(BITS_MASK(idx), bits + BITS_IDX(idx)); -} - -static inline void clear_bits(unsigned long mask, volatile unsigned long *p) -{ - *p &= ~mask; -} - -static inline void clear_bit(int idx, volatile unsigned long *bits) -{ - clear_bits(BITS_MASK(idx), bits + BITS_IDX(idx)); -} - -static inline unsigned long test_and_set_bits(unsigned long mask, - volatile unsigned long *p) -{ - unsigned long ret = test_bits(mask, p); - - set_bits(mask, p); - return ret; -} - -static inline int test_and_set_bit(int idx, volatile unsigned long *bits) -{ - int ret = test_bit(idx, bits); - - set_bit(idx, bits); - return ret; -} - -static inline int test_and_clear_bit(int idx, volatile unsigned long *bits) -{ - int ret = test_bit(idx, bits); - - clear_bit(idx, bits); - return ret; -} - -static inline int find_next_zero_bit(unsigned long *bits, int limit, int idx) -{ - while ((++idx < limit) && test_bit(idx, bits)) - ; - return idx; -} - -static inline int find_first_zero_bit(unsigned long *bits, int limit) -{ - int idx = 0; - - while (test_bit(idx, bits) && (++idx < limit)) - ; - return idx; -} - -static inline u64 div64_u64(u64 n, u64 d) -{ - return n / d; -} - #define atomic_t rte_atomic32_t #define atomic_read(v) rte_atomic32_read(v) #define atomic_set(v, i) rte_atomic32_set(v, i) diff --git a/drivers/bus/fslmc/qbman/qbman_private.h b/drivers/bus/fslmc/qbman/qbman_private.h index 4f48b47690..32e5c5d0c7 100644 --- a/drivers/bus/fslmc/qbman/qbman_private.h +++ b/drivers/bus/fslmc/qbman/qbman_private.h @@ -27,7 +27,7 @@ */ /* Perform extra checking */ -#define QBMAN_CHECKING +/*#define QBMAN_CHECKING*/ /* To maximise the amount of logic that is common between the Linux driver and * other targets (such as the embedded MC firmware), we pivot here between the -- 2.20.1