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