25 #define pr_fmt(fmt) "%s: " fmt, __func__
27 #include <linux/kernel.h>
30 #include <linux/device.h>
36 static struct dentry *rproc_dbg;
47 static ssize_t rproc_trace_read(
struct file *filp,
char __user *userbuf,
48 size_t count, loff_t *ppos)
57 .read = rproc_trace_read,
66 static const char *
const rproc_state_string[] = {
75 static ssize_t rproc_state_read(
struct file *filp,
char __user *userbuf,
76 size_t count, loff_t *ppos)
85 i =
scnprintf(buf, 30,
"%.28s (%d)\n", rproc_state_string[state],
92 .read = rproc_state_read,
98 static ssize_t rproc_name_read(
struct file *filp,
char __user *userbuf,
99 size_t count, loff_t *ppos)
112 .read = rproc_name_read,
118 static ssize_t rproc_recovery_read(
struct file *filp,
char __user *userbuf,
119 size_t count, loff_t *ppos)
152 rproc_recovery_write(
struct file *filp,
const char __user *user_buf,
153 size_t count, loff_t *ppos)
159 if (count >
sizeof(buf))
167 if (buf[count - 1] ==
'\n')
168 buf[count - 1] =
'\0';
170 if (!
strncmp(buf,
"enabled", count)) {
175 }
else if (!
strncmp(buf,
"disabled", count)) {
177 }
else if (!
strncmp(buf,
"recover", count)) {
187 .read = rproc_recovery_read,
188 .write = rproc_recovery_write,
204 trace, &trace_rproc_ops);
206 dev_err(&rproc->
dev,
"failed to create debugfs trace entry\n");
233 rproc, &rproc_name_ops);
235 rproc, &rproc_state_ops);
237 rproc, &rproc_recovery_ops);
245 pr_err(
"can't create debugfs dir\n");