5 * Copyright (C) 2005-2006 Intel Corporation
6 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 * #include <linux/uwb/debug.h>
29 * At the end of your include files.
31 #include <linux/types.h>
34 extern void dump_bytes(struct device *dev, const void *_buf, size_t rsize);
36 /* Master debug switch; !0 enables, 0 disables */
39 /* Local (per-file) debug switch; #define before #including */
50 #define __d_printf(l, _tag, _dev, f, a...) \
52 struct device *__dev = (_dev); \
53 if (D_MASTER && D_LOCAL >= (l)) { \
54 char __head[64] = ""; \
56 if ((unsigned long)__dev < 4096) \
57 printk(KERN_ERR "E: Corrupt dev %p\n", \
60 snprintf(__head, sizeof(__head), \
62 dev_driver_string(__dev), \
65 printk(KERN_ERR "%s%s" _tag ": " f, __head, \
70 #define d_fnstart(l, _dev, f, a...) \
71 __d_printf(l, " FNSTART", _dev, f, ## a)
72 #define d_fnend(l, _dev, f, a...) \
73 __d_printf(l, " FNEND", _dev, f, ## a)
74 #define d_printf(l, _dev, f, a...) \
75 __d_printf(l, "", _dev, f, ## a)
76 #define d_dump(l, _dev, ptr, size) \
78 struct device *__dev = _dev; \
79 if (D_MASTER && D_LOCAL >= (l)) \
80 dump_bytes(__dev, ptr, size); \
82 #define d_test(l) (D_MASTER && D_LOCAL >= (l))