.. | .. |
---|
35 | 35 | const struct debugfs_reg32 *regs; |
---|
36 | 36 | int nregs; |
---|
37 | 37 | void __iomem *base; |
---|
| 38 | + struct device *dev; /* Optional device for Runtime PM */ |
---|
| 39 | +}; |
---|
| 40 | + |
---|
| 41 | +struct debugfs_u32_array { |
---|
| 42 | + u32 *array; |
---|
| 43 | + u32 n_elements; |
---|
38 | 44 | }; |
---|
39 | 45 | |
---|
40 | 46 | extern struct dentry *arch_debugfs_dir; |
---|
.. | .. |
---|
67 | 73 | struct dentry *parent, void *data, |
---|
68 | 74 | const struct file_operations *fops); |
---|
69 | 75 | |
---|
70 | | -struct dentry *debugfs_create_file_size(const char *name, umode_t mode, |
---|
71 | | - struct dentry *parent, void *data, |
---|
72 | | - const struct file_operations *fops, |
---|
73 | | - loff_t file_size); |
---|
| 76 | +void debugfs_create_file_size(const char *name, umode_t mode, |
---|
| 77 | + struct dentry *parent, void *data, |
---|
| 78 | + const struct file_operations *fops, |
---|
| 79 | + loff_t file_size); |
---|
74 | 80 | |
---|
75 | 81 | struct dentry *debugfs_create_dir(const char *name, struct dentry *parent); |
---|
76 | 82 | |
---|
.. | .. |
---|
83 | 89 | void *data); |
---|
84 | 90 | |
---|
85 | 91 | void debugfs_remove(struct dentry *dentry); |
---|
86 | | -void debugfs_remove_recursive(struct dentry *dentry); |
---|
| 92 | +#define debugfs_remove_recursive debugfs_remove |
---|
| 93 | + |
---|
| 94 | +void debugfs_lookup_and_remove(const char *name, struct dentry *parent); |
---|
87 | 95 | |
---|
88 | 96 | const struct file_operations *debugfs_real_fops(const struct file *filp); |
---|
89 | 97 | |
---|
.. | .. |
---|
98 | 106 | struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, |
---|
99 | 107 | struct dentry *new_dir, const char *new_name); |
---|
100 | 108 | |
---|
101 | | -struct dentry *debugfs_create_u8(const char *name, umode_t mode, |
---|
102 | | - struct dentry *parent, u8 *value); |
---|
103 | | -struct dentry *debugfs_create_u16(const char *name, umode_t mode, |
---|
104 | | - struct dentry *parent, u16 *value); |
---|
105 | | -struct dentry *debugfs_create_u32(const char *name, umode_t mode, |
---|
106 | | - struct dentry *parent, u32 *value); |
---|
107 | | -struct dentry *debugfs_create_u64(const char *name, umode_t mode, |
---|
108 | | - struct dentry *parent, u64 *value); |
---|
| 109 | +void debugfs_create_u8(const char *name, umode_t mode, struct dentry *parent, |
---|
| 110 | + u8 *value); |
---|
| 111 | +void debugfs_create_u16(const char *name, umode_t mode, struct dentry *parent, |
---|
| 112 | + u16 *value); |
---|
| 113 | +void debugfs_create_u32(const char *name, umode_t mode, struct dentry *parent, |
---|
| 114 | + u32 *value); |
---|
| 115 | +void debugfs_create_u64(const char *name, umode_t mode, struct dentry *parent, |
---|
| 116 | + u64 *value); |
---|
109 | 117 | struct dentry *debugfs_create_ulong(const char *name, umode_t mode, |
---|
110 | 118 | struct dentry *parent, unsigned long *value); |
---|
111 | | -struct dentry *debugfs_create_x8(const char *name, umode_t mode, |
---|
112 | | - struct dentry *parent, u8 *value); |
---|
113 | | -struct dentry *debugfs_create_x16(const char *name, umode_t mode, |
---|
114 | | - struct dentry *parent, u16 *value); |
---|
115 | | -struct dentry *debugfs_create_x32(const char *name, umode_t mode, |
---|
116 | | - struct dentry *parent, u32 *value); |
---|
117 | | -struct dentry *debugfs_create_x64(const char *name, umode_t mode, |
---|
118 | | - struct dentry *parent, u64 *value); |
---|
119 | | -struct dentry *debugfs_create_size_t(const char *name, umode_t mode, |
---|
120 | | - struct dentry *parent, size_t *value); |
---|
121 | | -struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode, |
---|
122 | | - struct dentry *parent, atomic_t *value); |
---|
| 119 | +void debugfs_create_x8(const char *name, umode_t mode, struct dentry *parent, |
---|
| 120 | + u8 *value); |
---|
| 121 | +void debugfs_create_x16(const char *name, umode_t mode, struct dentry *parent, |
---|
| 122 | + u16 *value); |
---|
| 123 | +void debugfs_create_x32(const char *name, umode_t mode, struct dentry *parent, |
---|
| 124 | + u32 *value); |
---|
| 125 | +void debugfs_create_x64(const char *name, umode_t mode, struct dentry *parent, |
---|
| 126 | + u64 *value); |
---|
| 127 | +void debugfs_create_size_t(const char *name, umode_t mode, |
---|
| 128 | + struct dentry *parent, size_t *value); |
---|
| 129 | +void debugfs_create_atomic_t(const char *name, umode_t mode, |
---|
| 130 | + struct dentry *parent, atomic_t *value); |
---|
123 | 131 | struct dentry *debugfs_create_bool(const char *name, umode_t mode, |
---|
124 | 132 | struct dentry *parent, bool *value); |
---|
125 | 133 | |
---|
.. | .. |
---|
127 | 135 | struct dentry *parent, |
---|
128 | 136 | struct debugfs_blob_wrapper *blob); |
---|
129 | 137 | |
---|
130 | | -struct dentry *debugfs_create_regset32(const char *name, umode_t mode, |
---|
131 | | - struct dentry *parent, |
---|
132 | | - struct debugfs_regset32 *regset); |
---|
| 138 | +void debugfs_create_regset32(const char *name, umode_t mode, |
---|
| 139 | + struct dentry *parent, |
---|
| 140 | + struct debugfs_regset32 *regset); |
---|
133 | 141 | |
---|
134 | 142 | void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, |
---|
135 | 143 | int nregs, void __iomem *base, char *prefix); |
---|
136 | 144 | |
---|
137 | | -struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, |
---|
138 | | - struct dentry *parent, |
---|
139 | | - u32 *array, u32 elements); |
---|
| 145 | +void debugfs_create_u32_array(const char *name, umode_t mode, |
---|
| 146 | + struct dentry *parent, |
---|
| 147 | + struct debugfs_u32_array *array); |
---|
140 | 148 | |
---|
141 | | -struct dentry *debugfs_create_u32_array_hex(const char *name, umode_t mode, |
---|
142 | | - struct dentry *parent, |
---|
143 | | - u32 *array, u32 elements); |
---|
144 | | - |
---|
145 | | -struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name, |
---|
146 | | - struct dentry *parent, |
---|
147 | | - int (*read_fn)(struct seq_file *s, |
---|
148 | | - void *data)); |
---|
| 149 | +void debugfs_create_devm_seqfile(struct device *dev, const char *name, |
---|
| 150 | + struct dentry *parent, |
---|
| 151 | + int (*read_fn)(struct seq_file *s, void *data)); |
---|
149 | 152 | |
---|
150 | 153 | bool debugfs_initialized(void); |
---|
151 | 154 | |
---|
.. | .. |
---|
186 | 189 | return ERR_PTR(-ENODEV); |
---|
187 | 190 | } |
---|
188 | 191 | |
---|
189 | | -static inline struct dentry *debugfs_create_file_size(const char *name, umode_t mode, |
---|
190 | | - struct dentry *parent, void *data, |
---|
191 | | - const struct file_operations *fops, |
---|
192 | | - loff_t file_size) |
---|
193 | | -{ |
---|
194 | | - return ERR_PTR(-ENODEV); |
---|
195 | | -} |
---|
| 192 | +static inline void debugfs_create_file_size(const char *name, umode_t mode, |
---|
| 193 | + struct dentry *parent, void *data, |
---|
| 194 | + const struct file_operations *fops, |
---|
| 195 | + loff_t file_size) |
---|
| 196 | +{ } |
---|
196 | 197 | |
---|
197 | 198 | static inline struct dentry *debugfs_create_dir(const char *name, |
---|
198 | 199 | struct dentry *parent) |
---|
.. | .. |
---|
219 | 220 | { } |
---|
220 | 221 | |
---|
221 | 222 | static inline void debugfs_remove_recursive(struct dentry *dentry) |
---|
| 223 | +{ } |
---|
| 224 | + |
---|
| 225 | +static inline void debugfs_lookup_and_remove(const char *name, |
---|
| 226 | + struct dentry *parent) |
---|
222 | 227 | { } |
---|
223 | 228 | |
---|
224 | 229 | const struct file_operations *debugfs_real_fops(const struct file *filp); |
---|
.. | .. |
---|
250 | 255 | return ERR_PTR(-ENODEV); |
---|
251 | 256 | } |
---|
252 | 257 | |
---|
253 | | -static inline struct dentry *debugfs_create_u8(const char *name, umode_t mode, |
---|
254 | | - struct dentry *parent, |
---|
255 | | - u8 *value) |
---|
256 | | -{ |
---|
257 | | - return ERR_PTR(-ENODEV); |
---|
258 | | -} |
---|
| 258 | +static inline void debugfs_create_u8(const char *name, umode_t mode, |
---|
| 259 | + struct dentry *parent, u8 *value) { } |
---|
259 | 260 | |
---|
260 | | -static inline struct dentry *debugfs_create_u16(const char *name, umode_t mode, |
---|
261 | | - struct dentry *parent, |
---|
262 | | - u16 *value) |
---|
263 | | -{ |
---|
264 | | - return ERR_PTR(-ENODEV); |
---|
265 | | -} |
---|
| 261 | +static inline void debugfs_create_u16(const char *name, umode_t mode, |
---|
| 262 | + struct dentry *parent, u16 *value) { } |
---|
266 | 263 | |
---|
267 | | -static inline struct dentry *debugfs_create_u32(const char *name, umode_t mode, |
---|
268 | | - struct dentry *parent, |
---|
269 | | - u32 *value) |
---|
270 | | -{ |
---|
271 | | - return ERR_PTR(-ENODEV); |
---|
272 | | -} |
---|
| 264 | +static inline void debugfs_create_u32(const char *name, umode_t mode, |
---|
| 265 | + struct dentry *parent, u32 *value) { } |
---|
273 | 266 | |
---|
274 | | -static inline struct dentry *debugfs_create_u64(const char *name, umode_t mode, |
---|
275 | | - struct dentry *parent, |
---|
276 | | - u64 *value) |
---|
277 | | -{ |
---|
278 | | - return ERR_PTR(-ENODEV); |
---|
279 | | -} |
---|
| 267 | +static inline void debugfs_create_u64(const char *name, umode_t mode, |
---|
| 268 | + struct dentry *parent, u64 *value) { } |
---|
280 | 269 | |
---|
281 | 270 | static inline struct dentry *debugfs_create_ulong(const char *name, |
---|
282 | 271 | umode_t mode, |
---|
.. | .. |
---|
286 | 275 | return ERR_PTR(-ENODEV); |
---|
287 | 276 | } |
---|
288 | 277 | |
---|
289 | | -static inline struct dentry *debugfs_create_x8(const char *name, umode_t mode, |
---|
290 | | - struct dentry *parent, |
---|
291 | | - u8 *value) |
---|
292 | | -{ |
---|
293 | | - return ERR_PTR(-ENODEV); |
---|
294 | | -} |
---|
| 278 | +static inline void debugfs_create_x8(const char *name, umode_t mode, |
---|
| 279 | + struct dentry *parent, u8 *value) { } |
---|
295 | 280 | |
---|
296 | | -static inline struct dentry *debugfs_create_x16(const char *name, umode_t mode, |
---|
297 | | - struct dentry *parent, |
---|
298 | | - u16 *value) |
---|
299 | | -{ |
---|
300 | | - return ERR_PTR(-ENODEV); |
---|
301 | | -} |
---|
| 281 | +static inline void debugfs_create_x16(const char *name, umode_t mode, |
---|
| 282 | + struct dentry *parent, u16 *value) { } |
---|
302 | 283 | |
---|
303 | | -static inline struct dentry *debugfs_create_x32(const char *name, umode_t mode, |
---|
304 | | - struct dentry *parent, |
---|
305 | | - u32 *value) |
---|
306 | | -{ |
---|
307 | | - return ERR_PTR(-ENODEV); |
---|
308 | | -} |
---|
| 284 | +static inline void debugfs_create_x32(const char *name, umode_t mode, |
---|
| 285 | + struct dentry *parent, u32 *value) { } |
---|
309 | 286 | |
---|
310 | | -static inline struct dentry *debugfs_create_x64(const char *name, umode_t mode, |
---|
311 | | - struct dentry *parent, |
---|
312 | | - u64 *value) |
---|
313 | | -{ |
---|
314 | | - return ERR_PTR(-ENODEV); |
---|
315 | | -} |
---|
| 287 | +static inline void debugfs_create_x64(const char *name, umode_t mode, |
---|
| 288 | + struct dentry *parent, u64 *value) { } |
---|
316 | 289 | |
---|
317 | | -static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mode, |
---|
318 | | - struct dentry *parent, |
---|
319 | | - size_t *value) |
---|
320 | | -{ |
---|
321 | | - return ERR_PTR(-ENODEV); |
---|
322 | | -} |
---|
| 290 | +static inline void debugfs_create_size_t(const char *name, umode_t mode, |
---|
| 291 | + struct dentry *parent, size_t *value) |
---|
| 292 | +{ } |
---|
323 | 293 | |
---|
324 | | -static inline struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode, |
---|
325 | | - struct dentry *parent, atomic_t *value) |
---|
326 | | -{ |
---|
327 | | - return ERR_PTR(-ENODEV); |
---|
328 | | -} |
---|
| 294 | +static inline void debugfs_create_atomic_t(const char *name, umode_t mode, |
---|
| 295 | + struct dentry *parent, |
---|
| 296 | + atomic_t *value) |
---|
| 297 | +{ } |
---|
329 | 298 | |
---|
330 | 299 | static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode, |
---|
331 | 300 | struct dentry *parent, |
---|
.. | .. |
---|
341 | 310 | return ERR_PTR(-ENODEV); |
---|
342 | 311 | } |
---|
343 | 312 | |
---|
344 | | -static inline struct dentry *debugfs_create_regset32(const char *name, |
---|
345 | | - umode_t mode, struct dentry *parent, |
---|
346 | | - struct debugfs_regset32 *regset) |
---|
| 313 | +static inline void debugfs_create_regset32(const char *name, umode_t mode, |
---|
| 314 | + struct dentry *parent, |
---|
| 315 | + struct debugfs_regset32 *regset) |
---|
347 | 316 | { |
---|
348 | | - return ERR_PTR(-ENODEV); |
---|
349 | 317 | } |
---|
350 | 318 | |
---|
351 | 319 | static inline void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, |
---|
.. | .. |
---|
358 | 326 | return false; |
---|
359 | 327 | } |
---|
360 | 328 | |
---|
361 | | -static inline struct dentry *debugfs_create_u32_array(const char *name, umode_t mode, |
---|
362 | | - struct dentry *parent, |
---|
363 | | - u32 *array, u32 elements) |
---|
| 329 | +static inline void debugfs_create_u32_array(const char *name, umode_t mode, |
---|
| 330 | + struct dentry *parent, |
---|
| 331 | + struct debugfs_u32_array *array) |
---|
364 | 332 | { |
---|
365 | | - return ERR_PTR(-ENODEV); |
---|
366 | 333 | } |
---|
367 | 334 | |
---|
368 | | -static inline struct dentry *debugfs_create_u32_array_hex(const char *name, umode_t mode, |
---|
369 | | - struct dentry *parent, |
---|
370 | | - u32 *array, u32 elements) |
---|
| 335 | +static inline void debugfs_create_devm_seqfile(struct device *dev, |
---|
| 336 | + const char *name, |
---|
| 337 | + struct dentry *parent, |
---|
| 338 | + int (*read_fn)(struct seq_file *s, |
---|
| 339 | + void *data)) |
---|
371 | 340 | { |
---|
372 | | - return ERR_PTR(-ENODEV); |
---|
373 | | -} |
---|
374 | | - |
---|
375 | | -static inline struct dentry *debugfs_create_devm_seqfile(struct device *dev, |
---|
376 | | - const char *name, |
---|
377 | | - struct dentry *parent, |
---|
378 | | - int (*read_fn)(struct seq_file *s, |
---|
379 | | - void *data)) |
---|
380 | | -{ |
---|
381 | | - return ERR_PTR(-ENODEV); |
---|
382 | 341 | } |
---|
383 | 342 | |
---|
384 | 343 | static inline ssize_t debugfs_read_file_bool(struct file *file, |
---|
.. | .. |
---|
397 | 356 | |
---|
398 | 357 | #endif |
---|
399 | 358 | |
---|
| 359 | +/** |
---|
| 360 | + * debugfs_create_xul - create a debugfs file that is used to read and write an |
---|
| 361 | + * unsigned long value, formatted in hexadecimal |
---|
| 362 | + * @name: a pointer to a string containing the name of the file to create. |
---|
| 363 | + * @mode: the permission that the file should have |
---|
| 364 | + * @parent: a pointer to the parent dentry for this file. This should be a |
---|
| 365 | + * directory dentry if set. If this parameter is %NULL, then the |
---|
| 366 | + * file will be created in the root of the debugfs filesystem. |
---|
| 367 | + * @value: a pointer to the variable that the file should read to and write |
---|
| 368 | + * from. |
---|
| 369 | + */ |
---|
| 370 | +static inline void debugfs_create_xul(const char *name, umode_t mode, |
---|
| 371 | + struct dentry *parent, |
---|
| 372 | + unsigned long *value) |
---|
| 373 | +{ |
---|
| 374 | + if (sizeof(*value) == sizeof(u32)) |
---|
| 375 | + debugfs_create_x32(name, mode, parent, (u32 *)value); |
---|
| 376 | + else |
---|
| 377 | + debugfs_create_x64(name, mode, parent, (u64 *)value); |
---|
| 378 | +} |
---|
| 379 | + |
---|
400 | 380 | #endif |
---|