Home | History | Annotate | Line # | Download | only in gt
      1  1.1  riastrad /*	$NetBSD: debugfs_gt.h,v 1.2 2021/12/18 23:45:30 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /* SPDX-License-Identifier: MIT */
      4  1.1  riastrad /*
      5  1.1  riastrad  * Copyright  2019 Intel Corporation
      6  1.1  riastrad  */
      7  1.1  riastrad 
      8  1.1  riastrad #ifndef DEBUGFS_GT_H
      9  1.1  riastrad #define DEBUGFS_GT_H
     10  1.1  riastrad 
     11  1.1  riastrad #include <linux/file.h>
     12  1.1  riastrad 
     13  1.1  riastrad struct intel_gt;
     14  1.1  riastrad 
     15  1.1  riastrad #define DEFINE_GT_DEBUGFS_ATTRIBUTE(__name)				\
     16  1.1  riastrad 	static int __name ## _open(struct inode *inode, struct file *file) \
     17  1.1  riastrad {									\
     18  1.1  riastrad 	return single_open(file, __name ## _show, inode->i_private);	\
     19  1.1  riastrad }									\
     20  1.1  riastrad static const struct file_operations __name ## _fops = {			\
     21  1.1  riastrad 	.owner = THIS_MODULE,						\
     22  1.1  riastrad 	.open = __name ## _open,					\
     23  1.1  riastrad 	.read = seq_read,						\
     24  1.1  riastrad 	.llseek = seq_lseek,						\
     25  1.1  riastrad 	.release = single_release,					\
     26  1.1  riastrad }
     27  1.1  riastrad 
     28  1.1  riastrad void debugfs_gt_register(struct intel_gt *gt);
     29  1.1  riastrad 
     30  1.1  riastrad struct debugfs_gt_file {
     31  1.1  riastrad 	const char *name;
     32  1.1  riastrad 	const struct file_operations *fops;
     33  1.1  riastrad 	bool (*eval)(const struct intel_gt *gt);
     34  1.1  riastrad };
     35  1.1  riastrad 
     36  1.1  riastrad void debugfs_gt_register_files(struct intel_gt *gt,
     37  1.1  riastrad 			       struct dentry *root,
     38  1.1  riastrad 			       const struct debugfs_gt_file *files,
     39  1.1  riastrad 			       unsigned long count);
     40  1.1  riastrad 
     41  1.1  riastrad #endif /* DEBUGFS_GT_H */
     42