zd_def.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* 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. #ifndef _ZD_DEF_H
  18. #define _ZD_DEF_H
  19. #include <linux/kernel.h>
  20. #include <linux/stringify.h>
  21. #include <linux/device.h>
  22. typedef u16 __nocast zd_addr_t;
  23. #define dev_printk_f(level, dev, fmt, args...) \
  24. dev_printk(level, dev, "%s() " fmt, __func__, ##args)
  25. #ifdef DEBUG
  26. # define dev_dbg_f(dev, fmt, args...) \
  27. dev_printk_f(KERN_DEBUG, dev, fmt, ## args)
  28. #else
  29. # define dev_dbg_f(dev, fmt, args...) do { (void)(dev); } while (0)
  30. #endif /* DEBUG */
  31. #ifdef DEBUG
  32. # define ZD_ASSERT(x) \
  33. do { \
  34. if (!(x)) { \
  35. pr_debug("%s:%d ASSERT %s VIOLATED!\n", \
  36. __FILE__, __LINE__, __stringify(x)); \
  37. dump_stack(); \
  38. } \
  39. } while (0)
  40. #else
  41. # define ZD_ASSERT(x) do { } while (0)
  42. #endif
  43. #ifdef DEBUG
  44. # define ZD_MEMCLEAR(pointer, size) memset((pointer), 0xff, (size))
  45. #else
  46. # define ZD_MEMCLEAR(pointer, size) do { } while (0)
  47. #endif
  48. #endif /* _ZD_DEF_H */