mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
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>
This commit is contained in:
parent
397b761cc4
commit
88f7c2fb0f
1 changed files with 21 additions and 23 deletions
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include <asm/blackfin.h>
|
#include <asm/blackfin.h>
|
||||||
|
|
||||||
|
/* Symbols are here for kgdb test to poke directly */
|
||||||
static char cmdline[256];
|
static char cmdline[256];
|
||||||
static size_t len;
|
static size_t len;
|
||||||
|
|
||||||
|
@ -27,11 +28,10 @@ void kgdb_l1_test(void) __attribute__((l1_text));
|
||||||
|
|
||||||
void kgdb_l1_test(void)
|
void kgdb_l1_test(void)
|
||||||
{
|
{
|
||||||
printk(KERN_ALERT "L1(before change) : data variable addr = 0x%p, data value is %d\n", &num1, num1);
|
pr_alert("L1(before change) : data variable addr = 0x%p, data value is %d\n", &num1, num1);
|
||||||
printk(KERN_ALERT "L1 : code function addr = 0x%p\n", kgdb_l1_test);
|
pr_alert("L1 : code function addr = 0x%p\n", kgdb_l1_test);
|
||||||
num1 = num1 + 10 ;
|
num1 = num1 + 10;
|
||||||
printk(KERN_ALERT "L1(after change) : data variable addr = 0x%p, data value is %d\n", &num1, num1);
|
pr_alert("L1(after change) : data variable addr = 0x%p, data value is %d\n", &num1, num1);
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -42,11 +42,10 @@ void kgdb_l2_test(void) __attribute__((l2));
|
||||||
|
|
||||||
void kgdb_l2_test(void)
|
void kgdb_l2_test(void)
|
||||||
{
|
{
|
||||||
printk(KERN_ALERT "L2(before change) : data variable addr = 0x%p, data value is %d\n", &num2, num2);
|
pr_alert("L2(before change) : data variable addr = 0x%p, data value is %d\n", &num2, num2);
|
||||||
printk(KERN_ALERT "L2 : code function addr = 0x%p\n", kgdb_l2_test);
|
pr_alert("L2 : code function addr = 0x%p\n", kgdb_l2_test);
|
||||||
num2 = num2 + 20 ;
|
num2 = num2 + 20;
|
||||||
printk(KERN_ALERT "L2(after change) : data variable addr = 0x%p, data value is %d\n", &num2, num2);
|
pr_alert("L2(after change) : data variable addr = 0x%p, data value is %d\n", &num2, num2);
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -54,13 +53,14 @@ void kgdb_l2_test(void)
|
||||||
|
|
||||||
int kgdb_test(char *name, int len, int count, int z)
|
int kgdb_test(char *name, int len, int count, int z)
|
||||||
{
|
{
|
||||||
printk(KERN_ALERT "kgdb name(%d): %s, %d, %d\n", len, name, count, z);
|
pr_alert("kgdb name(%d): %s, %d, %d\n", len, name, count, z);
|
||||||
count = z;
|
count = z;
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t kgdb_test_proc_read(struct file *file, char __user *buf,
|
static ssize_t
|
||||||
size_t count, loff_t *ppos)
|
kgdb_test_proc_read(struct file *file, char __user *buf,
|
||||||
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
kgdb_test("hello world!", 12, 0x55, 0x10);
|
kgdb_test("hello world!", 12, 0x55, 0x10);
|
||||||
#ifndef CONFIG_SMP
|
#ifndef CONFIG_SMP
|
||||||
|
@ -73,14 +73,11 @@ static ssize_t kgdb_test_proc_read(struct file *file, char __user *buf,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t kgdb_test_proc_write(struct file *file,
|
static ssize_t
|
||||||
const char __user *buffer, size_t count, loff_t *pos)
|
kgdb_test_proc_write(struct file *file, const char __user *buffer,
|
||||||
|
size_t count, loff_t *pos)
|
||||||
{
|
{
|
||||||
if (count >= 256)
|
len = min_t(size_t, 255, count);
|
||||||
len = 255;
|
|
||||||
else
|
|
||||||
len = count;
|
|
||||||
|
|
||||||
memcpy(cmdline, buffer, count);
|
memcpy(cmdline, buffer, count);
|
||||||
cmdline[len] = 0;
|
cmdline[len] = 0;
|
||||||
|
|
||||||
|
@ -88,9 +85,9 @@ static ssize_t kgdb_test_proc_write(struct file *file,
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations kgdb_test_proc_fops = {
|
static const struct file_operations kgdb_test_proc_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.read = kgdb_test_proc_read,
|
.read = kgdb_test_proc_read,
|
||||||
.write = kgdb_test_proc_write,
|
.write = kgdb_test_proc_write,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init kgdbtest_init(void)
|
static int __init kgdbtest_init(void)
|
||||||
|
@ -100,6 +97,7 @@ static int __init kgdbtest_init(void)
|
||||||
entry = proc_create("kgdbtest", 0, NULL, &kgdb_test_proc_fops);
|
entry = proc_create("kgdbtest", 0, NULL, &kgdb_test_proc_fops);
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue