zd_def.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* ZD1211 USB-WLAN driver for Linux
  2. *
  3. * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  4. * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifndef _ZD_DEF_H
  21. #define _ZD_DEF_H
  22. #include <linux/kernel.h>
  23. #include <linux/stringify.h>
  24. #include <linux/device.h>
  25. typedef u16 __nocast zd_addr_t;
  26. #define dev_printk_f(level, dev, fmt, args...) \
  27. dev_printk(level, dev, "%s() " fmt, __func__, ##args)
  28. #ifdef DEBUG
  29. # define dev_dbg_f(dev, fmt, args...) \
  30. dev_printk_f(KERN_DEBUG, dev, fmt, ## args)
  31. #else
  32. # define dev_dbg_f(dev, fmt, args...) do { (void)(dev); } while (0)
  33. #endif /* DEBUG */
  34. #ifdef DEBUG
  35. # define ZD_ASSERT(x) \
  36. do { \
  37. if (!(x)) { \
  38. pr_debug("%s:%d ASSERT %s VIOLATED!\n", \
  39. __FILE__, __LINE__, __stringify(x)); \
  40. dump_stack(); \
  41. } \
  42. } while (0)
  43. #else
  44. # define ZD_ASSERT(x) do { } while (0)
  45. #endif
  46. #ifdef DEBUG
  47. # define ZD_MEMCLEAR(pointer, size) memset((pointer), 0xff, (size))
  48. #else
  49. # define ZD_MEMCLEAR(pointer, size) do { } while (0)
  50. #endif
  51. #endif /* _ZD_DEF_H */