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
6 Replace explicit use of printk() with pr_XXX() calls to
7 better conform to kernel coding style.
9 Signed-off-by: Luke Diamand <luked@broadcom.com>
11 arch/arm/mach-bcm2708/vc_mem.c | 47 +++++++++++++++++-------------------------
12 1 file changed, 19 insertions(+), 28 deletions(-)
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
20 #define DRIVER_NAME "vc-mem"
22 -// Uncomment to enable debug logging
23 -// #define ENABLE_DBG
25 -#if defined(ENABLE_DBG)
26 -#define LOG_DBG( fmt, ... ) printk( KERN_INFO fmt "\n", ##__VA_ARGS__ )
28 -#define LOG_DBG( fmt, ... )
30 -#define LOG_ERR( fmt, ... ) printk( KERN_ERR fmt "\n", ##__VA_ARGS__ )
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)
39 - LOG_DBG("%s: called file = 0x%p", __func__, file);
40 + pr_debug("%s: called file = 0x%p\n", __func__, file);
44 @@ -112,7 +102,7 @@ vc_mem_release(struct inode *inode, struct file *file)
48 - LOG_DBG("%s: called file = 0x%p", __func__, file);
49 + pr_debug("%s: called file = 0x%p\n", __func__, file);
53 @@ -167,12 +157,12 @@ vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
57 - LOG_DBG("%s: called file = 0x%p", __func__, file);
58 + pr_debug("%s: called file = 0x%p\n", __func__, file);
61 case VC_MEM_IOC_MEM_PHYS_ADDR:
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);
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
72 - LOG_DBG("%s: VC_MEM_IOC_MEM_SIZE=%u", __func__,
73 + pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__,
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
81 - LOG_DBG("%s: VC_MEM_IOC_MEM_BASE=%u", __func__,
82 + pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__,
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
90 - LOG_DBG("%s: VC_MEM_IOC_MEM_LOAD=%u", __func__,
91 + pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__,
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)
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);
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;
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);
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);
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);
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);
128 @@ -347,7 +337,7 @@ vc_mem_init(void)
132 - LOG_DBG("%s: called", __func__);
133 + pr_debug("%s: called\n", __func__);
135 mm_vc_mem_phys_addr = phys_addr;
136 mm_vc_mem_size = mem_size;
137 @@ -355,24 +345,25 @@ vc_mem_init(void)
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));
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",
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);
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);
167 @@ -380,7 +371,7 @@ vc_mem_init(void)
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;
176 @@ -417,7 +408,7 @@ vc_mem_init(void)
180 - LOG_DBG("%s: called", __func__);
181 + pr_debug("%s: called\n", __func__);