xref: /linux-6.15/include/linux/debugfs.h (revision ae91c925)
13bce94fdSGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds  *  debugfs.h - a tiny little debug file system
41da177e4SLinus Torvalds  *
51da177e4SLinus Torvalds  *  Copyright (C) 2004 Greg Kroah-Hartman <[email protected]>
61da177e4SLinus Torvalds  *  Copyright (C) 2004 IBM Inc.
71da177e4SLinus Torvalds  *
81da177e4SLinus Torvalds  *  debugfs is for people to use instead of /proc or /sys.
9e1b4fc7aSMauro Carvalho Chehab  *  See Documentation/filesystems/ for more details.
101da177e4SLinus Torvalds  */
111da177e4SLinus Torvalds 
121da177e4SLinus Torvalds #ifndef _DEBUGFS_H_
131da177e4SLinus Torvalds #define _DEBUGFS_H_
141da177e4SLinus Torvalds 
151da177e4SLinus Torvalds #include <linux/fs.h>
161a087c6aSAlessandro Rubini #include <linux/seq_file.h>
171da177e4SLinus Torvalds 
18a7a76cefSRoland Dreier #include <linux/types.h>
1949d200deSNicolai Stange #include <linux/compiler.h>
20a7a76cefSRoland Dreier 
21f30d0a81SArend van Spriel struct device;
22a7a76cefSRoland Dreier struct file_operations;
23a7a76cefSRoland Dreier 
24dd308bc3SMichael Ellerman struct debugfs_blob_wrapper {
25dd308bc3SMichael Ellerman 	void *data;
26dd308bc3SMichael Ellerman 	unsigned long size;
27dd308bc3SMichael Ellerman };
28dd308bc3SMichael Ellerman 
291a087c6aSAlessandro Rubini struct debugfs_reg32 {
301a087c6aSAlessandro Rubini 	char *name;
311a087c6aSAlessandro Rubini 	unsigned long offset;
321a087c6aSAlessandro Rubini };
331a087c6aSAlessandro Rubini 
341a087c6aSAlessandro Rubini struct debugfs_regset32 {
35833d6e01SFelipe Balbi 	const struct debugfs_reg32 *regs;
361a087c6aSAlessandro Rubini 	int nregs;
371a087c6aSAlessandro Rubini 	void __iomem *base;
381a087c6aSAlessandro Rubini };
391a087c6aSAlessandro Rubini 
40ae79cdaaS[email protected] extern struct dentry *arch_debugfs_dir;
41ae79cdaaS[email protected] 
427f847dd3SArnd Bergmann #define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt)		\
437f847dd3SArnd Bergmann static int __fops ## _open(struct inode *inode, struct file *file)	\
447f847dd3SArnd Bergmann {									\
457f847dd3SArnd Bergmann 	__simple_attr_check_format(__fmt, 0ull);			\
467f847dd3SArnd Bergmann 	return simple_attr_open(inode, file, __get, __set, __fmt);	\
477f847dd3SArnd Bergmann }									\
487f847dd3SArnd Bergmann static const struct file_operations __fops = {				\
497f847dd3SArnd Bergmann 	.owner	 = THIS_MODULE,						\
507f847dd3SArnd Bergmann 	.open	 = __fops ## _open,					\
517f847dd3SArnd Bergmann 	.release = simple_attr_release,					\
527f847dd3SArnd Bergmann 	.read	 = debugfs_attr_read,					\
537f847dd3SArnd Bergmann 	.write	 = debugfs_attr_write,					\
54895ce6c8SGeliang Tang 	.llseek  = no_llseek,						\
557f847dd3SArnd Bergmann }
567f847dd3SArnd Bergmann 
574250b047SKusanagi Kouichi typedef struct vfsmount *(*debugfs_automount_t)(struct dentry *, void *);
584250b047SKusanagi Kouichi 
591da177e4SLinus Torvalds #if defined(CONFIG_DEBUG_FS)
603634634eSHarvey Harrison 
61a7c5437bSOmar Sandoval struct dentry *debugfs_lookup(const char *name, struct dentry *parent);
62a7c5437bSOmar Sandoval 
63f4ae40a6SAl Viro struct dentry *debugfs_create_file(const char *name, umode_t mode,
641da177e4SLinus Torvalds 				   struct dentry *parent, void *data,
6599ac48f5SArjan van de Ven 				   const struct file_operations *fops);
66c6468808SNicolai Stange struct dentry *debugfs_create_file_unsafe(const char *name, umode_t mode,
67c6468808SNicolai Stange 				   struct dentry *parent, void *data,
68c6468808SNicolai Stange 				   const struct file_operations *fops);
691da177e4SLinus Torvalds 
70e59b4e91SDavid Howells struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
71e59b4e91SDavid Howells 					struct dentry *parent, void *data,
72e59b4e91SDavid Howells 					const struct file_operations *fops,
73e59b4e91SDavid Howells 					loff_t file_size);
74e59b4e91SDavid Howells 
751da177e4SLinus Torvalds struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
761da177e4SLinus Torvalds 
7766f54963SPeter Oberparleiter struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
7866f54963SPeter Oberparleiter 				      const char *dest);
7966f54963SPeter Oberparleiter 
8077b3da6eSAl Viro struct dentry *debugfs_create_automount(const char *name,
8177b3da6eSAl Viro 					struct dentry *parent,
8293faccbbSEric W. Biederman 					debugfs_automount_t f,
8377b3da6eSAl Viro 					void *data);
8477b3da6eSAl Viro 
851da177e4SLinus Torvalds void debugfs_remove(struct dentry *dentry);
86a3d1e7ebSAl Viro #define debugfs_remove_recursive debugfs_remove
871da177e4SLinus Torvalds 
88055ab8e3SNicolai Stange const struct file_operations *debugfs_real_fops(const struct file *filp);
897c8d4698SNicolai Stange 
90e9117a5aSNicolai Stange int debugfs_file_get(struct dentry *dentry);
91e9117a5aSNicolai Stange void debugfs_file_put(struct dentry *dentry);
92e9117a5aSNicolai Stange 
93c6468808SNicolai Stange ssize_t debugfs_attr_read(struct file *file, char __user *buf,
94c6468808SNicolai Stange 			size_t len, loff_t *ppos);
95c6468808SNicolai Stange ssize_t debugfs_attr_write(struct file *file, const char __user *buf,
96c6468808SNicolai Stange 			size_t len, loff_t *ppos);
97c6468808SNicolai Stange 
98cfc94cdfSJan Kara struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
99cfc94cdfSJan Kara                 struct dentry *new_dir, const char *new_name);
100cfc94cdfSJan Kara 
1019655ac4aSGreg Kroah-Hartman void debugfs_create_u8(const char *name, umode_t mode, struct dentry *parent,
1029655ac4aSGreg Kroah-Hartman 		       u8 *value);
103313f5dbbSGreg Kroah-Hartman void debugfs_create_u16(const char *name, umode_t mode, struct dentry *parent,
104313f5dbbSGreg Kroah-Hartman 			u16 *value);
105f4ae40a6SAl Viro struct dentry *debugfs_create_u32(const char *name, umode_t mode,
1061da177e4SLinus Torvalds 				  struct dentry *parent, u32 *value);
107ad26221fSGreg Kroah-Hartman void debugfs_create_u64(const char *name, umode_t mode, struct dentry *parent,
108ad26221fSGreg Kroah-Hartman 			u64 *value);
109c23fe831SViresh Kumar struct dentry *debugfs_create_ulong(const char *name, umode_t mode,
110c23fe831SViresh Kumar 				    struct dentry *parent, unsigned long *value);
111c7c11689SGreg Kroah-Hartman void debugfs_create_x8(const char *name, umode_t mode, struct dentry *parent,
112c7c11689SGreg Kroah-Hartman 		       u8 *value);
113e40d38f2SGreg Kroah-Hartman void debugfs_create_x16(const char *name, umode_t mode, struct dentry *parent,
114e40d38f2SGreg Kroah-Hartman 			u16 *value);
115f5cb0a7eSGreg Kroah-Hartman void debugfs_create_x32(const char *name, umode_t mode, struct dentry *parent,
116f5cb0a7eSGreg Kroah-Hartman 			u32 *value);
1170864c408SGreg Kroah-Hartman void debugfs_create_x64(const char *name, umode_t mode, struct dentry *parent,
1180864c408SGreg Kroah-Hartman 			u64 *value);
1198e580263SGreg Kroah-Hartman void debugfs_create_size_t(const char *name, umode_t mode,
1205e078787SInaky Perez-Gonzalez 			   struct dentry *parent, size_t *value);
1219927c6faSGreg Kroah-Hartman void debugfs_create_atomic_t(const char *name, umode_t mode,
1223a76e5e0SSeth Jennings 			     struct dentry *parent, atomic_t *value);
123f4ae40a6SAl Viro struct dentry *debugfs_create_bool(const char *name, umode_t mode,
124621a5f7aSViresh Kumar 				  struct dentry *parent, bool *value);
1251da177e4SLinus Torvalds 
126f4ae40a6SAl Viro struct dentry *debugfs_create_blob(const char *name, umode_t mode,
127dd308bc3SMichael Ellerman 				  struct dentry *parent,
128dd308bc3SMichael Ellerman 				  struct debugfs_blob_wrapper *blob);
129c0f92ba9SFrederic Weisbecker 
130*ae91c925SGreg Kroah-Hartman void debugfs_create_regset32(const char *name, umode_t mode,
1311a087c6aSAlessandro Rubini 			     struct dentry *parent,
1321a087c6aSAlessandro Rubini 			     struct debugfs_regset32 *regset);
1331a087c6aSAlessandro Rubini 
1349761536eSJoe Perches void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
1351a087c6aSAlessandro Rubini 			  int nregs, void __iomem *base, char *prefix);
1361a087c6aSAlessandro Rubini 
137c9c2c27dSGreg Kroah-Hartman void debugfs_create_u32_array(const char *name, umode_t mode,
138c9c2c27dSGreg Kroah-Hartman 			      struct dentry *parent, u32 *array, u32 elements);
1399fe2a701SSrivatsa Vaddagiri 
14098210b7fSArend van Spriel struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
14198210b7fSArend van Spriel 					   struct dentry *parent,
14298210b7fSArend van Spriel 					   int (*read_fn)(struct seq_file *s,
14398210b7fSArend van Spriel 							  void *data));
14498210b7fSArend van Spriel 
145c0f92ba9SFrederic Weisbecker bool debugfs_initialized(void);
146c0f92ba9SFrederic Weisbecker 
1470642ef6fSRichard Fitzgerald ssize_t debugfs_read_file_bool(struct file *file, char __user *user_buf,
1480642ef6fSRichard Fitzgerald 			       size_t count, loff_t *ppos);
1490642ef6fSRichard Fitzgerald 
1500642ef6fSRichard Fitzgerald ssize_t debugfs_write_file_bool(struct file *file, const char __user *user_buf,
1510642ef6fSRichard Fitzgerald 				size_t count, loff_t *ppos);
1520642ef6fSRichard Fitzgerald 
1531da177e4SLinus Torvalds #else
154a7a76cefSRoland Dreier 
155a7a76cefSRoland Dreier #include <linux/err.h>
156a7a76cefSRoland Dreier 
1571da177e4SLinus Torvalds /*
1581da177e4SLinus Torvalds  * We do not return NULL from these functions if CONFIG_DEBUG_FS is not enabled
1591da177e4SLinus Torvalds  * so users have a chance to detect if there was a real error or not.  We don't
1601da177e4SLinus Torvalds  * want to duplicate the design decision mistakes of procfs and devfs again.
1611da177e4SLinus Torvalds  */
1621da177e4SLinus Torvalds 
163a7c5437bSOmar Sandoval static inline struct dentry *debugfs_lookup(const char *name,
164a7c5437bSOmar Sandoval 					    struct dentry *parent)
165a7c5437bSOmar Sandoval {
166a7c5437bSOmar Sandoval 	return ERR_PTR(-ENODEV);
167a7c5437bSOmar Sandoval }
168a7c5437bSOmar Sandoval 
169f4ae40a6SAl Viro static inline struct dentry *debugfs_create_file(const char *name, umode_t mode,
170bde11d79SJean Delvare 					struct dentry *parent, void *data,
171bde11d79SJean Delvare 					const struct file_operations *fops)
1721da177e4SLinus Torvalds {
1731da177e4SLinus Torvalds 	return ERR_PTR(-ENODEV);
1741da177e4SLinus Torvalds }
1751da177e4SLinus Torvalds 
176c2a737ebSViresh Kumar static inline struct dentry *debugfs_create_file_unsafe(const char *name,
177c2a737ebSViresh Kumar 					umode_t mode, struct dentry *parent,
178c2a737ebSViresh Kumar 					void *data,
179c2a737ebSViresh Kumar 					const struct file_operations *fops)
180c2a737ebSViresh Kumar {
181c2a737ebSViresh Kumar 	return ERR_PTR(-ENODEV);
182c2a737ebSViresh Kumar }
183c2a737ebSViresh Kumar 
184e59b4e91SDavid Howells static inline struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
185e59b4e91SDavid Howells 					struct dentry *parent, void *data,
186e59b4e91SDavid Howells 					const struct file_operations *fops,
187e59b4e91SDavid Howells 					loff_t file_size)
188e59b4e91SDavid Howells {
189e59b4e91SDavid Howells 	return ERR_PTR(-ENODEV);
190e59b4e91SDavid Howells }
191e59b4e91SDavid Howells 
1921da177e4SLinus Torvalds static inline struct dentry *debugfs_create_dir(const char *name,
1931da177e4SLinus Torvalds 						struct dentry *parent)
1941da177e4SLinus Torvalds {
1951da177e4SLinus Torvalds 	return ERR_PTR(-ENODEV);
1961da177e4SLinus Torvalds }
1971da177e4SLinus Torvalds 
19866f54963SPeter Oberparleiter static inline struct dentry *debugfs_create_symlink(const char *name,
19966f54963SPeter Oberparleiter 						    struct dentry *parent,
20066f54963SPeter Oberparleiter 						    const char *dest)
20166f54963SPeter Oberparleiter {
20266f54963SPeter Oberparleiter 	return ERR_PTR(-ENODEV);
20366f54963SPeter Oberparleiter }
20466f54963SPeter Oberparleiter 
20594e1dec7SJiaxing Wang static inline struct dentry *debugfs_create_automount(const char *name,
20694e1dec7SJiaxing Wang 					struct dentry *parent,
2074250b047SKusanagi Kouichi 					debugfs_automount_t f,
20894e1dec7SJiaxing Wang 					void *data)
20994e1dec7SJiaxing Wang {
21094e1dec7SJiaxing Wang 	return ERR_PTR(-ENODEV);
21194e1dec7SJiaxing Wang }
21294e1dec7SJiaxing Wang 
2131da177e4SLinus Torvalds static inline void debugfs_remove(struct dentry *dentry)
2141da177e4SLinus Torvalds { }
2151da177e4SLinus Torvalds 
2169505e637SHaavard Skinnemoen static inline void debugfs_remove_recursive(struct dentry *dentry)
2179505e637SHaavard Skinnemoen { }
2189505e637SHaavard Skinnemoen 
219f50caa9bSArnd Bergmann const struct file_operations *debugfs_real_fops(const struct file *filp);
220f50caa9bSArnd Bergmann 
221e9117a5aSNicolai Stange static inline int debugfs_file_get(struct dentry *dentry)
222e9117a5aSNicolai Stange {
223e9117a5aSNicolai Stange 	return 0;
224e9117a5aSNicolai Stange }
225e9117a5aSNicolai Stange 
226e9117a5aSNicolai Stange static inline void debugfs_file_put(struct dentry *dentry)
227e9117a5aSNicolai Stange { }
228e9117a5aSNicolai Stange 
2297f847dd3SArnd Bergmann static inline ssize_t debugfs_attr_read(struct file *file, char __user *buf,
2307f847dd3SArnd Bergmann 					size_t len, loff_t *ppos)
2317f847dd3SArnd Bergmann {
2327f847dd3SArnd Bergmann 	return -ENODEV;
2337f847dd3SArnd Bergmann }
2347f847dd3SArnd Bergmann 
2357f847dd3SArnd Bergmann static inline ssize_t debugfs_attr_write(struct file *file,
2367f847dd3SArnd Bergmann 					const char __user *buf,
2377f847dd3SArnd Bergmann 					size_t len, loff_t *ppos)
2387f847dd3SArnd Bergmann {
2397f847dd3SArnd Bergmann 	return -ENODEV;
2407f847dd3SArnd Bergmann }
241c6468808SNicolai Stange 
242cfc94cdfSJan Kara static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
243cfc94cdfSJan Kara                 struct dentry *new_dir, char *new_name)
244cfc94cdfSJan Kara {
245cfc94cdfSJan Kara 	return ERR_PTR(-ENODEV);
246cfc94cdfSJan Kara }
247cfc94cdfSJan Kara 
2489655ac4aSGreg Kroah-Hartman static inline void debugfs_create_u8(const char *name, umode_t mode,
2499655ac4aSGreg Kroah-Hartman 				     struct dentry *parent, u8 *value) { }
2501da177e4SLinus Torvalds 
251313f5dbbSGreg Kroah-Hartman static inline void debugfs_create_u16(const char *name, umode_t mode,
252313f5dbbSGreg Kroah-Hartman 				      struct dentry *parent, u16 *value) { }
2531da177e4SLinus Torvalds 
254f4ae40a6SAl Viro static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode,
2551da177e4SLinus Torvalds 						struct dentry *parent,
2567b558637SMichal Ostrowski 						u32 *value)
2571da177e4SLinus Torvalds {
2581da177e4SLinus Torvalds 	return ERR_PTR(-ENODEV);
2591da177e4SLinus Torvalds }
2601da177e4SLinus Torvalds 
261ad26221fSGreg Kroah-Hartman static inline void debugfs_create_u64(const char *name, umode_t mode,
262ad26221fSGreg Kroah-Hartman 				      struct dentry *parent, u64 *value) { }
2638447891fSMichael Ellerman 
264c2a737ebSViresh Kumar static inline struct dentry *debugfs_create_ulong(const char *name,
265c2a737ebSViresh Kumar 						umode_t mode,
266c2a737ebSViresh Kumar 						struct dentry *parent,
267c2a737ebSViresh Kumar 						unsigned long *value)
268c2a737ebSViresh Kumar {
269c2a737ebSViresh Kumar 	return ERR_PTR(-ENODEV);
270c2a737ebSViresh Kumar }
271c2a737ebSViresh Kumar 
272c7c11689SGreg Kroah-Hartman static inline void debugfs_create_x8(const char *name, umode_t mode,
273c7c11689SGreg Kroah-Hartman 				     struct dentry *parent, u8 *value) { }
2742ebefc50SRobin Getz 
275e40d38f2SGreg Kroah-Hartman static inline void debugfs_create_x16(const char *name, umode_t mode,
276e40d38f2SGreg Kroah-Hartman 				      struct dentry *parent, u16 *value) { }
2772ebefc50SRobin Getz 
278f5cb0a7eSGreg Kroah-Hartman static inline void debugfs_create_x32(const char *name, umode_t mode,
279f5cb0a7eSGreg Kroah-Hartman 				      struct dentry *parent, u32 *value) { }
2802ebefc50SRobin Getz 
2810864c408SGreg Kroah-Hartman static inline void debugfs_create_x64(const char *name, umode_t mode,
2820864c408SGreg Kroah-Hartman 				      struct dentry *parent, u64 *value) { }
2833159269eSJohannes Berg 
2848e580263SGreg Kroah-Hartman static inline void debugfs_create_size_t(const char *name, umode_t mode,
2858e580263SGreg Kroah-Hartman 					 struct dentry *parent, size_t *value)
2868e580263SGreg Kroah-Hartman { }
2878adb711fSInaky Perez-Gonzalez 
2889927c6faSGreg Kroah-Hartman static inline void debugfs_create_atomic_t(const char *name, umode_t mode,
2899927c6faSGreg Kroah-Hartman 					   struct dentry *parent,
2909927c6faSGreg Kroah-Hartman 					   atomic_t *value)
2919927c6faSGreg Kroah-Hartman { }
2925b880214SWeijie Yang 
293f4ae40a6SAl Viro static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode,
2941da177e4SLinus Torvalds 						 struct dentry *parent,
295621a5f7aSViresh Kumar 						 bool *value)
2961da177e4SLinus Torvalds {
2971da177e4SLinus Torvalds 	return ERR_PTR(-ENODEV);
2981da177e4SLinus Torvalds }
2991da177e4SLinus Torvalds 
300f4ae40a6SAl Viro static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode,
301dd308bc3SMichael Ellerman 				  struct dentry *parent,
302dd308bc3SMichael Ellerman 				  struct debugfs_blob_wrapper *blob)
303dd308bc3SMichael Ellerman {
304dd308bc3SMichael Ellerman 	return ERR_PTR(-ENODEV);
305dd308bc3SMichael Ellerman }
306dd308bc3SMichael Ellerman 
307*ae91c925SGreg Kroah-Hartman static inline void debugfs_create_regset32(const char *name, umode_t mode,
308*ae91c925SGreg Kroah-Hartman 					   struct dentry *parent,
3091a087c6aSAlessandro Rubini 					   struct debugfs_regset32 *regset)
3101a087c6aSAlessandro Rubini {
3111a087c6aSAlessandro Rubini }
3121a087c6aSAlessandro Rubini 
3139761536eSJoe Perches static inline void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
3145b880214SWeijie Yang 			 int nregs, void __iomem *base, char *prefix)
3155b880214SWeijie Yang {
3165b880214SWeijie Yang }
3175b880214SWeijie Yang 
318c0f92ba9SFrederic Weisbecker static inline bool debugfs_initialized(void)
319c0f92ba9SFrederic Weisbecker {
320c0f92ba9SFrederic Weisbecker 	return false;
321c0f92ba9SFrederic Weisbecker }
322c0f92ba9SFrederic Weisbecker 
323c9c2c27dSGreg Kroah-Hartman static inline void debugfs_create_u32_array(const char *name, umode_t mode,
324c9c2c27dSGreg Kroah-Hartman 					    struct dentry *parent, u32 *array,
325c9c2c27dSGreg Kroah-Hartman 					    u32 elements)
3269fe2a701SSrivatsa Vaddagiri {
3279fe2a701SSrivatsa Vaddagiri }
3289fe2a701SSrivatsa Vaddagiri 
32998210b7fSArend van Spriel static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev,
33098210b7fSArend van Spriel 							 const char *name,
33198210b7fSArend van Spriel 							 struct dentry *parent,
33298210b7fSArend van Spriel 					   int (*read_fn)(struct seq_file *s,
33398210b7fSArend van Spriel 							  void *data))
33498210b7fSArend van Spriel {
33598210b7fSArend van Spriel 	return ERR_PTR(-ENODEV);
33698210b7fSArend van Spriel }
33798210b7fSArend van Spriel 
3380642ef6fSRichard Fitzgerald static inline ssize_t debugfs_read_file_bool(struct file *file,
3390642ef6fSRichard Fitzgerald 					     char __user *user_buf,
3400642ef6fSRichard Fitzgerald 					     size_t count, loff_t *ppos)
3410642ef6fSRichard Fitzgerald {
3420642ef6fSRichard Fitzgerald 	return -ENODEV;
3430642ef6fSRichard Fitzgerald }
3440642ef6fSRichard Fitzgerald 
3450642ef6fSRichard Fitzgerald static inline ssize_t debugfs_write_file_bool(struct file *file,
3460642ef6fSRichard Fitzgerald 					      const char __user *user_buf,
3470642ef6fSRichard Fitzgerald 					      size_t count, loff_t *ppos)
3480642ef6fSRichard Fitzgerald {
3490642ef6fSRichard Fitzgerald 	return -ENODEV;
3500642ef6fSRichard Fitzgerald }
3510642ef6fSRichard Fitzgerald 
3521da177e4SLinus Torvalds #endif
3531da177e4SLinus Torvalds 
354d3504757SGeert Uytterhoeven /**
355d3504757SGeert Uytterhoeven  * debugfs_create_xul - create a debugfs file that is used to read and write an
356d3504757SGeert Uytterhoeven  * unsigned long value, formatted in hexadecimal
357d3504757SGeert Uytterhoeven  * @name: a pointer to a string containing the name of the file to create.
358d3504757SGeert Uytterhoeven  * @mode: the permission that the file should have
359d3504757SGeert Uytterhoeven  * @parent: a pointer to the parent dentry for this file.  This should be a
360d3504757SGeert Uytterhoeven  *          directory dentry if set.  If this parameter is %NULL, then the
361d3504757SGeert Uytterhoeven  *          file will be created in the root of the debugfs filesystem.
362d3504757SGeert Uytterhoeven  * @value: a pointer to the variable that the file should read to and write
363d3504757SGeert Uytterhoeven  *         from.
364d3504757SGeert Uytterhoeven  */
365d3504757SGeert Uytterhoeven static inline void debugfs_create_xul(const char *name, umode_t mode,
366d3504757SGeert Uytterhoeven 				      struct dentry *parent,
367d3504757SGeert Uytterhoeven 				      unsigned long *value)
368d3504757SGeert Uytterhoeven {
369d3504757SGeert Uytterhoeven 	if (sizeof(*value) == sizeof(u32))
370d3504757SGeert Uytterhoeven 		debugfs_create_x32(name, mode, parent, (u32 *)value);
371d3504757SGeert Uytterhoeven 	else
372d3504757SGeert Uytterhoeven 		debugfs_create_x64(name, mode, parent, (u64 *)value);
373d3504757SGeert Uytterhoeven }
374d3504757SGeert Uytterhoeven 
3751da177e4SLinus Torvalds #endif
376