drm_debugfs.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Internal Header for the Direct Rendering Manager
  3. *
  4. * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
  5. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
  6. * Copyright (c) 2009-2010, Code Aurora Forum.
  7. * All rights reserved.
  8. *
  9. * Author: Rickard E. (Rik) Faith <faith@valinux.com>
  10. * Author: Gareth Hughes <gareth@valinux.com>
  11. *
  12. * Permission is hereby granted, free of charge, to any person obtaining a
  13. * copy of this software and associated documentation files (the "Software"),
  14. * to deal in the Software without restriction, including without limitation
  15. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  16. * and/or sell copies of the Software, and to permit persons to whom the
  17. * Software is furnished to do so, subject to the following conditions:
  18. *
  19. * The above copyright notice and this permission notice (including the next
  20. * paragraph) shall be included in all copies or substantial portions of the
  21. * Software.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  24. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  25. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  26. * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  27. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  28. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  29. * OTHER DEALINGS IN THE SOFTWARE.
  30. */
  31. #ifndef _DRM_DEBUGFS_H_
  32. #define _DRM_DEBUGFS_H_
  33. /**
  34. * struct drm_info_list - debugfs info list entry
  35. *
  36. * This structure represents a debugfs file to be created by the drm
  37. * core.
  38. */
  39. struct drm_info_list {
  40. /** @name: file name */
  41. const char *name;
  42. /**
  43. * @show:
  44. *
  45. * Show callback. &seq_file->private will be set to the &struct
  46. * drm_info_node corresponding to the instance of this info on a given
  47. * &struct drm_minor.
  48. */
  49. int (*show)(struct seq_file*, void*);
  50. /** @driver_features: Required driver features for this entry */
  51. u32 driver_features;
  52. /** @data: Driver-private data, should not be device-specific. */
  53. void *data;
  54. };
  55. /**
  56. * struct drm_info_node - Per-minor debugfs node structure
  57. *
  58. * This structure represents a debugfs file, as an instantiation of a &struct
  59. * drm_info_list on a &struct drm_minor.
  60. *
  61. * FIXME:
  62. *
  63. * No it doesn't make a hole lot of sense that we duplicate debugfs entries for
  64. * both the render and the primary nodes, but that's how this has organically
  65. * grown. It should probably be fixed, with a compatibility link, if needed.
  66. */
  67. struct drm_info_node {
  68. /** @minor: &struct drm_minor for this node. */
  69. struct drm_minor *minor;
  70. /** @info_ent: template for this node. */
  71. const struct drm_info_list *info_ent;
  72. /* private: */
  73. struct list_head list;
  74. struct dentry *dent;
  75. };
  76. #if defined(CONFIG_DEBUG_FS)
  77. int drm_debugfs_create_files(const struct drm_info_list *files,
  78. int count, struct dentry *root,
  79. struct drm_minor *minor);
  80. int drm_debugfs_remove_files(const struct drm_info_list *files,
  81. int count, struct drm_minor *minor);
  82. #else
  83. static inline int drm_debugfs_create_files(const struct drm_info_list *files,
  84. int count, struct dentry *root,
  85. struct drm_minor *minor)
  86. {
  87. return 0;
  88. }
  89. static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
  90. int count, struct drm_minor *minor)
  91. {
  92. return 0;
  93. }
  94. #endif
  95. #endif /* _DRM_DEBUGFS_H_ */