Merge tag 'tag-chrome-platform-fixes-for-v6.3-rc4' of git://git.kernel.org/pub/scm...
[linux-block.git] / include / drm / drm_debugfs.h
index 2188dc83957fd22beea320444a4ad1bda3285e4f..7616f457ce7007c51718c9bbfd092cf72ecfea2d 100644 (file)
@@ -79,12 +79,61 @@ struct drm_info_node {
        struct dentry *dent;
 };
 
+/**
+ * struct drm_debugfs_info - debugfs info list entry
+ *
+ * This structure represents a debugfs file to be created by the drm
+ * core.
+ */
+struct drm_debugfs_info {
+       /** @name: File name */
+       const char *name;
+
+       /**
+        * @show:
+        *
+        * Show callback. &seq_file->private will be set to the &struct
+        * drm_debugfs_entry corresponding to the instance of this info
+        * on a given &struct drm_device.
+        */
+       int (*show)(struct seq_file*, void*);
+
+       /** @driver_features: Required driver features for this entry. */
+       u32 driver_features;
+
+       /** @data: Driver-private data, should not be device-specific. */
+       void *data;
+};
+
+/**
+ * struct drm_debugfs_entry - Per-device debugfs node structure
+ *
+ * This structure represents a debugfs file, as an instantiation of a &struct
+ * drm_debugfs_info on a &struct drm_device.
+ */
+struct drm_debugfs_entry {
+       /** @dev: &struct drm_device for this node. */
+       struct drm_device *dev;
+
+       /** @file: Template for this node. */
+       struct drm_debugfs_info file;
+
+       /** @list: Linked list of all device nodes. */
+       struct list_head list;
+};
+
 #if defined(CONFIG_DEBUG_FS)
 void drm_debugfs_create_files(const struct drm_info_list *files,
                              int count, struct dentry *root,
                              struct drm_minor *minor);
 int drm_debugfs_remove_files(const struct drm_info_list *files,
                             int count, struct drm_minor *minor);
+
+void drm_debugfs_add_file(struct drm_device *dev, const char *name,
+                         int (*show)(struct seq_file*, void*), void *data);
+
+void drm_debugfs_add_files(struct drm_device *dev,
+                          const struct drm_debugfs_info *files, int count);
 #else
 static inline void drm_debugfs_create_files(const struct drm_info_list *files,
                                            int count, struct dentry *root,
@@ -96,6 +145,16 @@ static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
 {
        return 0;
 }
+
+static inline void drm_debugfs_add_file(struct drm_device *dev, const char *name,
+                                       int (*show)(struct seq_file*, void*),
+                                       void *data)
+{}
+
+static inline void drm_debugfs_add_files(struct drm_device *dev,
+                                        const struct drm_debugfs_info *files,
+                                        int count)
+{}
 #endif
 
 #endif /* _DRM_DEBUGFS_H_ */