bcm43xx_debugfs.h 3.1 KB

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