Simon Glass | 336d461 | 2020-02-03 07:36:16 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright (c) 2013 Google, Inc |
| 4 | * |
| 5 | * (C) Copyright 2012 |
| 6 | * Pavel Herrmann <morpheus.ibis@gmail.com> |
| 7 | * Marek Vasut <marex@denx.de> |
| 8 | */ |
| 9 | |
| 10 | #ifndef _DM_DEVICE_COMPAT_H |
| 11 | #define _DM_DEVICE_COMPAT_H |
| 12 | |
| 13 | #include <linux/compat.h> |
| 14 | |
| 15 | /* |
| 16 | * REVISIT: |
| 17 | * remove the following after resolving conflicts with <linux/compat.h> |
| 18 | */ |
| 19 | #ifdef dev_dbg |
| 20 | #undef dev_dbg |
| 21 | #endif |
| 22 | #ifdef dev_vdbg |
| 23 | #undef dev_vdbg |
| 24 | #endif |
| 25 | #ifdef dev_info |
| 26 | #undef dev_info |
| 27 | #endif |
| 28 | #ifdef dev_err |
| 29 | #undef dev_err |
| 30 | #endif |
| 31 | #ifdef dev_warn |
| 32 | #undef dev_warn |
| 33 | #endif |
| 34 | |
| 35 | /* |
| 36 | * REVISIT: |
| 37 | * print device name like Linux |
| 38 | */ |
| 39 | #define dev_printk(dev, fmt, ...) \ |
| 40 | ({ \ |
| 41 | printk(fmt, ##__VA_ARGS__); \ |
| 42 | }) |
| 43 | |
| 44 | #define __dev_printk(level, dev, fmt, ...) \ |
| 45 | ({ \ |
| 46 | if (level < CONFIG_VAL(LOGLEVEL)) \ |
| 47 | dev_printk(dev, fmt, ##__VA_ARGS__); \ |
| 48 | }) |
| 49 | |
| 50 | #define dev_emerg(dev, fmt, ...) \ |
| 51 | __dev_printk(0, dev, fmt, ##__VA_ARGS__) |
| 52 | #define dev_alert(dev, fmt, ...) \ |
| 53 | __dev_printk(1, dev, fmt, ##__VA_ARGS__) |
| 54 | #define dev_crit(dev, fmt, ...) \ |
| 55 | __dev_printk(2, dev, fmt, ##__VA_ARGS__) |
| 56 | #define dev_err(dev, fmt, ...) \ |
| 57 | __dev_printk(3, dev, fmt, ##__VA_ARGS__) |
| 58 | #define dev_warn(dev, fmt, ...) \ |
| 59 | __dev_printk(4, dev, fmt, ##__VA_ARGS__) |
| 60 | #define dev_notice(dev, fmt, ...) \ |
| 61 | __dev_printk(5, dev, fmt, ##__VA_ARGS__) |
| 62 | #define dev_info(dev, fmt, ...) \ |
| 63 | __dev_printk(6, dev, fmt, ##__VA_ARGS__) |
| 64 | |
| 65 | #ifdef DEBUG |
| 66 | #define dev_dbg(dev, fmt, ...) \ |
| 67 | __dev_printk(7, dev, fmt, ##__VA_ARGS__) |
| 68 | #else |
| 69 | #define dev_dbg(dev, fmt, ...) \ |
| 70 | ({ \ |
| 71 | if (0) \ |
| 72 | __dev_printk(7, dev, fmt, ##__VA_ARGS__); \ |
| 73 | }) |
| 74 | #endif |
| 75 | |
| 76 | #ifdef VERBOSE_DEBUG |
| 77 | #define dev_vdbg dev_dbg |
| 78 | #else |
| 79 | #define dev_vdbg(dev, fmt, ...) \ |
| 80 | ({ \ |
| 81 | if (0) \ |
| 82 | __dev_printk(7, dev, fmt, ##__VA_ARGS__); \ |
| 83 | }) |
| 84 | #endif |
| 85 | |
| 86 | #endif |