diff options
author | Brian Norris <computersforpeace@gmail.com> | 2011-07-19 13:06:11 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-11 08:02:16 -0400 |
commit | e6453521edcaa6f130946b5f4fcaf28dbc02f2ed (patch) | |
tree | 1f47e1ca59f6abf97b300cfb43e75de3979bcf70 | |
parent | 0a32a10264d151bc2d1616d69edaf915aa728698 (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.c | 120 |
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 | ||
26 | static int debug = CONFIG_MTD_DEBUG_VERBOSE; | ||
27 | module_param(debug, int, 0); | ||
28 | MODULE_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...) | ||
38 | static 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", |
297 | adr, win_base + adr, d.x[0]); | 281 | adr, win_base + adr, d.x[0]); |
298 | writew(d.x[0], win_base + adr); | 282 | writew(d.x[0], win_base + adr); |
299 | } | 283 | } |
@@ -306,7 +290,7 @@ static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *f | |||
306 | if(DEV_REMOVED(map)) | 290 | if(DEV_REMOVED(map)) |
307 | return; | 291 | return; |
308 | 292 | ||
309 | DEBUG(3, "to = %lu from = %p len = %zd", to, from, len); | 293 | pr_debug("to = %lu from = %p len = %zd\n", to, from, len); |
310 | memcpy_toio(win_base + to, from, len); | 294 | memcpy_toio(win_base + to, from, len); |
311 | } | 295 | } |
312 | 296 | ||
@@ -316,7 +300,7 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) | |||
316 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; | 300 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; |
317 | struct pcmcia_device *link = dev->p_dev; | 301 | struct pcmcia_device *link = dev->p_dev; |
318 | 302 | ||
319 | DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); | 303 | pr_debug("dev = %p on = %d vpp = %d\n\n", dev, on, dev->vpp); |
320 | pcmcia_fixup_vpp(link, on ? dev->vpp : 0); | 304 | pcmcia_fixup_vpp(link, on ? dev->vpp : 0); |
321 | } | 305 | } |
322 | 306 | ||
@@ -325,7 +309,7 @@ static void pcmciamtd_release(struct pcmcia_device *link) | |||
325 | { | 309 | { |
326 | struct pcmciamtd_dev *dev = link->priv; | 310 | struct pcmciamtd_dev *dev = link->priv; |
327 | 311 | ||
328 | DEBUG(3, "link = 0x%p", link); | 312 | pr_debug("link = 0x%p\n", link); |
329 | 313 | ||
330 | if (link->resource[2]->end) { | 314 | if (link->resource[2]->end) { |
331 | if(dev->win_base) { | 315 | if(dev->win_base) { |
@@ -347,7 +331,7 @@ static int pcmciamtd_cistpl_format(struct pcmcia_device *p_dev, | |||
347 | if (!pcmcia_parse_tuple(tuple, &parse)) { | 331 | if (!pcmcia_parse_tuple(tuple, &parse)) { |
348 | cistpl_format_t *t = &parse.format; | 332 | cistpl_format_t *t = &parse.format; |
349 | (void)t; /* Shut up, gcc */ | 333 | (void)t; /* Shut up, gcc */ |
350 | DEBUG(2, "Format type: %u, Error Detection: %u, offset = %u, length =%u", | 334 | pr_debug("Format type: %u, Error Detection: %u, offset = %u, length =%u\n", |
351 | t->type, t->edc, t->offset, t->length); | 335 | t->type, t->edc, t->offset, t->length); |
352 | } | 336 | } |
353 | return -ENOSPC; | 337 | return -ENOSPC; |
@@ -363,7 +347,7 @@ static int pcmciamtd_cistpl_jedec(struct pcmcia_device *p_dev, | |||
363 | if (!pcmcia_parse_tuple(tuple, &parse)) { | 347 | if (!pcmcia_parse_tuple(tuple, &parse)) { |
364 | cistpl_jedec_t *t = &parse.jedec; | 348 | cistpl_jedec_t *t = &parse.jedec; |
365 | for (i = 0; i < t->nid; i++) | 349 | for (i = 0; i < t->nid; i++) |
366 | DEBUG(2, "JEDEC: 0x%02x 0x%02x", | 350 | pr_debug("JEDEC: 0x%02x 0x%02x\n", |
367 | t->id[i].mfr, t->id[i].info); | 351 | t->id[i].mfr, t->id[i].info); |
368 | } | 352 | } |
369 | return -ENOSPC; | 353 | return -ENOSPC; |
@@ -382,14 +366,14 @@ static int pcmciamtd_cistpl_device(struct pcmcia_device *p_dev, | |||
382 | if (pcmcia_parse_tuple(tuple, &parse)) | 366 | if (pcmcia_parse_tuple(tuple, &parse)) |
383 | return -EINVAL; | 367 | return -EINVAL; |
384 | 368 | ||
385 | DEBUG(2, "Common memory:"); | 369 | pr_debug("Common memory:\n"); |
386 | dev->pcmcia_map.size = t->dev[0].size; | 370 | dev->pcmcia_map.size = t->dev[0].size; |
387 | /* from here on: DEBUG only */ | 371 | /* from here on: DEBUG only */ |
388 | for (i = 0; i < t->ndev; i++) { | 372 | for (i = 0; i < t->ndev; i++) { |
389 | DEBUG(2, "Region %d, type = %u", i, t->dev[i].type); | 373 | pr_debug("Region %d, type = %u\n", i, t->dev[i].type); |
390 | DEBUG(2, "Region %d, wp = %u", i, t->dev[i].wp); | 374 | pr_debug("Region %d, wp = %u\n", i, t->dev[i].wp); |
391 | DEBUG(2, "Region %d, speed = %u ns", i, t->dev[i].speed); | 375 | pr_debug("Region %d, speed = %u ns\n", i, t->dev[i].speed); |
392 | DEBUG(2, "Region %d, size = %u bytes", i, t->dev[i].size); | 376 | pr_debug("Region %d, size = %u bytes\n", i, t->dev[i].size); |
393 | } | 377 | } |
394 | return 0; | 378 | return 0; |
395 | } | 379 | } |
@@ -409,12 +393,12 @@ static int pcmciamtd_cistpl_geo(struct pcmcia_device *p_dev, | |||
409 | dev->pcmcia_map.bankwidth = t->geo[0].buswidth; | 393 | dev->pcmcia_map.bankwidth = t->geo[0].buswidth; |
410 | /* from here on: DEBUG only */ | 394 | /* from here on: DEBUG only */ |
411 | for (i = 0; i < t->ngeo; i++) { | 395 | for (i = 0; i < t->ngeo; i++) { |
412 | DEBUG(2, "region: %d bankwidth = %u", i, t->geo[i].buswidth); | 396 | pr_debug("region: %d bankwidth = %u\n", i, t->geo[i].buswidth); |
413 | DEBUG(2, "region: %d erase_block = %u", i, t->geo[i].erase_block); | 397 | pr_debug("region: %d erase_block = %u\n", i, t->geo[i].erase_block); |
414 | DEBUG(2, "region: %d read_block = %u", i, t->geo[i].read_block); | 398 | pr_debug("region: %d read_block = %u\n", i, t->geo[i].read_block); |
415 | DEBUG(2, "region: %d write_block = %u", i, t->geo[i].write_block); | 399 | pr_debug("region: %d write_block = %u\n", i, t->geo[i].write_block); |
416 | DEBUG(2, "region: %d partition = %u", i, t->geo[i].partition); | 400 | pr_debug("region: %d partition = %u\n", i, t->geo[i].partition); |
417 | DEBUG(2, "region: %d interleave = %u", i, t->geo[i].interleave); | 401 | pr_debug("region: %d interleave = %u\n", i, t->geo[i].interleave); |
418 | } | 402 | } |
419 | return 0; | 403 | return 0; |
420 | } | 404 | } |
@@ -432,7 +416,7 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev | |||
432 | if (p_dev->prod_id[i]) | 416 | if (p_dev->prod_id[i]) |
433 | strcat(dev->mtd_name, p_dev->prod_id[i]); | 417 | strcat(dev->mtd_name, p_dev->prod_id[i]); |
434 | } | 418 | } |
435 | DEBUG(2, "Found name: %s", dev->mtd_name); | 419 | pr_debug("Found name: %s\n", dev->mtd_name); |
436 | } | 420 | } |
437 | 421 | ||
438 | #ifdef CONFIG_MTD_DEBUG | 422 | #ifdef CONFIG_MTD_DEBUG |
@@ -450,12 +434,12 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev | |||
450 | 434 | ||
451 | if(force_size) { | 435 | if(force_size) { |
452 | dev->pcmcia_map.size = force_size << 20; | 436 | dev->pcmcia_map.size = force_size << 20; |
453 | DEBUG(2, "size forced to %dM", force_size); | 437 | pr_debug("size forced to %dM\n", force_size); |
454 | } | 438 | } |
455 | 439 | ||
456 | if(bankwidth) { | 440 | if(bankwidth) { |
457 | dev->pcmcia_map.bankwidth = bankwidth; | 441 | dev->pcmcia_map.bankwidth = bankwidth; |
458 | DEBUG(2, "bankwidth forced to %d", bankwidth); | 442 | pr_debug("bankwidth forced to %d\n", bankwidth); |
459 | } | 443 | } |
460 | 444 | ||
461 | dev->pcmcia_map.name = dev->mtd_name; | 445 | dev->pcmcia_map.name = dev->mtd_name; |
@@ -464,7 +448,7 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev | |||
464 | *new_name = 1; | 448 | *new_name = 1; |
465 | } | 449 | } |
466 | 450 | ||
467 | DEBUG(1, "Device: Size: %lu Width:%d Name: %s", | 451 | pr_debug("Device: Size: %lu Width:%d Name: %s\n", |
468 | dev->pcmcia_map.size, | 452 | dev->pcmcia_map.size, |
469 | dev->pcmcia_map.bankwidth << 3, dev->mtd_name); | 453 | dev->pcmcia_map.bankwidth << 3, dev->mtd_name); |
470 | } | 454 | } |
@@ -479,7 +463,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
479 | static char *probes[] = { "jedec_probe", "cfi_probe" }; | 463 | static char *probes[] = { "jedec_probe", "cfi_probe" }; |
480 | int new_name = 0; | 464 | int new_name = 0; |
481 | 465 | ||
482 | DEBUG(3, "link=0x%p", link); | 466 | pr_debug("link=0x%p\n", link); |
483 | 467 | ||
484 | card_settings(dev, link, &new_name); | 468 | card_settings(dev, link, &new_name); |
485 | 469 | ||
@@ -512,11 +496,11 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
512 | 496 | ||
513 | do { | 497 | do { |
514 | int ret; | 498 | int ret; |
515 | DEBUG(2, "requesting window with size = %luKiB memspeed = %d", | 499 | pr_debug("requesting window with size = %luKiB memspeed = %d\n", |
516 | (unsigned long) resource_size(link->resource[2]) >> 10, | 500 | (unsigned long) resource_size(link->resource[2]) >> 10, |
517 | mem_speed); | 501 | mem_speed); |
518 | ret = pcmcia_request_window(link, link->resource[2], mem_speed); | 502 | ret = pcmcia_request_window(link, link->resource[2], mem_speed); |
519 | DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); | 503 | pr_debug("ret = %d dev->win_size = %d\n", ret, dev->win_size); |
520 | if(ret) { | 504 | if(ret) { |
521 | j++; | 505 | j++; |
522 | link->resource[2]->start = 0; | 506 | link->resource[2]->start = 0; |
@@ -524,21 +508,21 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
524 | force_size << 20 : MAX_PCMCIA_ADDR; | 508 | force_size << 20 : MAX_PCMCIA_ADDR; |
525 | link->resource[2]->end >>= j; | 509 | link->resource[2]->end >>= j; |
526 | } else { | 510 | } else { |
527 | DEBUG(2, "Got window of size %luKiB", (unsigned long) | 511 | pr_debug("Got window of size %luKiB\n", (unsigned long) |
528 | resource_size(link->resource[2]) >> 10); | 512 | resource_size(link->resource[2]) >> 10); |
529 | dev->win_size = resource_size(link->resource[2]); | 513 | dev->win_size = resource_size(link->resource[2]); |
530 | break; | 514 | break; |
531 | } | 515 | } |
532 | } while (link->resource[2]->end >= 0x1000); | 516 | } while (link->resource[2]->end >= 0x1000); |
533 | 517 | ||
534 | DEBUG(2, "dev->win_size = %d", dev->win_size); | 518 | pr_debug("dev->win_size = %d\n", dev->win_size); |
535 | 519 | ||
536 | if(!dev->win_size) { | 520 | if(!dev->win_size) { |
537 | dev_err(&dev->p_dev->dev, "Cannot allocate memory window\n"); | 521 | dev_err(&dev->p_dev->dev, "Cannot allocate memory window\n"); |
538 | pcmciamtd_release(link); | 522 | pcmciamtd_release(link); |
539 | return -ENODEV; | 523 | return -ENODEV; |
540 | } | 524 | } |
541 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); | 525 | pr_debug("Allocated a window of %dKiB\n", dev->win_size >> 10); |
542 | 526 | ||
543 | /* Get write protect status */ | 527 | /* Get write protect status */ |
544 | dev->win_base = ioremap(link->resource[2]->start, | 528 | dev->win_base = ioremap(link->resource[2]->start, |
@@ -549,7 +533,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
549 | pcmciamtd_release(link); | 533 | pcmciamtd_release(link); |
550 | return -ENODEV; | 534 | return -ENODEV; |
551 | } | 535 | } |
552 | DEBUG(1, "mapped window dev = %p @ %pR, base = %p", | 536 | pr_debug("mapped window dev = %p @ %pR, base = %p\n", |
553 | dev, link->resource[2], dev->win_base); | 537 | dev, link->resource[2], dev->win_base); |
554 | 538 | ||
555 | dev->offset = 0; | 539 | dev->offset = 0; |
@@ -564,7 +548,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
564 | } | 548 | } |
565 | 549 | ||
566 | link->config_index = 0; | 550 | link->config_index = 0; |
567 | DEBUG(2, "Setting Configuration"); | 551 | pr_debug("Setting Configuration\n"); |
568 | ret = pcmcia_enable_device(link); | 552 | ret = pcmcia_enable_device(link); |
569 | if (ret != 0) { | 553 | if (ret != 0) { |
570 | if (dev->win_base) { | 554 | if (dev->win_base) { |
@@ -580,17 +564,17 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
580 | mtd = do_map_probe("map_rom", &dev->pcmcia_map); | 564 | mtd = do_map_probe("map_rom", &dev->pcmcia_map); |
581 | } else { | 565 | } else { |
582 | for(i = 0; i < ARRAY_SIZE(probes); i++) { | 566 | for(i = 0; i < ARRAY_SIZE(probes); i++) { |
583 | DEBUG(1, "Trying %s", probes[i]); | 567 | pr_debug("Trying %s\n", probes[i]); |
584 | mtd = do_map_probe(probes[i], &dev->pcmcia_map); | 568 | mtd = do_map_probe(probes[i], &dev->pcmcia_map); |
585 | if(mtd) | 569 | if(mtd) |
586 | break; | 570 | break; |
587 | 571 | ||
588 | DEBUG(1, "FAILED: %s", probes[i]); | 572 | pr_debug("FAILED: %s\n", probes[i]); |
589 | } | 573 | } |
590 | } | 574 | } |
591 | 575 | ||
592 | if(!mtd) { | 576 | if(!mtd) { |
593 | DEBUG(1, "Can not find an MTD"); | 577 | pr_debug("Can not find an MTD\n"); |
594 | pcmciamtd_release(link); | 578 | pcmciamtd_release(link); |
595 | return -ENODEV; | 579 | return -ENODEV; |
596 | } | 580 | } |
@@ -617,7 +601,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
617 | /* If the memory found is fits completely into the mapped PCMCIA window, | 601 | /* If the memory found is fits completely into the mapped PCMCIA window, |
618 | use the faster non-remapping read/write functions */ | 602 | use the faster non-remapping read/write functions */ |
619 | if(mtd->size <= dev->win_size) { | 603 | if(mtd->size <= dev->win_size) { |
620 | DEBUG(1, "Using non remapping memory functions"); | 604 | pr_debug("Using non remapping memory functions\n"); |
621 | dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base; | 605 | dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base; |
622 | if (dev->pcmcia_map.bankwidth == 1) { | 606 | if (dev->pcmcia_map.bankwidth == 1) { |
623 | dev->pcmcia_map.read = pcmcia_read8; | 607 | dev->pcmcia_map.read = pcmcia_read8; |
@@ -645,7 +629,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
645 | 629 | ||
646 | static int pcmciamtd_suspend(struct pcmcia_device *dev) | 630 | static int pcmciamtd_suspend(struct pcmcia_device *dev) |
647 | { | 631 | { |
648 | DEBUG(2, "EVENT_PM_RESUME"); | 632 | pr_debug("EVENT_PM_RESUME\n"); |
649 | 633 | ||
650 | /* get_lock(link); */ | 634 | /* get_lock(link); */ |
651 | 635 | ||
@@ -654,7 +638,7 @@ static int pcmciamtd_suspend(struct pcmcia_device *dev) | |||
654 | 638 | ||
655 | static int pcmciamtd_resume(struct pcmcia_device *dev) | 639 | static int pcmciamtd_resume(struct pcmcia_device *dev) |
656 | { | 640 | { |
657 | DEBUG(2, "EVENT_PM_SUSPEND"); | 641 | pr_debug("EVENT_PM_SUSPEND\n"); |
658 | 642 | ||
659 | /* free_lock(link); */ | 643 | /* free_lock(link); */ |
660 | 644 | ||
@@ -666,7 +650,7 @@ static void pcmciamtd_detach(struct pcmcia_device *link) | |||
666 | { | 650 | { |
667 | struct pcmciamtd_dev *dev = link->priv; | 651 | struct pcmciamtd_dev *dev = link->priv; |
668 | 652 | ||
669 | DEBUG(3, "link=0x%p", link); | 653 | pr_debug("link=0x%p\n", link); |
670 | 654 | ||
671 | if(dev->mtd_info) { | 655 | if(dev->mtd_info) { |
672 | mtd_device_unregister(dev->mtd_info); | 656 | mtd_device_unregister(dev->mtd_info); |
@@ -686,7 +670,7 @@ static int pcmciamtd_probe(struct pcmcia_device *link) | |||
686 | /* Create new memory card device */ | 670 | /* Create new memory card device */ |
687 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 671 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
688 | if (!dev) return -ENOMEM; | 672 | if (!dev) return -ENOMEM; |
689 | DEBUG(1, "dev=0x%p", dev); | 673 | pr_debug("dev=0x%p\n", dev); |
690 | 674 | ||
691 | dev->p_dev = link; | 675 | dev->p_dev = link; |
692 | link->priv = dev; | 676 | link->priv = dev; |
@@ -755,7 +739,7 @@ static int __init init_pcmciamtd(void) | |||
755 | 739 | ||
756 | static void __exit exit_pcmciamtd(void) | 740 | static void __exit exit_pcmciamtd(void) |
757 | { | 741 | { |
758 | DEBUG(1, DRIVER_DESC " unloading"); | 742 | pr_debug(DRIVER_DESC " unloading"); |
759 | pcmcia_unregister_driver(&pcmciamtd_driver); | 743 | pcmcia_unregister_driver(&pcmciamtd_driver); |
760 | } | 744 | } |
761 | 745 | ||