Wolfgang Denk | 932394a | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 1 | #ifndef _LINUX_COMPAT_H_ |
| 2 | #define _LINUX_COMPAT_H_ |
| 3 | |
Wolfgang Denk | 932394a | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 4 | #define ndelay(x) udelay(1) |
| 5 | |
Wu, Josh | 2f96b06 | 2013-07-03 11:11:47 +0800 | [diff] [blame] | 6 | #define dev_dbg(dev, fmt, args...) \ |
| 7 | debug(fmt, ##args) |
| 8 | #define dev_vdbg(dev, fmt, args...) \ |
| 9 | debug(fmt, ##args) |
| 10 | #define dev_info(dev, fmt, args...) \ |
| 11 | printf(fmt, ##args) |
| 12 | #define dev_err(dev, fmt, args...) \ |
| 13 | printf(fmt, ##args) |
Wolfgang Denk | 932394a | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 14 | #define printk printf |
| 15 | |
| 16 | #define KERN_EMERG |
| 17 | #define KERN_ALERT |
| 18 | #define KERN_CRIT |
| 19 | #define KERN_ERR |
| 20 | #define KERN_WARNING |
| 21 | #define KERN_NOTICE |
| 22 | #define KERN_INFO |
| 23 | #define KERN_DEBUG |
| 24 | |
| 25 | #define kmalloc(size, flags) malloc(size) |
William Juul | 5e1dae5 | 2007-11-09 13:32:30 +0100 | [diff] [blame] | 26 | #define kzalloc(size, flags) calloc(size, 1) |
Stefan Roese | 0a57265 | 2009-05-12 14:29:39 +0200 | [diff] [blame] | 27 | #define vmalloc(size) malloc(size) |
| 28 | #define kfree(ptr) free(ptr) |
| 29 | #define vfree(ptr) free(ptr) |
William Juul | cfa460a | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 30 | |
Stefan Roese | 0a57265 | 2009-05-12 14:29:39 +0200 | [diff] [blame] | 31 | #define DECLARE_WAITQUEUE(...) do { } while (0) |
| 32 | #define add_wait_queue(...) do { } while (0) |
| 33 | #define remove_wait_queue(...) do { } while (0) |
| 34 | |
| 35 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |
Wolfgang Denk | 932394a | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 36 | |
| 37 | /* |
| 38 | * ..and if you can't take the strict |
| 39 | * types, you can specify one yourself. |
| 40 | * |
| 41 | * Or not use min/max at all, of course. |
| 42 | */ |
| 43 | #define min_t(type,x,y) \ |
| 44 | ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) |
| 45 | #define max_t(type,x,y) \ |
| 46 | ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; }) |
| 47 | |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 48 | #ifndef BUG |
Wolfgang Denk | 932394a | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 49 | #define BUG() do { \ |
| 50 | printf("U-Boot BUG at %s:%d!\n", __FILE__, __LINE__); \ |
| 51 | } while (0) |
| 52 | |
| 53 | #define BUG_ON(condition) do { if (condition) BUG(); } while(0) |
Stefan Roese | 887e2ec | 2006-09-07 11:51:23 +0200 | [diff] [blame] | 54 | #endif /* BUG */ |
Wolfgang Denk | 932394a | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 55 | |
Mike Frysinger | 6777a3c | 2012-04-26 02:34:44 +0000 | [diff] [blame] | 56 | #define WARN_ON(x) if (x) {printf("WARNING in %s line %d\n" \ |
| 57 | , __FILE__, __LINE__); } |
| 58 | |
Wolfgang Denk | 932394a | 2005-08-17 12:55:25 +0200 | [diff] [blame] | 59 | #define PAGE_SIZE 4096 |
| 60 | #endif |