xref: /openbmc/u-boot/include/linux/compat.h (revision bf48fcb6)
1 #ifndef _LINUX_COMPAT_H_
2 #define _LINUX_COMPAT_H_
3 
4 #define ndelay(x)	udelay(1)
5 
6 #define printk	printf
7 
8 #define KERN_EMERG
9 #define KERN_ALERT
10 #define KERN_CRIT
11 #define KERN_ERR
12 #define KERN_WARNING
13 #define KERN_NOTICE
14 #define KERN_INFO
15 #define KERN_DEBUG
16 
17 #define kmalloc(size, flags)	malloc(size)
18 #define kzalloc(size, flags)	calloc(size, 1)
19 #define vmalloc(size)		malloc(size)
20 #define kfree(ptr)		free(ptr)
21 #define vfree(ptr)		free(ptr)
22 
23 #define DECLARE_WAITQUEUE(...)	do { } while (0)
24 #define add_wait_queue(...)	do { } while (0)
25 #define remove_wait_queue(...)	do { } while (0)
26 
27 #define KERNEL_VERSION(a,b,c)	(((a) << 16) + ((b) << 8) + (c))
28 
29 /*
30  * ..and if you can't take the strict
31  * types, you can specify one yourself.
32  *
33  * Or not use min/max at all, of course.
34  */
35 #define min_t(type,x,y) \
36 	({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
37 #define max_t(type,x,y) \
38 	({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
39 
40 #ifndef BUG
41 #define BUG() do { \
42 	printf("U-Boot BUG at %s:%d!\n", __FILE__, __LINE__); \
43 } while (0)
44 
45 #define BUG_ON(condition) do { if (condition) BUG(); } while(0)
46 #endif /* BUG */
47 
48 #define WARN_ON(x) if (x) {printf("WARNING in %s line %d\n" \
49 				  , __FILE__, __LINE__); }
50 
51 #define PAGE_SIZE	4096
52 #endif
53