1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
From 9c4e06f1061c7b8c0fe5a83937275d4fd54d4853 Mon Sep 17 00:00:00 2001
From: Luke Diamand <luked@broadcom.com>
Date: Sat, 28 Dec 2013 07:39:51 +0000
Subject: [PATCH 145/196] vc_mem: tidy up debug printing
Replace explicit use of printk() with pr_XXX() calls to
better conform to kernel coding style.
Signed-off-by: Luke Diamand <luked@broadcom.com>
---
arch/arm/mach-bcm2708/vc_mem.c | 47 +++++++++++++++++-------------------------
1 file changed, 19 insertions(+), 28 deletions(-)
diff --git a/arch/arm/mach-bcm2708/vc_mem.c b/arch/arm/mach-bcm2708/vc_mem.c
index 007754d..2adac12 100644
--- a/arch/arm/mach-bcm2708/vc_mem.c
+++ b/arch/arm/mach-bcm2708/vc_mem.c
@@ -35,16 +35,6 @@
#define DRIVER_NAME "vc-mem"
-// Uncomment to enable debug logging
-// #define ENABLE_DBG
-
-#if defined(ENABLE_DBG)
-#define LOG_DBG( fmt, ... ) printk( KERN_INFO fmt "\n", ##__VA_ARGS__ )
-#else
-#define LOG_DBG( fmt, ... )
-#endif
-#define LOG_ERR( fmt, ... ) printk( KERN_ERR fmt "\n", ##__VA_ARGS__ )
-
// Device (/dev) related variables
static dev_t vc_mem_devnum = 0;
static struct class *vc_mem_class = NULL;
@@ -95,7 +85,7 @@ vc_mem_open(struct inode *inode, struct file *file)
(void) inode;
(void) file;
- LOG_DBG("%s: called file = 0x%p", __func__, file);
+ pr_debug("%s: called file = 0x%p\n", __func__, file);
return 0;
}
@@ -112,7 +102,7 @@ vc_mem_release(struct inode *inode, struct file *file)
(void) inode;
(void) file;
- LOG_DBG("%s: called file = 0x%p", __func__, file);
+ pr_debug("%s: called file = 0x%p\n", __func__, file);
return 0;
}
@@ -167,12 +157,12 @@ vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
(void) cmd;
(void) arg;
- LOG_DBG("%s: called file = 0x%p", __func__, file);
+ pr_debug("%s: called file = 0x%p\n", __func__, file);
switch (cmd) {
case VC_MEM_IOC_MEM_PHYS_ADDR:
{
- LOG_DBG("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p",
+ pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n",
__func__, (void *) mm_vc_mem_phys_addr);
if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr,
@@ -186,7 +176,7 @@ vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
// Get the videocore memory size first
vc_mem_get_size();
- LOG_DBG("%s: VC_MEM_IOC_MEM_SIZE=%u", __func__,
+ pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__,
mm_vc_mem_size);
if (copy_to_user((void *) arg, &mm_vc_mem_size,
@@ -200,7 +190,7 @@ vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
// Get the videocore memory base
vc_mem_get_base();
- LOG_DBG("%s: VC_MEM_IOC_MEM_BASE=%u", __func__,
+ pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__,
mm_vc_mem_base);
if (copy_to_user((void *) arg, &mm_vc_mem_base,
@@ -214,7 +204,7 @@ vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
// Get the videocore memory base
vc_mem_get_base();
- LOG_DBG("%s: VC_MEM_IOC_MEM_LOAD=%u", __func__,
+ pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__,
mm_vc_mem_base);
if (copy_to_user((void *) arg, &mm_vc_mem_base,
@@ -228,7 +218,7 @@ vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return -ENOTTY;
}
}
- LOG_DBG("%s: file = 0x%p returning %d", __func__, file, rc);
+ pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc);
return rc;
}
@@ -246,12 +236,12 @@ vc_mem_mmap(struct file *filp, struct vm_area_struct *vma)
unsigned long length = vma->vm_end - vma->vm_start;
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
- LOG_DBG("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx",
+ pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n",
__func__, (long) vma->vm_start, (long) vma->vm_end,
(long) vma->vm_pgoff);
if (offset + length > mm_vc_mem_size) {
- LOG_ERR("%s: length %ld is too big", __func__, length);
+ pr_err("%s: length %ld is too big\n", __func__, length);
return -EINVAL;
}
// Do not cache the memory map
@@ -261,7 +251,7 @@ vc_mem_mmap(struct file *filp, struct vm_area_struct *vma)
(mm_vc_mem_phys_addr >> PAGE_SHIFT) +
vma->vm_pgoff, length, vma->vm_page_prot);
if (rc != 0) {
- LOG_ERR("%s: remap_pfn_range failed (rc=%d)", __func__, rc);
+ pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc);
}
return rc;
@@ -347,7 +337,7 @@ vc_mem_init(void)
int rc = -EFAULT;
struct device *dev;
- LOG_DBG("%s: called", __func__);
+ pr_debug("%s: called\n", __func__);
mm_vc_mem_phys_addr = phys_addr;
mm_vc_mem_size = mem_size;
@@ -355,24 +345,25 @@ vc_mem_init(void)
vc_mem_get_size();
- printk("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n",
+ pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n",
mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024));
if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) {
- LOG_ERR("%s: alloc_chrdev_region failed (rc=%d)", __func__, rc);
+ pr_err("%s: alloc_chrdev_region failed (rc=%d)\n",
+ __func__, rc);
goto out_err;
}
cdev_init(&vc_mem_cdev, &vc_mem_fops);
if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) {
- LOG_ERR("%s: cdev_add failed (rc=%d)", __func__, rc);
+ pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc);
goto out_unregister;
}
vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME);
if (IS_ERR(vc_mem_class)) {
rc = PTR_ERR(vc_mem_class);
- LOG_ERR("%s: class_create failed (rc=%d)", __func__, rc);
+ pr_err("%s: class_create failed (rc=%d)\n", __func__, rc);
goto out_cdev_del;
}
@@ -380,7 +371,7 @@ vc_mem_init(void)
DRIVER_NAME);
if (IS_ERR(dev)) {
rc = PTR_ERR(dev);
- LOG_ERR("%s: device_create failed (rc=%d)", __func__, rc);
+ pr_err("%s: device_create failed (rc=%d)\n", __func__, rc);
goto out_class_destroy;
}
@@ -417,7 +408,7 @@ vc_mem_init(void)
static void __exit
vc_mem_exit(void)
{
- LOG_DBG("%s: called", __func__);
+ pr_debug("%s: called\n", __func__);
if (vc_mem_inited) {
#if CONFIG_DEBUG_FS
--
1.9.1
|