aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-06-26 15:01:29 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-27 03:09:46 -0400
commit9cbe50d4231773396f529f51a048770d0ee54ac1 (patch)
treee33de737635fe26c1b8e9f7e6a0300eed7cf0c1e
parent12a3bfefc8c1e43ddb50950cb74f8a11d680567a (diff)
cosa: Update to current logging forms
Use pr_fmt, pr_<level> and netdev_<level> as appropriate. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/wan/cosa.c226
1 files changed, 106 insertions, 120 deletions
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index 6fb6f8e667d0..6aed238e573e 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -74,6 +74,8 @@
74 * The Sync PPP/Cisco HDLC layer (syncppp.c) ported to Linux by Alan Cox 74 * The Sync PPP/Cisco HDLC layer (syncppp.c) ported to Linux by Alan Cox
75 */ 75 */
76 76
77#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
78
77#include <linux/module.h> 79#include <linux/module.h>
78#include <linux/kernel.h> 80#include <linux/kernel.h>
79#include <linux/sched.h> 81#include <linux/sched.h>
@@ -361,14 +363,13 @@ static int __init cosa_init(void)
361 363
362 if (cosa_major > 0) { 364 if (cosa_major > 0) {
363 if (register_chrdev(cosa_major, "cosa", &cosa_fops)) { 365 if (register_chrdev(cosa_major, "cosa", &cosa_fops)) {
364 printk(KERN_WARNING "cosa: unable to get major %d\n", 366 pr_warn("unable to get major %d\n", cosa_major);
365 cosa_major);
366 err = -EIO; 367 err = -EIO;
367 goto out; 368 goto out;
368 } 369 }
369 } else { 370 } else {
370 if (!(cosa_major=register_chrdev(0, "cosa", &cosa_fops))) { 371 if (!(cosa_major=register_chrdev(0, "cosa", &cosa_fops))) {
371 printk(KERN_WARNING "cosa: unable to register chardev\n"); 372 pr_warn("unable to register chardev\n");
372 err = -EIO; 373 err = -EIO;
373 goto out; 374 goto out;
374 } 375 }
@@ -378,7 +379,7 @@ static int __init cosa_init(void)
378 for (i=0; io[i] != 0 && i < MAX_CARDS; i++) 379 for (i=0; io[i] != 0 && i < MAX_CARDS; i++)
379 cosa_probe(io[i], irq[i], dma[i]); 380 cosa_probe(io[i], irq[i], dma[i]);
380 if (!nr_cards) { 381 if (!nr_cards) {
381 printk(KERN_WARNING "cosa: no devices found.\n"); 382 pr_warn("no devices found\n");
382 unregister_chrdev(cosa_major, "cosa"); 383 unregister_chrdev(cosa_major, "cosa");
383 err = -ENODEV; 384 err = -ENODEV;
384 goto out; 385 goto out;
@@ -447,26 +448,25 @@ static int cosa_probe(int base, int irq, int dma)
447 /* Checking validity of parameters: */ 448 /* Checking validity of parameters: */
448 /* IRQ should be 2-7 or 10-15; negative IRQ means autoprobe */ 449 /* IRQ should be 2-7 or 10-15; negative IRQ means autoprobe */
449 if ((irq >= 0 && irq < 2) || irq > 15 || (irq < 10 && irq > 7)) { 450 if ((irq >= 0 && irq < 2) || irq > 15 || (irq < 10 && irq > 7)) {
450 printk (KERN_INFO "cosa_probe: invalid IRQ %d\n", irq); 451 pr_info("invalid IRQ %d\n", irq);
451 return -1; 452 return -1;
452 } 453 }
453 /* I/O address should be between 0x100 and 0x3ff and should be 454 /* I/O address should be between 0x100 and 0x3ff and should be
454 * multiple of 8. */ 455 * multiple of 8. */
455 if (base < 0x100 || base > 0x3ff || base & 0x7) { 456 if (base < 0x100 || base > 0x3ff || base & 0x7) {
456 printk (KERN_INFO "cosa_probe: invalid I/O address 0x%x\n", 457 pr_info("invalid I/O address 0x%x\n", base);
457 base);
458 return -1; 458 return -1;
459 } 459 }
460 /* DMA should be 0,1 or 3-7 */ 460 /* DMA should be 0,1 or 3-7 */
461 if (dma < 0 || dma == 4 || dma > 7) { 461 if (dma < 0 || dma == 4 || dma > 7) {
462 printk (KERN_INFO "cosa_probe: invalid DMA %d\n", dma); 462 pr_info("invalid DMA %d\n", dma);
463 return -1; 463 return -1;
464 } 464 }
465 /* and finally, on 16-bit COSA DMA should be 4-7 and 465 /* and finally, on 16-bit COSA DMA should be 4-7 and
466 * I/O base should not be multiple of 0x10 */ 466 * I/O base should not be multiple of 0x10 */
467 if (((base & 0x8) && dma < 4) || (!(base & 0x8) && dma > 3)) { 467 if (((base & 0x8) && dma < 4) || (!(base & 0x8) && dma > 3)) {
468 printk (KERN_INFO "cosa_probe: 8/16 bit base and DMA mismatch" 468 pr_info("8/16 bit base and DMA mismatch (base=0x%x, dma=%d)\n",
469 " (base=0x%x, dma=%d)\n", base, dma); 469 base, dma);
470 return -1; 470 return -1;
471 } 471 }
472 472
@@ -479,7 +479,7 @@ static int cosa_probe(int base, int irq, int dma)
479 return -1; 479 return -1;
480 480
481 if (cosa_reset_and_read_id(cosa, cosa->id_string) < 0) { 481 if (cosa_reset_and_read_id(cosa, cosa->id_string) < 0) {
482 printk(KERN_DEBUG "cosa: probe at 0x%x failed.\n", base); 482 printk(KERN_DEBUG "probe at 0x%x failed.\n", base);
483 err = -1; 483 err = -1;
484 goto err_out; 484 goto err_out;
485 } 485 }
@@ -492,8 +492,7 @@ static int cosa_probe(int base, int irq, int dma)
492 else { 492 else {
493/* Print a warning only if we are not autoprobing */ 493/* Print a warning only if we are not autoprobing */
494#ifndef COSA_ISA_AUTOPROBE 494#ifndef COSA_ISA_AUTOPROBE
495 printk(KERN_INFO "cosa: valid signature not found at 0x%x.\n", 495 pr_info("valid signature not found at 0x%x\n", base);
496 base);
497#endif 496#endif
498 err = -1; 497 err = -1;
499 goto err_out; 498 goto err_out;
@@ -501,14 +500,14 @@ static int cosa_probe(int base, int irq, int dma)
501 /* Update the name of the region now we know the type of card */ 500 /* Update the name of the region now we know the type of card */
502 release_region(base, is_8bit(cosa)?2:4); 501 release_region(base, is_8bit(cosa)?2:4);
503 if (!request_region(base, is_8bit(cosa)?2:4, cosa->type)) { 502 if (!request_region(base, is_8bit(cosa)?2:4, cosa->type)) {
504 printk(KERN_DEBUG "cosa: changing name at 0x%x failed.\n", base); 503 printk(KERN_DEBUG "changing name at 0x%x failed.\n", base);
505 return -1; 504 return -1;
506 } 505 }
507 506
508 /* Now do IRQ autoprobe */ 507 /* Now do IRQ autoprobe */
509 if (irq < 0) { 508 if (irq < 0) {
510 unsigned long irqs; 509 unsigned long irqs;
511/* printk(KERN_INFO "IRQ autoprobe\n"); */ 510/* pr_info("IRQ autoprobe\n"); */
512 irqs = probe_irq_on(); 511 irqs = probe_irq_on();
513 /* 512 /*
514 * Enable interrupt on tx buffer empty (it sure is) 513 * Enable interrupt on tx buffer empty (it sure is)
@@ -526,13 +525,13 @@ static int cosa_probe(int base, int irq, int dma)
526 cosa_getdata8(cosa); 525 cosa_getdata8(cosa);
527 526
528 if (irq < 0) { 527 if (irq < 0) {
529 printk (KERN_INFO "cosa IRQ autoprobe: multiple interrupts obtained (%d, board at 0x%x)\n", 528 pr_info("multiple interrupts obtained (%d, board at 0x%x)\n",
530 irq, cosa->datareg); 529 irq, cosa->datareg);
531 err = -1; 530 err = -1;
532 goto err_out; 531 goto err_out;
533 } 532 }
534 if (irq == 0) { 533 if (irq == 0) {
535 printk (KERN_INFO "cosa IRQ autoprobe: no interrupt obtained (board at 0x%x)\n", 534 pr_info("no interrupt obtained (board at 0x%x)\n",
536 cosa->datareg); 535 cosa->datareg);
537 /* return -1; */ 536 /* return -1; */
538 } 537 }
@@ -579,8 +578,7 @@ static int cosa_probe(int base, int irq, int dma)
579 578
580 /* Register the network interface */ 579 /* Register the network interface */
581 if (!(chan->netdev = alloc_hdlcdev(chan))) { 580 if (!(chan->netdev = alloc_hdlcdev(chan))) {
582 printk(KERN_WARNING "%s: alloc_hdlcdev failed.\n", 581 pr_warn("%s: alloc_hdlcdev failed\n", chan->name);
583 chan->name);
584 goto err_hdlcdev; 582 goto err_hdlcdev;
585 } 583 }
586 dev_to_hdlc(chan->netdev)->attach = cosa_net_attach; 584 dev_to_hdlc(chan->netdev)->attach = cosa_net_attach;
@@ -591,14 +589,14 @@ static int cosa_probe(int base, int irq, int dma)
591 chan->netdev->irq = chan->cosa->irq; 589 chan->netdev->irq = chan->cosa->irq;
592 chan->netdev->dma = chan->cosa->dma; 590 chan->netdev->dma = chan->cosa->dma;
593 if (register_hdlc_device(chan->netdev)) { 591 if (register_hdlc_device(chan->netdev)) {
594 printk(KERN_WARNING "%s: register_hdlc_device()" 592 netdev_warn(chan->netdev,
595 " failed.\n", chan->netdev->name); 593 "register_hdlc_device() failed\n");
596 free_netdev(chan->netdev); 594 free_netdev(chan->netdev);
597 goto err_hdlcdev; 595 goto err_hdlcdev;
598 } 596 }
599 } 597 }
600 598
601 printk (KERN_INFO "cosa%d: %s (%s at 0x%x irq %d dma %d), %d channels\n", 599 pr_info("cosa%d: %s (%s at 0x%x irq %d dma %d), %d channels\n",
602 cosa->num, cosa->id_string, cosa->type, 600 cosa->num, cosa->id_string, cosa->type,
603 cosa->datareg, cosa->irq, cosa->dma, cosa->nchannels); 601 cosa->datareg, cosa->irq, cosa->dma, cosa->nchannels);
604 602
@@ -618,8 +616,7 @@ err_out1:
618 free_irq(cosa->irq, cosa); 616 free_irq(cosa->irq, cosa);
619err_out: 617err_out:
620 release_region(cosa->datareg,is_8bit(cosa)?2:4); 618 release_region(cosa->datareg,is_8bit(cosa)?2:4);
621 printk(KERN_NOTICE "cosa%d: allocating resources failed\n", 619 pr_notice("cosa%d: allocating resources failed\n", cosa->num);
622 cosa->num);
623 return err; 620 return err;
624} 621}
625 622
@@ -641,14 +638,14 @@ static int cosa_net_open(struct net_device *dev)
641 unsigned long flags; 638 unsigned long flags;
642 639
643 if (!(chan->cosa->firmware_status & COSA_FW_START)) { 640 if (!(chan->cosa->firmware_status & COSA_FW_START)) {
644 printk(KERN_NOTICE "%s: start the firmware first (status %d)\n", 641 pr_notice("%s: start the firmware first (status %d)\n",
645 chan->cosa->name, chan->cosa->firmware_status); 642 chan->cosa->name, chan->cosa->firmware_status);
646 return -EPERM; 643 return -EPERM;
647 } 644 }
648 spin_lock_irqsave(&chan->cosa->lock, flags); 645 spin_lock_irqsave(&chan->cosa->lock, flags);
649 if (chan->usage != 0) { 646 if (chan->usage != 0) {
650 printk(KERN_WARNING "%s: cosa_net_open called with usage count" 647 pr_warn("%s: cosa_net_open called with usage count %d\n",
651 " %d\n", chan->name, chan->usage); 648 chan->name, chan->usage);
652 spin_unlock_irqrestore(&chan->cosa->lock, flags); 649 spin_unlock_irqrestore(&chan->cosa->lock, flags);
653 return -EBUSY; 650 return -EBUSY;
654 } 651 }
@@ -736,8 +733,7 @@ static char *cosa_net_setup_rx(struct channel_data *chan, int size)
736 kfree_skb(chan->rx_skb); 733 kfree_skb(chan->rx_skb);
737 chan->rx_skb = dev_alloc_skb(size); 734 chan->rx_skb = dev_alloc_skb(size);
738 if (chan->rx_skb == NULL) { 735 if (chan->rx_skb == NULL) {
739 printk(KERN_NOTICE "%s: Memory squeeze, dropping packet\n", 736 pr_notice("%s: Memory squeeze, dropping packet\n", chan->name);
740 chan->name);
741 chan->netdev->stats.rx_dropped++; 737 chan->netdev->stats.rx_dropped++;
742 return NULL; 738 return NULL;
743 } 739 }
@@ -748,8 +744,7 @@ static char *cosa_net_setup_rx(struct channel_data *chan, int size)
748static int cosa_net_rx_done(struct channel_data *chan) 744static int cosa_net_rx_done(struct channel_data *chan)
749{ 745{
750 if (!chan->rx_skb) { 746 if (!chan->rx_skb) {
751 printk(KERN_WARNING "%s: rx_done with empty skb!\n", 747 pr_warn("%s: rx_done with empty skb!\n", chan->name);
752 chan->name);
753 chan->netdev->stats.rx_errors++; 748 chan->netdev->stats.rx_errors++;
754 chan->netdev->stats.rx_frame_errors++; 749 chan->netdev->stats.rx_frame_errors++;
755 return 0; 750 return 0;
@@ -768,8 +763,7 @@ static int cosa_net_rx_done(struct channel_data *chan)
768static int cosa_net_tx_done(struct channel_data *chan, int size) 763static int cosa_net_tx_done(struct channel_data *chan, int size)
769{ 764{
770 if (!chan->tx_skb) { 765 if (!chan->tx_skb) {
771 printk(KERN_WARNING "%s: tx_done with empty skb!\n", 766 pr_warn("%s: tx_done with empty skb!\n", chan->name);
772 chan->name);
773 chan->netdev->stats.tx_errors++; 767 chan->netdev->stats.tx_errors++;
774 chan->netdev->stats.tx_aborted_errors++; 768 chan->netdev->stats.tx_aborted_errors++;
775 return 1; 769 return 1;
@@ -794,15 +788,15 @@ static ssize_t cosa_read(struct file *file,
794 char *kbuf; 788 char *kbuf;
795 789
796 if (!(cosa->firmware_status & COSA_FW_START)) { 790 if (!(cosa->firmware_status & COSA_FW_START)) {
797 printk(KERN_NOTICE "%s: start the firmware first (status %d)\n", 791 pr_notice("%s: start the firmware first (status %d)\n",
798 cosa->name, cosa->firmware_status); 792 cosa->name, cosa->firmware_status);
799 return -EPERM; 793 return -EPERM;
800 } 794 }
801 if (mutex_lock_interruptible(&chan->rlock)) 795 if (mutex_lock_interruptible(&chan->rlock))
802 return -ERESTARTSYS; 796 return -ERESTARTSYS;
803 797
804 if ((chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL)) == NULL) { 798 if ((chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL)) == NULL) {
805 printk(KERN_INFO "%s: cosa_read() - OOM\n", cosa->name); 799 pr_info("%s: cosa_read() - OOM\n", cosa->name);
806 mutex_unlock(&chan->rlock); 800 mutex_unlock(&chan->rlock);
807 return -ENOMEM; 801 return -ENOMEM;
808 } 802 }
@@ -869,8 +863,8 @@ static ssize_t cosa_write(struct file *file,
869 char *kbuf; 863 char *kbuf;
870 864
871 if (!(cosa->firmware_status & COSA_FW_START)) { 865 if (!(cosa->firmware_status & COSA_FW_START)) {
872 printk(KERN_NOTICE "%s: start the firmware first (status %d)\n", 866 pr_notice("%s: start the firmware first (status %d)\n",
873 cosa->name, cosa->firmware_status); 867 cosa->name, cosa->firmware_status);
874 return -EPERM; 868 return -EPERM;
875 } 869 }
876 if (down_interruptible(&chan->wsem)) 870 if (down_interruptible(&chan->wsem))
@@ -881,8 +875,8 @@ static ssize_t cosa_write(struct file *file,
881 875
882 /* Allocate the buffer */ 876 /* Allocate the buffer */
883 if ((kbuf = kmalloc(count, GFP_KERNEL|GFP_DMA)) == NULL) { 877 if ((kbuf = kmalloc(count, GFP_KERNEL|GFP_DMA)) == NULL) {
884 printk(KERN_NOTICE "%s: cosa_write() OOM - dropping packet\n", 878 pr_notice("%s: cosa_write() OOM - dropping packet\n",
885 cosa->name); 879 cosa->name);
886 up(&chan->wsem); 880 up(&chan->wsem);
887 return -ENOMEM; 881 return -ENOMEM;
888 } 882 }
@@ -932,7 +926,7 @@ static int chrdev_tx_done(struct channel_data *chan, int size)
932 926
933static unsigned int cosa_poll(struct file *file, poll_table *poll) 927static unsigned int cosa_poll(struct file *file, poll_table *poll)
934{ 928{
935 printk(KERN_INFO "cosa_poll is here\n"); 929 pr_info("cosa_poll is here\n");
936 return 0; 930 return 0;
937} 931}
938 932
@@ -1017,15 +1011,14 @@ static inline int cosa_reset(struct cosa_data *cosa)
1017{ 1011{
1018 char idstring[COSA_MAX_ID_STRING]; 1012 char idstring[COSA_MAX_ID_STRING];
1019 if (cosa->usage > 1) 1013 if (cosa->usage > 1)
1020 printk(KERN_INFO "cosa%d: WARNING: reset requested with cosa->usage > 1 (%d). Odd things may happen.\n", 1014 pr_info("cosa%d: WARNING: reset requested with cosa->usage > 1 (%d). Odd things may happen.\n",
1021 cosa->num, cosa->usage); 1015 cosa->num, cosa->usage);
1022 cosa->firmware_status &= ~(COSA_FW_RESET|COSA_FW_START); 1016 cosa->firmware_status &= ~(COSA_FW_RESET|COSA_FW_START);
1023 if (cosa_reset_and_read_id(cosa, idstring) < 0) { 1017 if (cosa_reset_and_read_id(cosa, idstring) < 0) {
1024 printk(KERN_NOTICE "cosa%d: reset failed\n", cosa->num); 1018 pr_notice("cosa%d: reset failed\n", cosa->num);
1025 return -EIO; 1019 return -EIO;
1026 } 1020 }
1027 printk(KERN_INFO "cosa%d: resetting device: %s\n", cosa->num, 1021 pr_info("cosa%d: resetting device: %s\n", cosa->num, idstring);
1028 idstring);
1029 cosa->firmware_status |= COSA_FW_RESET; 1022 cosa->firmware_status |= COSA_FW_RESET;
1030 return 0; 1023 return 0;
1031} 1024}
@@ -1037,11 +1030,11 @@ static inline int cosa_download(struct cosa_data *cosa, void __user *arg)
1037 int i; 1030 int i;
1038 1031
1039 if (cosa->usage > 1) 1032 if (cosa->usage > 1)
1040 printk(KERN_INFO "%s: WARNING: download of microcode requested with cosa->usage > 1 (%d). Odd things may happen.\n", 1033 pr_info("%s: WARNING: download of microcode requested with cosa->usage > 1 (%d). Odd things may happen.\n",
1041 cosa->name, cosa->usage); 1034 cosa->name, cosa->usage);
1042 if (!(cosa->firmware_status & COSA_FW_RESET)) { 1035 if (!(cosa->firmware_status & COSA_FW_RESET)) {
1043 printk(KERN_NOTICE "%s: reset the card first (status %d).\n", 1036 pr_notice("%s: reset the card first (status %d)\n",
1044 cosa->name, cosa->firmware_status); 1037 cosa->name, cosa->firmware_status);
1045 return -EPERM; 1038 return -EPERM;
1046 } 1039 }
1047 1040
@@ -1059,11 +1052,11 @@ static inline int cosa_download(struct cosa_data *cosa, void __user *arg)
1059 1052
1060 i = download(cosa, d.code, d.len, d.addr); 1053 i = download(cosa, d.code, d.len, d.addr);
1061 if (i < 0) { 1054 if (i < 0) {
1062 printk(KERN_NOTICE "cosa%d: microcode download failed: %d\n", 1055 pr_notice("cosa%d: microcode download failed: %d\n",
1063 cosa->num, i); 1056 cosa->num, i);
1064 return -EIO; 1057 return -EIO;
1065 } 1058 }
1066 printk(KERN_INFO "cosa%d: downloading microcode - 0x%04x bytes at 0x%04x\n", 1059 pr_info("cosa%d: downloading microcode - 0x%04x bytes at 0x%04x\n",
1067 cosa->num, d.len, d.addr); 1060 cosa->num, d.len, d.addr);
1068 cosa->firmware_status |= COSA_FW_RESET|COSA_FW_DOWNLOAD; 1061 cosa->firmware_status |= COSA_FW_RESET|COSA_FW_DOWNLOAD;
1069 return 0; 1062 return 0;
@@ -1076,12 +1069,11 @@ static inline int cosa_readmem(struct cosa_data *cosa, void __user *arg)
1076 int i; 1069 int i;
1077 1070
1078 if (cosa->usage > 1) 1071 if (cosa->usage > 1)
1079 printk(KERN_INFO "cosa%d: WARNING: readmem requested with " 1072 pr_info("cosa%d: WARNING: readmem requested with cosa->usage > 1 (%d). Odd things may happen.\n",
1080 "cosa->usage > 1 (%d). Odd things may happen.\n",
1081 cosa->num, cosa->usage); 1073 cosa->num, cosa->usage);
1082 if (!(cosa->firmware_status & COSA_FW_RESET)) { 1074 if (!(cosa->firmware_status & COSA_FW_RESET)) {
1083 printk(KERN_NOTICE "%s: reset the card first (status %d).\n", 1075 pr_notice("%s: reset the card first (status %d)\n",
1084 cosa->name, cosa->firmware_status); 1076 cosa->name, cosa->firmware_status);
1085 return -EPERM; 1077 return -EPERM;
1086 } 1078 }
1087 1079
@@ -1093,11 +1085,10 @@ static inline int cosa_readmem(struct cosa_data *cosa, void __user *arg)
1093 1085
1094 i = readmem(cosa, d.code, d.len, d.addr); 1086 i = readmem(cosa, d.code, d.len, d.addr);
1095 if (i < 0) { 1087 if (i < 0) {
1096 printk(KERN_NOTICE "cosa%d: reading memory failed: %d\n", 1088 pr_notice("cosa%d: reading memory failed: %d\n", cosa->num, i);
1097 cosa->num, i);
1098 return -EIO; 1089 return -EIO;
1099 } 1090 }
1100 printk(KERN_INFO "cosa%d: reading card memory - 0x%04x bytes at 0x%04x\n", 1091 pr_info("cosa%d: reading card memory - 0x%04x bytes at 0x%04x\n",
1101 cosa->num, d.len, d.addr); 1092 cosa->num, d.len, d.addr);
1102 cosa->firmware_status |= COSA_FW_RESET; 1093 cosa->firmware_status |= COSA_FW_RESET;
1103 return 0; 1094 return 0;
@@ -1109,23 +1100,22 @@ static inline int cosa_start(struct cosa_data *cosa, int address)
1109 int i; 1100 int i;
1110 1101
1111 if (cosa->usage > 1) 1102 if (cosa->usage > 1)
1112 printk(KERN_INFO "cosa%d: WARNING: start microcode requested with cosa->usage > 1 (%d). Odd things may happen.\n", 1103 pr_info("cosa%d: WARNING: start microcode requested with cosa->usage > 1 (%d). Odd things may happen.\n",
1113 cosa->num, cosa->usage); 1104 cosa->num, cosa->usage);
1114 1105
1115 if ((cosa->firmware_status & (COSA_FW_RESET|COSA_FW_DOWNLOAD)) 1106 if ((cosa->firmware_status & (COSA_FW_RESET|COSA_FW_DOWNLOAD))
1116 != (COSA_FW_RESET|COSA_FW_DOWNLOAD)) { 1107 != (COSA_FW_RESET|COSA_FW_DOWNLOAD)) {
1117 printk(KERN_NOTICE "%s: download the microcode and/or reset the card first (status %d).\n", 1108 pr_notice("%s: download the microcode and/or reset the card first (status %d)\n",
1118 cosa->name, cosa->firmware_status); 1109 cosa->name, cosa->firmware_status);
1119 return -EPERM; 1110 return -EPERM;
1120 } 1111 }
1121 cosa->firmware_status &= ~COSA_FW_RESET; 1112 cosa->firmware_status &= ~COSA_FW_RESET;
1122 if ((i=startmicrocode(cosa, address)) < 0) { 1113 if ((i=startmicrocode(cosa, address)) < 0) {
1123 printk(KERN_NOTICE "cosa%d: start microcode at 0x%04x failed: %d\n", 1114 pr_notice("cosa%d: start microcode at 0x%04x failed: %d\n",
1124 cosa->num, address, i); 1115 cosa->num, address, i);
1125 return -EIO; 1116 return -EIO;
1126 } 1117 }
1127 printk(KERN_INFO "cosa%d: starting microcode at 0x%04x\n", 1118 pr_info("cosa%d: starting microcode at 0x%04x\n", cosa->num, address);
1128 cosa->num, address);
1129 cosa->startaddr = address; 1119 cosa->startaddr = address;
1130 cosa->firmware_status |= COSA_FW_START; 1120 cosa->firmware_status |= COSA_FW_START;
1131 return 0; 1121 return 0;
@@ -1255,11 +1245,11 @@ static int cosa_start_tx(struct channel_data *chan, char *buf, int len)
1255#ifdef DEBUG_DATA 1245#ifdef DEBUG_DATA
1256 int i; 1246 int i;
1257 1247
1258 printk(KERN_INFO "cosa%dc%d: starting tx(0x%x)", chan->cosa->num, 1248 pr_info("cosa%dc%d: starting tx(0x%x)",
1259 chan->num, len); 1249 chan->cosa->num, chan->num, len);
1260 for (i=0; i<len; i++) 1250 for (i=0; i<len; i++)
1261 printk(" %02x", buf[i]&0xff); 1251 pr_cont(" %02x", buf[i]&0xff);
1262 printk("\n"); 1252 pr_cont("\n");
1263#endif 1253#endif
1264 spin_lock_irqsave(&cosa->lock, flags); 1254 spin_lock_irqsave(&cosa->lock, flags);
1265 chan->txbuf = buf; 1255 chan->txbuf = buf;
@@ -1353,7 +1343,7 @@ static void cosa_kick(struct cosa_data *cosa)
1353 if (test_bit(TXBIT, &cosa->rxtx)) 1343 if (test_bit(TXBIT, &cosa->rxtx))
1354 s = "TX DMA"; 1344 s = "TX DMA";
1355 1345
1356 printk(KERN_INFO "%s: %s timeout - restarting.\n", cosa->name, s); 1346 pr_info("%s: %s timeout - restarting\n", cosa->name, s);
1357 spin_lock_irqsave(&cosa->lock, flags); 1347 spin_lock_irqsave(&cosa->lock, flags);
1358 cosa->rxtx = 0; 1348 cosa->rxtx = 0;
1359 1349
@@ -1387,7 +1377,7 @@ static int cosa_dma_able(struct channel_data *chan, char *buf, int len)
1387 return 0; 1377 return 0;
1388 if ((b^ (b+len)) & 0x10000) { 1378 if ((b^ (b+len)) & 0x10000) {
1389 if (count++ < 5) 1379 if (count++ < 5)
1390 printk(KERN_INFO "%s: packet spanning a 64k boundary\n", 1380 pr_info("%s: packet spanning a 64k boundary\n",
1391 chan->name); 1381 chan->name);
1392 return 0; 1382 return 0;
1393 } 1383 }
@@ -1498,8 +1488,7 @@ static int readmem(struct cosa_data *cosa, char __user *microcode, int length, i
1498 char c; 1488 char c;
1499 int i; 1489 int i;
1500 if ((i=get_wait_data(cosa)) == -1) { 1490 if ((i=get_wait_data(cosa)) == -1) {
1501 printk (KERN_INFO "cosa: 0x%04x bytes remaining\n", 1491 pr_info("0x%04x bytes remaining\n", length);
1502 length);
1503 return -11; 1492 return -11;
1504 } 1493 }
1505 c=i; 1494 c=i;
@@ -1582,14 +1571,15 @@ static int get_wait_data(struct cosa_data *cosa)
1582 short r; 1571 short r;
1583 r = cosa_getdata8(cosa); 1572 r = cosa_getdata8(cosa);
1584#if 0 1573#if 0
1585 printk(KERN_INFO "cosa: get_wait_data returning after %d retries\n", 999-retries); 1574 pr_info("get_wait_data returning after %d retries\n",
1575 999-retries);
1586#endif 1576#endif
1587 return r; 1577 return r;
1588 } 1578 }
1589 /* sleep if not ready to read */ 1579 /* sleep if not ready to read */
1590 schedule_timeout_interruptible(1); 1580 schedule_timeout_interruptible(1);
1591 } 1581 }
1592 printk(KERN_INFO "cosa: timeout in get_wait_data (status 0x%x)\n", 1582 pr_info("timeout in get_wait_data (status 0x%x)\n",
1593 cosa_getstatus(cosa)); 1583 cosa_getstatus(cosa));
1594 return -1; 1584 return -1;
1595} 1585}
@@ -1607,7 +1597,7 @@ static int put_wait_data(struct cosa_data *cosa, int data)
1607 if (cosa_getstatus(cosa) & SR_TX_RDY) { 1597 if (cosa_getstatus(cosa) & SR_TX_RDY) {
1608 cosa_putdata8(cosa, data); 1598 cosa_putdata8(cosa, data);
1609#if 0 1599#if 0
1610 printk(KERN_INFO "Putdata: %d retries\n", 999-retries); 1600 pr_info("Putdata: %d retries\n", 999-retries);
1611#endif 1601#endif
1612 return 0; 1602 return 0;
1613 } 1603 }
@@ -1616,7 +1606,7 @@ static int put_wait_data(struct cosa_data *cosa, int data)
1616 schedule_timeout_interruptible(1); 1606 schedule_timeout_interruptible(1);
1617#endif 1607#endif
1618 } 1608 }
1619 printk(KERN_INFO "cosa%d: timeout in put_wait_data (status 0x%x)\n", 1609 pr_info("cosa%d: timeout in put_wait_data (status 0x%x)\n",
1620 cosa->num, cosa_getstatus(cosa)); 1610 cosa->num, cosa_getstatus(cosa));
1621 return -1; 1611 return -1;
1622} 1612}
@@ -1636,13 +1626,13 @@ static int puthexnumber(struct cosa_data *cosa, int number)
1636 sprintf(temp, "%04X", number); 1626 sprintf(temp, "%04X", number);
1637 for (i=0; i<4; i++) { 1627 for (i=0; i<4; i++) {
1638 if (put_wait_data(cosa, temp[i]) == -1) { 1628 if (put_wait_data(cosa, temp[i]) == -1) {
1639 printk(KERN_NOTICE "cosa%d: puthexnumber failed to write byte %d\n", 1629 pr_notice("cosa%d: puthexnumber failed to write byte %d\n",
1640 cosa->num, i); 1630 cosa->num, i);
1641 return -1-2*i; 1631 return -1-2*i;
1642 } 1632 }
1643 if (get_wait_data(cosa) != temp[i]) { 1633 if (get_wait_data(cosa) != temp[i]) {
1644 printk(KERN_NOTICE "cosa%d: puthexhumber failed to read echo of byte %d\n", 1634 pr_notice("cosa%d: puthexhumber failed to read echo of byte %d\n",
1645 cosa->num, i); 1635 cosa->num, i);
1646 return -2-2*i; 1636 return -2-2*i;
1647 } 1637 }
1648 } 1638 }
@@ -1687,8 +1677,7 @@ static inline void tx_interrupt(struct cosa_data *cosa, int status)
1687{ 1677{
1688 unsigned long flags, flags1; 1678 unsigned long flags, flags1;
1689#ifdef DEBUG_IRQS 1679#ifdef DEBUG_IRQS
1690 printk(KERN_INFO "cosa%d: SR_DOWN_REQUEST status=0x%04x\n", 1680 pr_info("cosa%d: SR_DOWN_REQUEST status=0x%04x\n", cosa->num, status);
1691 cosa->num, status);
1692#endif 1681#endif
1693 spin_lock_irqsave(&cosa->lock, flags); 1682 spin_lock_irqsave(&cosa->lock, flags);
1694 set_bit(TXBIT, &cosa->rxtx); 1683 set_bit(TXBIT, &cosa->rxtx);
@@ -1696,8 +1685,7 @@ static inline void tx_interrupt(struct cosa_data *cosa, int status)
1696 /* flow control, see the comment above */ 1685 /* flow control, see the comment above */
1697 int i=0; 1686 int i=0;
1698 if (!cosa->txbitmap) { 1687 if (!cosa->txbitmap) {
1699 printk(KERN_WARNING "%s: No channel wants data " 1688 pr_warn("%s: No channel wants data in TX IRQ. Expect DMA timeout.\n",
1700 "in TX IRQ. Expect DMA timeout.",
1701 cosa->name); 1689 cosa->name);
1702 put_driver_status_nolock(cosa); 1690 put_driver_status_nolock(cosa);
1703 clear_bit(TXBIT, &cosa->rxtx); 1691 clear_bit(TXBIT, &cosa->rxtx);
@@ -1780,14 +1768,14 @@ static inline void tx_interrupt(struct cosa_data *cosa, int status)
1780 if (cosa->busmaster) { 1768 if (cosa->busmaster) {
1781 unsigned long addr = virt_to_bus(cosa->txbuf); 1769 unsigned long addr = virt_to_bus(cosa->txbuf);
1782 int count=0; 1770 int count=0;
1783 printk(KERN_INFO "busmaster IRQ\n"); 1771 pr_info("busmaster IRQ\n");
1784 while (!(cosa_getstatus(cosa)&SR_TX_RDY)) { 1772 while (!(cosa_getstatus(cosa)&SR_TX_RDY)) {
1785 count++; 1773 count++;
1786 udelay(10); 1774 udelay(10);
1787 if (count > 1000) break; 1775 if (count > 1000) break;
1788 } 1776 }
1789 printk(KERN_INFO "status %x\n", cosa_getstatus(cosa)); 1777 pr_info("status %x\n", cosa_getstatus(cosa));
1790 printk(KERN_INFO "ready after %d loops\n", count); 1778 pr_info("ready after %d loops\n", count);
1791 cosa_putdata16(cosa, (addr >> 16)&0xffff); 1779 cosa_putdata16(cosa, (addr >> 16)&0xffff);
1792 1780
1793 count = 0; 1781 count = 0;
@@ -1796,7 +1784,7 @@ static inline void tx_interrupt(struct cosa_data *cosa, int status)
1796 if (count > 1000) break; 1784 if (count > 1000) break;
1797 udelay(10); 1785 udelay(10);
1798 } 1786 }
1799 printk(KERN_INFO "ready after %d loops\n", count); 1787 pr_info("ready after %d loops\n", count);
1800 cosa_putdata16(cosa, addr &0xffff); 1788 cosa_putdata16(cosa, addr &0xffff);
1801 flags1 = claim_dma_lock(); 1789 flags1 = claim_dma_lock();
1802 set_dma_mode(cosa->dma, DMA_MODE_CASCADE); 1790 set_dma_mode(cosa->dma, DMA_MODE_CASCADE);
@@ -1824,7 +1812,7 @@ static inline void rx_interrupt(struct cosa_data *cosa, int status)
1824{ 1812{
1825 unsigned long flags; 1813 unsigned long flags;
1826#ifdef DEBUG_IRQS 1814#ifdef DEBUG_IRQS
1827 printk(KERN_INFO "cosa%d: SR_UP_REQUEST\n", cosa->num); 1815 pr_info("cosa%d: SR_UP_REQUEST\n", cosa->num);
1828#endif 1816#endif
1829 1817
1830 spin_lock_irqsave(&cosa->lock, flags); 1818 spin_lock_irqsave(&cosa->lock, flags);
@@ -1847,7 +1835,7 @@ static inline void rx_interrupt(struct cosa_data *cosa, int status)
1847 debug_data_in(cosa, cosa->rxsize & 0xff); 1835 debug_data_in(cosa, cosa->rxsize & 0xff);
1848#endif 1836#endif
1849#if 0 1837#if 0
1850 printk(KERN_INFO "cosa%d: receive rxsize = (0x%04x).\n", 1838 pr_info("cosa%d: receive rxsize = (0x%04x)\n",
1851 cosa->num, cosa->rxsize); 1839 cosa->num, cosa->rxsize);
1852#endif 1840#endif
1853 } 1841 }
@@ -1857,12 +1845,12 @@ static inline void rx_interrupt(struct cosa_data *cosa, int status)
1857 debug_data_in(cosa, cosa->rxsize); 1845 debug_data_in(cosa, cosa->rxsize);
1858#endif 1846#endif
1859#if 0 1847#if 0
1860 printk(KERN_INFO "cosa%d: receive rxsize = (0x%04x).\n", 1848 pr_info("cosa%d: receive rxsize = (0x%04x)\n",
1861 cosa->num, cosa->rxsize); 1849 cosa->num, cosa->rxsize);
1862#endif 1850#endif
1863 } 1851 }
1864 if (((cosa->rxsize & 0xe000) >> 13) >= cosa->nchannels) { 1852 if (((cosa->rxsize & 0xe000) >> 13) >= cosa->nchannels) {
1865 printk(KERN_WARNING "%s: rx for unknown channel (0x%04x)\n", 1853 pr_warn("%s: rx for unknown channel (0x%04x)\n",
1866 cosa->name, cosa->rxsize); 1854 cosa->name, cosa->rxsize);
1867 spin_unlock_irqrestore(&cosa->lock, flags); 1855 spin_unlock_irqrestore(&cosa->lock, flags);
1868 goto reject; 1856 goto reject;
@@ -1877,7 +1865,7 @@ static inline void rx_interrupt(struct cosa_data *cosa, int status)
1877 1865
1878 if (!cosa->rxbuf) { 1866 if (!cosa->rxbuf) {
1879reject: /* Reject the packet */ 1867reject: /* Reject the packet */
1880 printk(KERN_INFO "cosa%d: rejecting packet on channel %d\n", 1868 pr_info("cosa%d: rejecting packet on channel %d\n",
1881 cosa->num, cosa->rxchan->num); 1869 cosa->num, cosa->rxchan->num);
1882 cosa->rxbuf = cosa->bouncebuf; 1870 cosa->rxbuf = cosa->bouncebuf;
1883 } 1871 }
@@ -1924,11 +1912,11 @@ static inline void eot_interrupt(struct cosa_data *cosa, int status)
1924#ifdef DEBUG_DATA 1912#ifdef DEBUG_DATA
1925 { 1913 {
1926 int i; 1914 int i;
1927 printk(KERN_INFO "cosa%dc%d: done rx(0x%x)", cosa->num, 1915 pr_info("cosa%dc%d: done rx(0x%x)",
1928 cosa->rxchan->num, cosa->rxsize); 1916 cosa->num, cosa->rxchan->num, cosa->rxsize);
1929 for (i=0; i<cosa->rxsize; i++) 1917 for (i=0; i<cosa->rxsize; i++)
1930 printk (" %02x", cosa->rxbuf[i]&0xff); 1918 pr_cont(" %02x", cosa->rxbuf[i]&0xff);
1931 printk("\n"); 1919 pr_cont("\n");
1932 } 1920 }
1933#endif 1921#endif
1934 /* Packet for unknown channel? */ 1922 /* Packet for unknown channel? */
@@ -1940,8 +1928,7 @@ static inline void eot_interrupt(struct cosa_data *cosa, int status)
1940 if (cosa->rxchan->rx_done(cosa->rxchan)) 1928 if (cosa->rxchan->rx_done(cosa->rxchan))
1941 clear_bit(cosa->rxchan->num, &cosa->rxbitmap); 1929 clear_bit(cosa->rxchan->num, &cosa->rxbitmap);
1942 } else { 1930 } else {
1943 printk(KERN_NOTICE "cosa%d: unexpected EOT interrupt\n", 1931 pr_notice("cosa%d: unexpected EOT interrupt\n", cosa->num);
1944 cosa->num);
1945 } 1932 }
1946 /* 1933 /*
1947 * Clear the RXBIT, TXBIT and IRQBIT (the latest should be 1934 * Clear the RXBIT, TXBIT and IRQBIT (the latest should be
@@ -1963,8 +1950,7 @@ static irqreturn_t cosa_interrupt(int irq, void *cosa_)
1963again: 1950again:
1964 status = cosa_getstatus(cosa); 1951 status = cosa_getstatus(cosa);
1965#ifdef DEBUG_IRQS 1952#ifdef DEBUG_IRQS
1966 printk(KERN_INFO "cosa%d: got IRQ, status 0x%02x\n", cosa->num, 1953 pr_info("cosa%d: got IRQ, status 0x%02x\n", cosa->num, status & 0xff);
1967 status & 0xff);
1968#endif 1954#endif
1969#ifdef DEBUG_IO 1955#ifdef DEBUG_IO
1970 debug_status_in(cosa, status); 1956 debug_status_in(cosa, status);
@@ -1985,15 +1971,15 @@ again:
1985 udelay(100); 1971 udelay(100);
1986 goto again; 1972 goto again;
1987 } 1973 }
1988 printk(KERN_INFO "cosa%d: unknown status 0x%02x in IRQ after %d retries\n", 1974 pr_info("cosa%d: unknown status 0x%02x in IRQ after %d retries\n",
1989 cosa->num, status & 0xff, count); 1975 cosa->num, status & 0xff, count);
1990 } 1976 }
1991#ifdef DEBUG_IRQS 1977#ifdef DEBUG_IRQS
1992 if (count) 1978 if (count)
1993 printk(KERN_INFO "%s: %d-times got unknown status in IRQ\n", 1979 pr_info("%s: %d-times got unknown status in IRQ\n",
1994 cosa->name, count); 1980 cosa->name, count);
1995 else 1981 else
1996 printk(KERN_INFO "%s: returning from IRQ\n", cosa->name); 1982 pr_info("%s: returning from IRQ\n", cosa->name);
1997#endif 1983#endif
1998 return IRQ_HANDLED; 1984 return IRQ_HANDLED;
1999} 1985}
@@ -2024,41 +2010,41 @@ static void debug_status_in(struct cosa_data *cosa, int status)
2024 s = "NO_REQ"; 2010 s = "NO_REQ";
2025 break; 2011 break;
2026 } 2012 }
2027 printk(KERN_INFO "%s: IO: status -> 0x%02x (%s%s%s%s)\n", 2013 pr_info("%s: IO: status -> 0x%02x (%s%s%s%s)\n",
2028 cosa->name, 2014 cosa->name,
2029 status, 2015 status,
2030 status & SR_USR_RQ ? "USR_RQ|":"", 2016 status & SR_USR_RQ ? "USR_RQ|" : "",
2031 status & SR_TX_RDY ? "TX_RDY|":"", 2017 status & SR_TX_RDY ? "TX_RDY|" : "",
2032 status & SR_RX_RDY ? "RX_RDY|":"", 2018 status & SR_RX_RDY ? "RX_RDY|" : "",
2033 s); 2019 s);
2034} 2020}
2035 2021
2036static void debug_status_out(struct cosa_data *cosa, int status) 2022static void debug_status_out(struct cosa_data *cosa, int status)
2037{ 2023{
2038 printk(KERN_INFO "%s: IO: status <- 0x%02x (%s%s%s%s%s%s)\n", 2024 pr_info("%s: IO: status <- 0x%02x (%s%s%s%s%s%s)\n",
2039 cosa->name, 2025 cosa->name,
2040 status, 2026 status,
2041 status & SR_RX_DMA_ENA ? "RXDMA|":"!rxdma|", 2027 status & SR_RX_DMA_ENA ? "RXDMA|" : "!rxdma|",
2042 status & SR_TX_DMA_ENA ? "TXDMA|":"!txdma|", 2028 status & SR_TX_DMA_ENA ? "TXDMA|" : "!txdma|",
2043 status & SR_RST ? "RESET|":"", 2029 status & SR_RST ? "RESET|" : "",
2044 status & SR_USR_INT_ENA ? "USRINT|":"!usrint|", 2030 status & SR_USR_INT_ENA ? "USRINT|" : "!usrint|",
2045 status & SR_TX_INT_ENA ? "TXINT|":"!txint|", 2031 status & SR_TX_INT_ENA ? "TXINT|" : "!txint|",
2046 status & SR_RX_INT_ENA ? "RXINT":"!rxint"); 2032 status & SR_RX_INT_ENA ? "RXINT" : "!rxint");
2047} 2033}
2048 2034
2049static void debug_data_in(struct cosa_data *cosa, int data) 2035static void debug_data_in(struct cosa_data *cosa, int data)
2050{ 2036{
2051 printk(KERN_INFO "%s: IO: data -> 0x%04x\n", cosa->name, data); 2037 pr_info("%s: IO: data -> 0x%04x\n", cosa->name, data);
2052} 2038}
2053 2039
2054static void debug_data_out(struct cosa_data *cosa, int data) 2040static void debug_data_out(struct cosa_data *cosa, int data)
2055{ 2041{
2056 printk(KERN_INFO "%s: IO: data <- 0x%04x\n", cosa->name, data); 2042 pr_info("%s: IO: data <- 0x%04x\n", cosa->name, data);
2057} 2043}
2058 2044
2059static void debug_data_cmd(struct cosa_data *cosa, int data) 2045static void debug_data_cmd(struct cosa_data *cosa, int data)
2060{ 2046{
2061 printk(KERN_INFO "%s: IO: data <- 0x%04x (%s|%s)\n", 2047 pr_info("%s: IO: data <- 0x%04x (%s|%s)\n",
2062 cosa->name, data, 2048 cosa->name, data,
2063 data & SR_RDY_RCV ? "RX_RDY" : "!rx_rdy", 2049 data & SR_RDY_RCV ? "RX_RDY" : "!rx_rdy",
2064 data & SR_RDY_SND ? "TX_RDY" : "!tx_rdy"); 2050 data & SR_RDY_SND ? "TX_RDY" : "!tx_rdy");