aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2009-12-04 19:27:29 -0500
committerMike Frysinger <vapier@gentoo.org>2009-12-15 00:16:49 -0500
commit397b761cc42e2c56f8de07de680486892448b628 (patch)
tree77d15a1f1db434cad6d94ef73b03bdae292ef922 /arch
parentc768a943fd8f41f5f7ed33c91d50818b301f5635 (diff)
Blackfin: convert kgdbtest to proc_fops
The read_proc and write_proc interfaces are going to be removed in the common kernel code. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/blackfin/kernel/kgdb_test.c39
1 files changed, 12 insertions, 27 deletions
diff --git a/arch/blackfin/kernel/kgdb_test.c b/arch/blackfin/kernel/kgdb_test.c
index 59fc42dc5d6a..6fc4e5f62261 100644
--- a/arch/blackfin/kernel/kgdb_test.c
+++ b/arch/blackfin/kernel/kgdb_test.c
@@ -18,7 +18,7 @@
18#include <asm/blackfin.h> 18#include <asm/blackfin.h>
19 19
20static char cmdline[256]; 20static char cmdline[256];
21static unsigned long len; 21static size_t len;
22 22
23#ifndef CONFIG_SMP 23#ifndef CONFIG_SMP
24static int num1 __attribute__((l1_data)); 24static int num1 __attribute__((l1_data));
@@ -59,7 +59,8 @@ int kgdb_test(char *name, int len, int count, int z)
59 return count; 59 return count;
60} 60}
61 61
62static int test_proc_output(char *buf) 62static ssize_t kgdb_test_proc_read(struct file *file, char __user *buf,
63 size_t count, loff_t *ppos)
63{ 64{
64 kgdb_test("hello world!", 12, 0x55, 0x10); 65 kgdb_test("hello world!", 12, 0x55, 0x10);
65#ifndef CONFIG_SMP 66#ifndef CONFIG_SMP
@@ -72,25 +73,8 @@ static int test_proc_output(char *buf)
72 return 0; 73 return 0;
73} 74}
74 75
75static int test_read_proc(char *page, char **start, off_t off, 76static ssize_t kgdb_test_proc_write(struct file *file,
76 int count, int *eof, void *data) 77 const char __user *buffer, size_t count, loff_t *pos)
77{
78 int len;
79
80 len = test_proc_output(page);
81 if (len <= off+count)
82 *eof = 1;
83 *start = page + off;
84 len -= off;
85 if (len > count)
86 len = count;
87 if (len < 0)
88 len = 0;
89 return len;
90}
91
92static int test_write_proc(struct file *file, const char *buffer,
93 unsigned long count, void *data)
94{ 78{
95 if (count >= 256) 79 if (count >= 256)
96 len = 255; 80 len = 255;
@@ -103,18 +87,19 @@ static int test_write_proc(struct file *file, const char *buffer,
103 return len; 87 return len;
104} 88}
105 89
90static const struct file_operations kgdb_test_proc_fops = {
91 .owner = THIS_MODULE,
92 .read = kgdb_test_proc_read,
93 .write = kgdb_test_proc_write,
94};
95
106static int __init kgdbtest_init(void) 96static int __init kgdbtest_init(void)
107{ 97{
108 struct proc_dir_entry *entry; 98 struct proc_dir_entry *entry;
109 99
110 entry = create_proc_entry("kgdbtest", 0, NULL); 100 entry = proc_create("kgdbtest", 0, NULL, &kgdb_test_proc_fops);
111 if (entry == NULL) 101 if (entry == NULL)
112 return -ENOMEM; 102 return -ENOMEM;
113
114 entry->read_proc = test_read_proc;
115 entry->write_proc = test_write_proc;
116 entry->data = NULL;
117
118 return 0; 103 return 0;
119} 104}
120 105