bcm43xx_debugfs.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #ifndef BCM43xx_DEBUGFS_H_
  2. #define BCM43xx_DEBUGFS_H_
  3. struct bcm43xx_private;
  4. struct bcm43xx_xmitstatus;
  5. #ifdef CONFIG_BCM43XX_DEBUG
  6. #include <linux/list.h>
  7. #include <asm/semaphore.h>
  8. struct dentry;
  9. /* limited by the size of the "really_big_buffer" */
  10. #define BCM43xx_NR_LOGGED_XMITSTATUS 100
  11. struct bcm43xx_dfsentry {
  12. struct dentry *subdir;
  13. struct dentry *dentry_devinfo;
  14. struct dentry *dentry_spromdump;
  15. struct dentry *dentry_tsf;
  16. struct dentry *dentry_txstat;
  17. struct bcm43xx_private *bcm;
  18. /* saved xmitstatus. */
  19. struct bcm43xx_xmitstatus *xmitstatus_buffer;
  20. int xmitstatus_ptr;
  21. int xmitstatus_cnt;
  22. /* We need a seperate buffer while printing to avoid
  23. * concurrency issues. (New xmitstatus can arrive
  24. * while we are printing).
  25. */
  26. struct bcm43xx_xmitstatus *xmitstatus_print_buffer;
  27. int saved_xmitstatus_ptr;
  28. int saved_xmitstatus_cnt;
  29. int xmitstatus_printing;
  30. };
  31. struct bcm43xx_debugfs {
  32. struct dentry *root;
  33. struct dentry *dentry_driverinfo;
  34. };
  35. void bcm43xx_debugfs_init(void);
  36. void bcm43xx_debugfs_exit(void);
  37. void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm);
  38. void bcm43xx_debugfs_remove_device(struct bcm43xx_private *bcm);
  39. void bcm43xx_debugfs_log_txstat(struct bcm43xx_private *bcm,
  40. struct bcm43xx_xmitstatus *status);
  41. /* Debug helper: Dump binary data through printk. */
  42. void bcm43xx_printk_dump(const char *data,
  43. size_t size,
  44. const char *description);
  45. /* Debug helper: Dump bitwise binary data through printk. */
  46. void bcm43xx_printk_bitdump(const unsigned char *data,
  47. size_t bytes, int msb_to_lsb,
  48. const char *description);
  49. #define bcm43xx_printk_bitdumpt(pointer, msb_to_lsb, description) \
  50. do { \
  51. bcm43xx_printk_bitdump((const unsigned char *)(pointer), \
  52. sizeof(*(pointer)), \
  53. (msb_to_lsb), \
  54. (description)); \
  55. } while (0)
  56. #else /* CONFIG_BCM43XX_DEBUG*/
  57. static inline
  58. void bcm43xx_debugfs_init(void) { }
  59. static inline
  60. void bcm43xx_debugfs_exit(void) { }
  61. static inline
  62. void bcm43xx_debugfs_add_device(struct bcm43xx_private *bcm) { }
  63. static inline
  64. void bcm43xx_debugfs_remove_device(struct bcm43xx_private *bcm) { }
  65. static inline
  66. void bcm43xx_debugfs_log_txstat(struct bcm43xx_private *bcm,
  67. struct bcm43xx_xmitstatus *status) { }
  68. static inline
  69. void bcm43xx_printk_dump(const char *data,
  70. size_t size,
  71. const char *description)
  72. {
  73. }
  74. static inline
  75. void bcm43xx_printk_bitdump(const unsigned char *data,
  76. size_t bytes, int msb_to_lsb,
  77. const char *description)
  78. {
  79. }
  80. #define bcm43xx_printk_bitdumpt(pointer, msb_to_lsb, description) do { /* nothing */ } while (0)
  81. #endif /* CONFIG_BCM43XX_DEBUG*/
  82. /* Ugly helper macros to make incomplete code more verbose on runtime */
  83. #ifdef TODO
  84. # undef TODO
  85. #endif
  86. #define TODO() \
  87. do { \
  88. printk(KERN_INFO PFX "TODO: Incomplete code in %s() at %s:%d\n", \
  89. __FUNCTION__, __FILE__, __LINE__); \
  90. } while (0)
  91. #ifdef FIXME
  92. # undef FIXME
  93. #endif
  94. #define FIXME() \
  95. do { \
  96. printk(KERN_INFO PFX "FIXME: Possibly broken code in %s() at %s:%d\n", \
  97. __FUNCTION__, __FILE__, __LINE__); \
  98. } while (0)
  99. #endif /* BCM43xx_DEBUGFS_H_ */