cxgb4: Enable cim_la dump to support T6
[linux-2.6/btrfs-unstable.git] / drivers / ras / debugfs.c
blob0322acf67ea5efc88c6656b9dca3868d9764dc71
1 #include <linux/debugfs.h>
3 static struct dentry *ras_debugfs_dir;
5 static atomic_t trace_count = ATOMIC_INIT(0);
7 int ras_userspace_consumers(void)
9 return atomic_read(&trace_count);
11 EXPORT_SYMBOL_GPL(ras_userspace_consumers);
13 static int trace_show(struct seq_file *m, void *v)
15 return atomic_read(&trace_count);
18 static int trace_open(struct inode *inode, struct file *file)
20 atomic_inc(&trace_count);
21 return single_open(file, trace_show, NULL);
24 static int trace_release(struct inode *inode, struct file *file)
26 atomic_dec(&trace_count);
27 return single_release(inode, file);
30 static const struct file_operations trace_fops = {
31 .open = trace_open,
32 .read = seq_read,
33 .llseek = seq_lseek,
34 .release = trace_release,
37 int __init ras_add_daemon_trace(void)
39 struct dentry *fentry;
41 if (!ras_debugfs_dir)
42 return -ENOENT;
44 fentry = debugfs_create_file("daemon_active", S_IRUSR, ras_debugfs_dir,
45 NULL, &trace_fops);
46 if (!fentry)
47 return -ENODEV;
49 return 0;
53 void __init ras_debugfs_init(void)
55 ras_debugfs_dir = debugfs_create_dir("ras", NULL);