aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2011-07-19 13:06:11 -0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 08:02:16 -0400
commite6453521edcaa6f130946b5f4fcaf28dbc02f2ed (patch)
tree1f47e1ca59f6abf97b300cfb43e75de3979bcf70
parent0a32a10264d151bc2d1616d69edaf915aa728698 (diff)
mtd: pcmciamtd: remove custom DEBUG() function
We don't need a custom DEBUG() macro here. Just use the built-in kernel code with dynamic debugging features. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
-rw-r--r--drivers/mtd/maps/pcmciamtd.c120
1 files changed, 52 insertions, 68 deletions
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index bbe168b65c26..afa9bd81220b 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -22,22 +22,6 @@
22#include <linux/mtd/map.h> 22#include <linux/mtd/map.h>
23#include <linux/mtd/mtd.h> 23#include <linux/mtd/mtd.h>
24 24
25#ifdef CONFIG_MTD_DEBUG
26static int debug = CONFIG_MTD_DEBUG_VERBOSE;
27module_param(debug, int, 0);
28MODULE_PARM_DESC(debug, "Set Debug Level 0=quiet, 5=noisy");
29#undef DEBUG
30#define DEBUG(n, format, arg...) \
31 if (n <= debug) { \
32 printk(KERN_DEBUG __FILE__ ":%s(): " format "\n", __func__ , ## arg); \
33 }
34
35#else
36#undef DEBUG
37#define DEBUG(n, arg...)
38static const int debug = 0;
39#endif
40
41#define info(format, arg...) printk(KERN_INFO "pcmciamtd: " format "\n" , ## arg) 25#define info(format, arg...) printk(KERN_INFO "pcmciamtd: " format "\n" , ## arg)
42 26
43#define DRIVER_DESC "PCMCIA Flash memory card driver" 27#define DRIVER_DESC "PCMCIA Flash memory card driver"
@@ -105,13 +89,13 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
105 int ret; 89 int ret;
106 90
107 if (!pcmcia_dev_present(dev->p_dev)) { 91 if (!pcmcia_dev_present(dev->p_dev)) {
108 DEBUG(1, "device removed"); 92 pr_debug("device removed\n");
109 return 0; 93 return 0;
110 } 94 }
111 95
112 offset = to & ~(dev->win_size-1); 96 offset = to & ~(dev->win_size-1);
113 if (offset != dev->offset) { 97 if (offset != dev->offset) {
114 DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x", 98 pr_debug("Remapping window from 0x%8.8x to 0x%8.8x\n",
115 dev->offset, offset); 99 dev->offset, offset);
116 ret = pcmcia_map_mem_page(dev->p_dev, win, offset); 100 ret = pcmcia_map_mem_page(dev->p_dev, win, offset);
117 if (ret != 0) 101 if (ret != 0)
@@ -132,7 +116,7 @@ static map_word pcmcia_read8_remap(struct map_info *map, unsigned long ofs)
132 return d; 116 return d;
133 117
134 d.x[0] = readb(addr); 118 d.x[0] = readb(addr);
135 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02lx", ofs, addr, d.x[0]); 119 pr_debug("ofs = 0x%08lx (%p) data = 0x%02lx\n", ofs, addr, d.x[0]);
136 return d; 120 return d;
137} 121}
138 122
@@ -147,7 +131,7 @@ static map_word pcmcia_read16_remap(struct map_info *map, unsigned long ofs)
147 return d; 131 return d;
148 132
149 d.x[0] = readw(addr); 133 d.x[0] = readw(addr);
150 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04lx", ofs, addr, d.x[0]); 134 pr_debug("ofs = 0x%08lx (%p) data = 0x%04lx\n", ofs, addr, d.x[0]);
151 return d; 135 return d;
152} 136}
153 137
@@ -157,7 +141,7 @@ static void pcmcia_copy_from_remap(struct map_info *map, void *to, unsigned long
157 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; 141 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
158 unsigned long win_size = dev->win_size; 142 unsigned long win_size = dev->win_size;
159 143
160 DEBUG(3, "to = %p from = %lu len = %zd", to, from, len); 144 pr_debug("to = %p from = %lu len = %zd\n", to, from, len);
161 while(len) { 145 while(len) {
162 int toread = win_size - (from & (win_size-1)); 146 int toread = win_size - (from & (win_size-1));
163 caddr_t addr; 147 caddr_t addr;
@@ -169,7 +153,7 @@ static void pcmcia_copy_from_remap(struct map_info *map, void *to, unsigned long
169 if(!addr) 153 if(!addr)
170 return; 154 return;
171 155
172 DEBUG(4, "memcpy from %p to %p len = %d", addr, to, toread); 156 pr_debug("memcpy from %p to %p len = %d\n", addr, to, toread);
173 memcpy_fromio(to, addr, toread); 157 memcpy_fromio(to, addr, toread);
174 len -= toread; 158 len -= toread;
175 to += toread; 159 to += toread;
@@ -185,7 +169,7 @@ static void pcmcia_write8_remap(struct map_info *map, map_word d, unsigned long
185 if(!addr) 169 if(!addr)
186 return; 170 return;
187 171
188 DEBUG(3, "adr = 0x%08lx (%p) data = 0x%02lx", adr, addr, d.x[0]); 172 pr_debug("adr = 0x%08lx (%p) data = 0x%02lx\n", adr, addr, d.x[0]);
189 writeb(d.x[0], addr); 173 writeb(d.x[0], addr);
190} 174}
191 175
@@ -196,7 +180,7 @@ static void pcmcia_write16_remap(struct map_info *map, map_word d, unsigned long
196 if(!addr) 180 if(!addr)
197 return; 181 return;
198 182
199 DEBUG(3, "adr = 0x%08lx (%p) data = 0x%04lx", adr, addr, d.x[0]); 183 pr_debug("adr = 0x%08lx (%p) data = 0x%04lx\n", adr, addr, d.x[0]);
200 writew(d.x[0], addr); 184 writew(d.x[0], addr);
201} 185}
202 186
@@ -206,7 +190,7 @@ static void pcmcia_copy_to_remap(struct map_info *map, unsigned long to, const v
206 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; 190 struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1;
207 unsigned long win_size = dev->win_size; 191 unsigned long win_size = dev->win_size;
208 192
209 DEBUG(3, "to = %lu from = %p len = %zd", to, from, len); 193 pr_debug("to = %lu from = %p len = %zd\n", to, from, len);
210 while(len) { 194 while(len) {
211 int towrite = win_size - (to & (win_size-1)); 195 int towrite = win_size - (to & (win_size-1));
212 caddr_t addr; 196 caddr_t addr;
@@ -218,7 +202,7 @@ static void pcmcia_copy_to_remap(struct map_info *map, unsigned long to, const v
218 if(!addr) 202 if(!addr)
219 return; 203 return;
220 204
221 DEBUG(4, "memcpy from %p to %p len = %d", from, addr, towrite); 205 pr_debug("memcpy from %p to %p len = %d\n", from, addr, towrite);
222 memcpy_toio(addr, from, towrite); 206 memcpy_toio(addr, from, towrite);
223 len -= towrite; 207 len -= towrite;
224 to += towrite; 208 to += towrite;
@@ -240,7 +224,7 @@ static map_word pcmcia_read8(struct map_info *map, unsigned long ofs)
240 return d; 224 return d;
241 225
242 d.x[0] = readb(win_base + ofs); 226 d.x[0] = readb(win_base + ofs);
243 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02lx", 227 pr_debug("ofs = 0x%08lx (%p) data = 0x%02lx\n",
244 ofs, win_base + ofs, d.x[0]); 228 ofs, win_base + ofs, d.x[0]);
245 return d; 229 return d;
246} 230}
@@ -255,7 +239,7 @@ static map_word pcmcia_read16(struct map_info *map, unsigned long ofs)
255 return d; 239 return d;
256 240
257 d.x[0] = readw(win_base + ofs); 241 d.x[0] = readw(win_base + ofs);
258 DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04lx", 242 pr_debug("ofs = 0x%08lx (%p) data = 0x%04lx\n",
259 ofs, win_base + ofs, d.x[0]); 243 ofs, win_base + ofs, d.x[0]);
260 return d; 244 return d;
261} 245}
@@ -268,7 +252,7 @@ static void pcmcia_copy_from(struct map_info *map, void *to, unsigned long from,
268 if(DEV_REMOVED(map)) 252 if(DEV_REMOVED(map))
269 return; 253 return;
270 254
271 DEBUG(3, "to = %p from = %lu len = %zd", to, from, len); 255 pr_debug("to = %p from = %lu len = %zd\n", to, from, len);
272 memcpy_fromio(to, win_base + from, len); 256 memcpy_fromio(to, win_base + from, len);
273} 257}
274 258
@@ -280,7 +264,7 @@ static void pcmcia_write8(struct map_info *map, map_word d, unsigned long adr)
280 if(DEV_REMOVED(map)) 264 if(DEV_REMOVED(map))
281 return; 265 return;
282 266
283 DEBUG(3, "adr = 0x%08lx (%p) data = 0x%02lx", 267 pr_debug("adr = 0x%08lx (%p) data = 0x%02lx\n",
284 adr, win_base + adr, d.x[0]); 268 adr, win_base + adr, d.x[0]);
285 writeb(d.x[0], win_base + adr); 269 writeb(d.x[0], win_base + adr);
286} 270}
@@ -293,7 +277,7 @@ static void pcmcia_write16(struct map_info *map, map_word d, unsigned long adr)
293 if(DEV_REMOVED(map)) 277 if(DEV_REMOVED(map))
294 return; 278 return;
295 279
296 DEBUG(3, "adr = 0x%08lx (%p) data = 0x%04lx", 280 pr_debug("adr = 0x%08lx (%p) data = 0x%04lx\n",