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