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