diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-10-24 12:07:16 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-11-09 02:30:07 -0500 |
commit | a7149f9a26eb44a5658d56335c23104ba529e9f6 (patch) | |
tree | 963e3aac8d251e3bb63544de733e908cf7787e70 /drivers | |
parent | 9cb495bb41f07a3ebfc60d3b9d26017a1fd7050c (diff) |
pcmcia: use dev_dbg and dev_print in pd6729.c
As suggested by Wolfram Sang <w.sang@pengutronix.de>, use dev_dbg(),
and dev_{err,warn,info}() in pd6729.c, and add some "\n" suggested by
Komuro <komurojun-mbn@nifty.com>. In the ISR, use pr_devel() and
dev_vdbg() as they are only compiled if DEBUG (or, for dev_vdbg(),
VERBOSE_DEBUG) are set explicitly.
CC: Komuro <komurojun-mbn@nifty.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pcmcia/pd6729.c | 70 | ||||
-rw-r--r-- | drivers/pcmcia/pd6729.h | 7 |
2 files changed, 37 insertions, 40 deletions
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 70a33468bcd0..e1741cd875aa 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
@@ -213,7 +213,8 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev) | |||
213 | 213 | ||
214 | if (csc & I365_CSC_DETECT) { | 214 | if (csc & I365_CSC_DETECT) { |
215 | events |= SS_DETECT; | 215 | events |= SS_DETECT; |
216 | dprintk("Card detected in socket %i!\n", i); | 216 | dev_vdbg(&socket[i].socket.dev, |
217 | "Card detected in socket %i!\n", i); | ||
217 | } | 218 | } |
218 | 219 | ||
219 | if (indirect_read(&socket[i], I365_INTCTL) | 220 | if (indirect_read(&socket[i], I365_INTCTL) |
@@ -331,11 +332,11 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
331 | reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */ | 332 | reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */ |
332 | 333 | ||
333 | if (state->flags & SS_PWR_AUTO) { | 334 | if (state->flags & SS_PWR_AUTO) { |
334 | dprintk("Auto power\n"); | 335 | dev_dbg(&sock->dev, "Auto power\n"); |
335 | reg |= I365_PWR_AUTO; /* automatic power mngmnt */ | 336 | reg |= I365_PWR_AUTO; /* automatic power mngmnt */ |
336 | } | 337 | } |
337 | if (state->flags & SS_OUTPUT_ENA) { | 338 | if (state->flags & SS_OUTPUT_ENA) { |
338 | dprintk("Power Enabled\n"); | 339 | dev_dbg(&sock->dev, "Power Enabled\n"); |
339 | reg |= I365_PWR_OUT; /* enable power */ | 340 | reg |= I365_PWR_OUT; /* enable power */ |
340 | } | 341 | } |
341 | 342 | ||
@@ -343,40 +344,44 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
343 | case 0: | 344 | case 0: |
344 | break; | 345 | break; |
345 | case 33: | 346 | case 33: |
346 | dprintk("setting voltage to Vcc to 3.3V on socket %i\n", | 347 | dev_dbg(&sock->dev, |
348 | "setting voltage to Vcc to 3.3V on socket %i\n", | ||
347 | socket->number); | 349 | socket->number); |
348 | reg |= I365_VCC_5V; | 350 | reg |= I365_VCC_5V; |
349 | indirect_setbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); | 351 | indirect_setbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); |
350 | break; | 352 | break; |
351 | case 50: | 353 | case 50: |
352 | dprintk("setting voltage to Vcc to 5V on socket %i\n", | 354 | dev_dbg(&sock->dev, |
355 | "setting voltage to Vcc to 5V on socket %i\n", | ||
353 | socket->number); | 356 | socket->number); |
354 | reg |= I365_VCC_5V; | 357 | reg |= I365_VCC_5V; |
355 | indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); | 358 | indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); |
356 | break; | 359 | break; |
357 | default: | 360 | default: |
358 | dprintk("pd6729: pd6729_set_socket called with " | 361 | dev_dbg(&sock->dev, |
359 | "invalid VCC power value: %i\n", | 362 | "pd6729_set_socket called with invalid VCC power " |
360 | state->Vcc); | 363 | "value: %i\n", state->Vcc); |
361 | return -EINVAL; | 364 | return -EINVAL; |
362 | } | 365 | } |
363 | 366 | ||
364 | switch (state->Vpp) { | 367 | switch (state->Vpp) { |
365 | case 0: | 368 | case 0: |
366 | dprintk("not setting Vpp on socket %i\n", socket->number); | 369 | dev_dbg(&sock->dev, "not setting Vpp on socket %i\n", |
370 | socket->number); | ||
367 | break; | 371 | break; |
368 | case 33: | 372 | case 33: |
369 | case 50: | 373 | case 50: |
370 | dprintk("setting Vpp to Vcc for socket %i\n", socket->number); | 374 | dev_dbg(&sock->dev, "setting Vpp to Vcc for socket %i\n", |
375 | socket->number); | ||
371 | reg |= I365_VPP1_5V; | 376 | reg |= I365_VPP1_5V; |
372 | break; | 377 | break; |
373 | case 120: | 378 | case 120: |
374 | dprintk("setting Vpp to 12.0\n"); | 379 | dev_dbg(&sock->dev, "setting Vpp to 12.0\n"); |
375 | reg |= I365_VPP1_12V; | 380 | reg |= I365_VPP1_12V; |
376 | break; | 381 | break; |
377 | default: | 382 | default: |
378 | dprintk("pd6729: pd6729_set_socket called with invalid VPP power value: %i\n", | 383 | dev_dbg(&sock->dev, "pd6729: pd6729_set_socket called with " |
379 | state->Vpp); | 384 | "invalid VPP power value: %i\n", state->Vpp); |
380 | return -EINVAL; | 385 | return -EINVAL; |
381 | } | 386 | } |
382 | 387 | ||
@@ -438,7 +443,7 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, | |||
438 | 443 | ||
439 | /* Check error conditions */ | 444 | /* Check error conditions */ |
440 | if (map > 1) { | 445 | if (map > 1) { |
441 | dprintk("pd6729_set_io_map with invalid map"); | 446 | dev_dbg(&sock->dev, "pd6729_set_io_map with invalid map\n"); |
442 | return -EINVAL; | 447 | return -EINVAL; |
443 | } | 448 | } |
444 | 449 | ||
@@ -446,7 +451,7 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, | |||
446 | if (indirect_read(socket, I365_ADDRWIN) & I365_ENA_IO(map)) | 451 | if (indirect_read(socket, I365_ADDRWIN) & I365_ENA_IO(map)) |
447 | indirect_resetbit(socket, I365_ADDRWIN, I365_ENA_IO(map)); | 452 | indirect_resetbit(socket, I365_ADDRWIN, I365_ENA_IO(map)); |
448 | 453 | ||
449 | /* dprintk("set_io_map: Setting range to %x - %x\n", | 454 | /* dev_dbg(&sock->dev, "set_io_map: Setting range to %x - %x\n", |
450 | io->start, io->stop);*/ | 455 | io->start, io->stop);*/ |
451 | 456 | ||
452 | /* write the new values */ | 457 | /* write the new values */ |
@@ -478,12 +483,12 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, | |||
478 | 483 | ||
479 | map = mem->map; | 484 | map = mem->map; |
480 | if (map > 4) { | 485 | if (map > 4) { |
481 | printk("pd6729_set_mem_map: invalid map"); | 486 | dev_warn(&sock->dev, "invalid map requested\n"); |
482 | return -EINVAL; | 487 | return -EINVAL; |
483 | } | 488 | } |
484 | 489 | ||
485 | if ((mem->res->start > mem->res->end) || (mem->speed > 1000)) { | 490 | if ((mem->res->start > mem->res->end) || (mem->speed > 1000)) { |
486 | printk("pd6729_set_mem_map: invalid address / speed"); | 491 | dev_warn(&sock->dev, "invalid invalid address / speed\n"); |
487 | return -EINVAL; | 492 | return -EINVAL; |
488 | } | 493 | } |
489 | 494 | ||
@@ -529,12 +534,12 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, | |||
529 | if (mem->flags & MAP_WRPROT) | 534 | if (mem->flags & MAP_WRPROT) |
530 | i |= I365_MEM_WRPROT; | 535 | i |= I365_MEM_WRPROT; |
531 | if (mem->flags & MAP_ATTRIB) { | 536 | if (mem->flags & MAP_ATTRIB) { |
532 | /* dprintk("requesting attribute memory for socket %i\n", | 537 | /* dev_dbg(&sock->dev, "requesting attribute memory for " |
533 | socket->number);*/ | 538 | "socket %i\n", socket->number);*/ |
534 | i |= I365_MEM_REG; | 539 | i |= I365_MEM_REG; |
535 | } else { | 540 | } else { |
536 | /* dprintk("requesting normal memory for socket %i\n", | 541 | /* dev_dbg(&sock->dev, "requesting normal memory for " |
537 | socket->number);*/ | 542 | "socket %i\n", socket->number);*/ |
538 | } | 543 | } |
539 | indirect_write16(socket, base + I365_W_OFF, i); | 544 | indirect_write16(socket, base + I365_W_OFF, i); |
540 | 545 | ||
@@ -577,7 +582,7 @@ static struct pccard_operations pd6729_operations = { | |||
577 | 582 | ||
578 | static irqreturn_t pd6729_test(int irq, void *dev) | 583 | static irqreturn_t pd6729_test(int irq, void *dev) |
579 | { | 584 | { |
580 | dprintk("-> hit on irq %d\n", irq); | 585 | pr_devel("-> hit on irq %d\n", irq); |
581 | return IRQ_HANDLED; | 586 | return IRQ_HANDLED; |
582 | } | 587 | } |
583 | 588 | ||
@@ -642,13 +647,13 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
642 | goto err_out_free_mem; | 647 | goto err_out_free_mem; |
643 | 648 | ||
644 | if (!pci_resource_start(dev, 0)) { | 649 | if (!pci_resource_start(dev, 0)) { |
645 | printk(KERN_INFO "pd6729: refusing to load the driver " | 650 | dev_warn(&dev->dev, "refusing to load the driver as the " |
646 | "as the io_base is 0.\n"); | 651 | "io_base is NULL.\n"); |
647 | goto err_out_free_mem; | 652 | goto err_out_free_mem; |
648 | } | 653 | } |
649 | 654 | ||
650 | printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge " | 655 | dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx " |
651 | "at 0x%llx on irq %d\n", | 656 | "on irq %d\n", |
652 | (unsigned long long)pci_resource_start(dev, 0), dev->irq); | 657 | (unsigned long long)pci_resource_start(dev, 0), dev->irq); |
653 | /* | 658 | /* |
654 | * Since we have no memory BARs some firmware may not | 659 | * Since we have no memory BARs some firmware may not |
@@ -656,14 +661,14 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
656 | */ | 661 | */ |
657 | pci_read_config_byte(dev, PCI_COMMAND, &configbyte); | 662 | pci_read_config_byte(dev, PCI_COMMAND, &configbyte); |
658 | if (!(configbyte & PCI_COMMAND_MEMORY)) { | 663 | if (!(configbyte & PCI_COMMAND_MEMORY)) { |
659 | printk(KERN_DEBUG "pd6729: Enabling PCI_COMMAND_MEMORY.\n"); | 664 | dev_dbg(&dev->dev, "pd6729: Enabling PCI_COMMAND_MEMORY.\n"); |
660 | configbyte |= PCI_COMMAND_MEMORY; | 665 | configbyte |= PCI_COMMAND_MEMORY; |
661 | pci_write_config_byte(dev, PCI_COMMAND, configbyte); | 666 | pci_write_config_byte(dev, PCI_COMMAND, configbyte); |
662 | } | 667 | } |
663 | 668 | ||
664 | ret = pci_request_regions(dev, "pd6729"); | 669 | ret = pci_request_regions(dev, "pd6729"); |
665 | if (ret) { | 670 | if (ret) { |
666 | printk(KERN_INFO "pd6729: pci request region failed.\n"); | 671 | dev_warn(&dev->dev, "pci request region failed.\n"); |
667 | goto err_out_disable; | 672 | goto err_out_disable; |
668 | } | 673 | } |
669 | 674 | ||
@@ -672,7 +677,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
672 | 677 | ||
673 | mask = pd6729_isa_scan(); | 678 | mask = pd6729_isa_scan(); |
674 | if (irq_mode == 0 && mask == 0) { | 679 | if (irq_mode == 0 && mask == 0) { |
675 | printk(KERN_INFO "pd6729: no ISA interrupt is available.\n"); | 680 | dev_warn(&dev->dev, "no ISA interrupt is available.\n"); |
676 | goto err_out_free_res; | 681 | goto err_out_free_res; |
677 | } | 682 | } |
678 | 683 | ||
@@ -697,8 +702,8 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
697 | /* Register the interrupt handler */ | 702 | /* Register the interrupt handler */ |
698 | if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, | 703 | if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, |
699 | "pd6729", socket))) { | 704 | "pd6729", socket))) { |
700 | printk(KERN_ERR "pd6729: Failed to register irq %d, " | 705 | dev_err(&dev->dev, "Failed to register irq %d\n", |
701 | "aborting\n", dev->irq); | 706 | dev->irq); |
702 | goto err_out_free_res; | 707 | goto err_out_free_res; |
703 | } | 708 | } |
704 | } else { | 709 | } else { |
@@ -713,8 +718,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, | |||
713 | for (i = 0; i < MAX_SOCKETS; i++) { | 718 | for (i = 0; i < MAX_SOCKETS; i++) { |
714 | ret = pcmcia_register_socket(&socket[i].socket); | 719 | ret = pcmcia_register_socket(&socket[i].socket); |
715 | if (ret) { | 720 | if (ret) { |
716 | printk(KERN_INFO "pd6729: pcmcia_register_socket " | 721 | dev_warn(&dev->dev, "pcmcia_register_socket failed.\n"); |
717 | "failed.\n"); | ||
718 | for (j = 0; j < i ; j++) | 722 | for (j = 0; j < i ; j++) |
719 | pcmcia_unregister_socket(&socket[j].socket); | 723 | pcmcia_unregister_socket(&socket[j].socket); |
720 | goto err_out_free_res2; | 724 | goto err_out_free_res2; |
diff --git a/drivers/pcmcia/pd6729.h b/drivers/pcmcia/pd6729.h index f392e458cdfd..41418d394c55 100644 --- a/drivers/pcmcia/pd6729.h +++ b/drivers/pcmcia/pd6729.h | |||
@@ -1,13 +1,6 @@ | |||
1 | #ifndef _INCLUDE_GUARD_PD6729_H_ | 1 | #ifndef _INCLUDE_GUARD_PD6729_H_ |
2 | #define _INCLUDE_GUARD_PD6729_H_ | 2 | #define _INCLUDE_GUARD_PD6729_H_ |
3 | 3 | ||
4 | /* Debuging defines */ | ||
5 | #ifdef NOTRACE | ||
6 | #define dprintk(fmt, args...) printk(fmt , ## args) | ||
7 | #else | ||
8 | #define dprintk(fmt, args...) do {} while (0) | ||
9 | #endif | ||
10 | |||
11 | /* Flags for I365_GENCTL */ | 4 | /* Flags for I365_GENCTL */ |
12 | #define I365_DF_VS1 0x40 /* DF-step Voltage Sense */ | 5 | #define I365_DF_VS1 0x40 /* DF-step Voltage Sense */ |
13 | #define I365_DF_VS2 0x80 | 6 | #define I365_DF_VS2 0x80 |