blob: deb99d1eaa77941fb5594635fde5fdb4b5976663 [file] [log] [blame]
Daniel Drakee85d0912006-06-02 17:11:32 +01001/* zd_def.h
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18#ifndef _ZD_DEF_H
19#define _ZD_DEF_H
20
21#include <linux/kernel.h>
22#include <linux/stringify.h>
23#include <linux/device.h>
24#include <linux/kernel.h>
25
Daniel Drake0ce34bc2006-12-12 01:26:11 +000026typedef u16 __nocast zd_addr_t;
27
Daniel Drakee85d0912006-06-02 17:11:32 +010028#define dev_printk_f(level, dev, fmt, args...) \
29 dev_printk(level, dev, "%s() " fmt, __func__, ##args)
30
31#ifdef DEBUG
32# define dev_dbg_f(dev, fmt, args...) \
33 dev_printk_f(KERN_DEBUG, dev, fmt, ## args)
34#else
35# define dev_dbg_f(dev, fmt, args...) do { (void)(dev); } while (0)
36#endif /* DEBUG */
37
38#ifdef DEBUG
39# define ZD_ASSERT(x) \
40do { \
41 if (!(x)) { \
42 pr_debug("%s:%d ASSERT %s VIOLATED!\n", \
43 __FILE__, __LINE__, __stringify(x)); \
Ulrich Kunitz741fec52006-11-22 00:05:53 +000044 dump_stack(); \
Daniel Drakee85d0912006-06-02 17:11:32 +010045 } \
46} while (0)
47#else
48# define ZD_ASSERT(x) do { } while (0)
49#endif
50
Ulrich Kunitzc48cf122006-08-12 18:00:17 +010051#ifdef DEBUG
52# define ZD_MEMCLEAR(pointer, size) memset((pointer), 0xff, (size))
53#else
54# define ZD_MEMCLEAR(pointer, size) do { } while (0)
55#endif
56
Daniel Drakee85d0912006-06-02 17:11:32 +010057#endif /* _ZD_DEF_H */