diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-12-07 05:20:20 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-12-15 00:16:50 -0500 |
commit | 88f7c2fb0fa96887c7be8cdb00afb1a6f9d7894e (patch) | |
tree | 0516ef6d1fa0e13d2b3e77114ff85021253af550 /arch/blackfin | |
parent | 397b761cc42e2c56f8de07de680486892448b628 (diff) |
Blackfin: kgdb_test: clean up code a bit
- document simple global symbols
- convert printk to pr_*
- clean up spurious whitespace
- use min_t()
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin')
-rw-r--r-- | arch/blackfin/kernel/kgdb_test.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/arch/blackfin/kernel/kgdb_test.c b/arch/blackfin/kernel/kgdb_test.c index 6fc4e5f62261..9a4b07594389 100644 --- a/arch/blackfin/kernel/kgdb_test.c +++ b/arch/blackfin/kernel/kgdb_test.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <asm/blackfin.h> | 18 | #include <asm/blackfin.h> |
19 | 19 | ||
20 | /* Symbols are here for kgdb test to poke directly */ | ||
20 | static char cmdline[256]; | 21 | static char cmdline[256]; |
21 | static size_t len; | 22 | static size_t len; |
22 | 23 | ||
@@ -27,11 +28,10 @@ void kgdb_l1_test(void) __attribute__((l1_text)); | |||
27 | 28 | ||
28 | void kgdb_l1_test(void) | 29 | void kgdb_l1_test(void) |
29 | { | 30 | { |
30 | printk(KERN_ALERT "L1(before change) : data variable addr = 0x%p, data value is %d\n", &num1, num1); | 31 | pr_alert("L1(before change) : data variable addr = 0x%p, data value is %d\n", &num1, num1); |
31 | printk(KERN_ALERT "L1 : code function addr = 0x%p\n", kgdb_l1_test); | 32 | pr_alert("L1 : code function addr = 0x%p\n", kgdb_l1_test); |
32 | num1 = num1 + 10 ; | 33 | num1 = num1 + 10; |
33 | printk(KERN_ALERT "L1(after change) : data variable addr = 0x%p, data value is %d\n", &num1, num1); | 34 | pr_alert("L1(after change) : data variable addr = 0x%p, data value is %d\n", &num1, num1); |
34 | return ; | ||
35 | } | 35 | } |
36 | #endif | 36 | #endif |
37 | 37 | ||
@@ -42,11 +42,10 @@ void kgdb_l2_test(void) __attribute__((l2)); | |||
42 | 42 | ||
43 | void kgdb_l2_test(void) | 43 | void kgdb_l2_test(void) |
44 | { | 44 | { |
45 | printk(KERN_ALERT "L2(before change) : data variable addr = 0x%p, data value is %d\n", &num2, num2); | 45 | pr_alert("L2(before change) : data variable addr = 0x%p, data value is %d\n", &num2, num2); |
46 | printk(KERN_ALERT "L2 : code function addr = 0x%p\n", kgdb_l2_test); | 46 | pr_alert("L2 : code function addr = 0x%p\n", kgdb_l2_test); |
47 | num2 = num2 + 20 ; | 47 | num2 = num2 + 20; |
48 | printk(KERN_ALERT "L2(after change) : data variable addr = 0x%p, data value is %d\n", &num2, num2); | 48 | pr_alert("L2(after change) : data variable addr = 0x%p, data value is %d\n", &num2, num2); |
49 | return ; | ||
50 | } | 49 | } |
51 | 50 | ||
52 | #endif | 51 | #endif |
@@ -54,13 +53,14 @@ void kgdb_l2_test(void) | |||
54 | 53 | ||
55 | int kgdb_test(char *name, int len, int count, int z) | 54 | int kgdb_test(char *name, int len, int count, int z) |
56 | { | 55 | { |
57 | printk(KERN_ALERT "kgdb name(%d): %s, %d, %d\n", len, name, count, z); | 56 | pr_alert("kgdb name(%d): %s, %d, %d\n", len, name, count, z); |
58 | count = z; | 57 | count = z; |
59 | return count; | 58 | return count; |
60 | } | 59 | } |
61 | 60 | ||
62 | static ssize_t kgdb_test_proc_read(struct file *file, char __user *buf, | 61 | static ssize_t |
63 | size_t count, loff_t *ppos) | 62 | kgdb_test_proc_read(struct file *file, char __user *buf, |
63 | size_t count, loff_t *ppos) | ||
64 | { | 64 | { |
65 | kgdb_test("hello world!", 12, 0x55, 0x10); | 65 | kgdb_test("hello world!", 12, 0x55, 0x10); |
66 | #ifndef CONFIG_SMP | 66 | #ifndef CONFIG_SMP |
@@ -73,14 +73,11 @@ static ssize_t kgdb_test_proc_read(struct file *file, char __user *buf, | |||
73 | return 0; | 73 | return 0; |
74 | } | 74 | } |
75 | 75 | ||
76 | static ssize_t kgdb_test_proc_write(struct file *file, | 76 | static ssize_t |
77 | const char __user *buffer, size_t count, loff_t *pos) | 77 | kgdb_test_proc_write(struct file *file, const char __user *buffer, |
78 | size_t count, loff_t *pos) | ||
78 | { | 79 | { |
79 | if (count >= 256) | 80 | len = min_t(size_t, 255, count); |
80 | len = 255; | ||
81 | else | ||
82 | len = count; | ||
83 | |||
84 | memcpy(cmdline, buffer, count); | 81 | memcpy(cmdline, buffer, count); |
85 | cmdline[len] = 0; | 82 | cmdline[len] = 0; |
86 | 83 | ||
@@ -88,9 +85,9 @@ static ssize_t kgdb_test_proc_write(struct file *file, | |||
88 | } | 85 | } |
89 | 86 | ||
90 | static const struct file_operations kgdb_test_proc_fops = { | 87 | static const struct file_operations kgdb_test_proc_fops = { |
91 | .owner = THIS_MODULE, | 88 | .owner = THIS_MODULE, |
92 | .read = kgdb_test_proc_read, | 89 | .read = kgdb_test_proc_read, |
93 | .write = kgdb_test_proc_write, | 90 | .write = kgdb_test_proc_write, |
94 | }; | 91 | }; |
95 | 92 | ||
96 | static int __init kgdbtest_init(void) | 93 | static int __init kgdbtest_init(void) |
@@ -100,6 +97,7 @@ static int __init kgdbtest_init(void) | |||
100 | entry = proc_create("kgdbtest", 0, NULL, &kgdb_test_proc_fops); | 97 | entry = proc_create("kgdbtest", 0, NULL, &kgdb_test_proc_fops); |
101 | if (entry == NULL) | 98 | if (entry == NULL) |
102 | return -ENOMEM; | 99 | return -ENOMEM; |
100 | |||
103 | return 0; | 101 | return 0; |
104 | } | 102 | } |
105 | 103 | ||