aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan/wanxl.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-06-26 15:01:28 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-27 03:09:46 -0400
commit12a3bfefc8c1e43ddb50950cb74f8a11d680567a (patch)
treeff974d28811618a51ab8dcbef1588a1022cb9c74 /drivers/net/wan/wanxl.c
parent2903dd654d8788425a9523959b02933ea6555229 (diff)
generic_hdlc: 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>
Diffstat (limited to 'drivers/net/wan/wanxl.c')
-rw-r--r--drivers/net/wan/wanxl.c90
1 files changed, 42 insertions, 48 deletions
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 4ea89fe0006f..8d7aa43dfba5 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -13,6 +13,8 @@
13 * - wanXL100 will require minor driver modifications, no access to hw 13 * - wanXL100 will require minor driver modifications, no access to hw
14 */ 14 */
15 15
16#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
17
16#include <linux/module.h> 18#include <linux/module.h>
17#include <linux/kernel.h> 19#include <linux/kernel.h>
18#include <linux/slab.h> 20#include <linux/slab.h>
@@ -102,9 +104,8 @@ static inline dma_addr_t pci_map_single_debug(struct pci_dev *pdev, void *ptr,
102{ 104{
103 dma_addr_t addr = pci_map_single(pdev, ptr, size, direction); 105 dma_addr_t addr = pci_map_single(pdev, ptr, size, direction);
104 if (addr + size > 0x100000000LL) 106 if (addr + size > 0x100000000LL)
105 printk(KERN_CRIT "wanXL %s: pci_map_single() returned memory" 107 pr_crit("%s: pci_map_single() returned memory at 0x%llx!\n",
106 " at 0x%LX!\n", pci_name(pdev), 108 pci_name(pdev), (unsigned long long)addr);
107 (unsigned long long)addr);
108 return addr; 109 return addr;
109} 110}
110 111
@@ -147,8 +148,8 @@ static inline void wanxl_cable_intr(port_t *port)
147 } 148 }
148 dte = (value & STATUS_CABLE_DCE) ? " DCE" : " DTE"; 149 dte = (value & STATUS_CABLE_DCE) ? " DCE" : " DTE";
149 } 150 }
150 printk(KERN_INFO "%s: %s%s module, %s cable%s%s\n", 151 netdev_info(port->dev, "%s%s module, %s cable%s%s\n",
151 port->dev->name, pm, dte, cable, dsr, dcd); 152 pm, dte, cable, dsr, dcd);
152 153
153 if (value & STATUS_CABLE_DCD) 154 if (value & STATUS_CABLE_DCD)
154 netif_carrier_on(port->dev); 155 netif_carrier_on(port->dev);
@@ -198,8 +199,8 @@ static inline void wanxl_rx_intr(card_t *card)
198 while (desc = &card->status->rx_descs[card->rx_in], 199 while (desc = &card->status->rx_descs[card->rx_in],
199 desc->stat != PACKET_EMPTY) { 200 desc->stat != PACKET_EMPTY) {
200 if ((desc->stat & PACKET_PORT_MASK) > card->n_ports) 201 if ((desc->stat & PACKET_PORT_MASK) > card->n_ports)
201 printk(KERN_CRIT "wanXL %s: received packet for" 202 pr_crit("%s: received packet for nonexistent port\n",
202 " nonexistent port\n", pci_name(card->pdev)); 203 pci_name(card->pdev));
203 else { 204 else {
204 struct sk_buff *skb = card->rx_skbs[card->rx_in]; 205 struct sk_buff *skb = card->rx_skbs[card->rx_in];
205 port_t *port = &card->ports[desc->stat & 206 port_t *port = &card->ports[desc->stat &
@@ -397,7 +398,7 @@ static int wanxl_open(struct net_device *dev)
397 int i; 398 int i;
398 399
399 if (get_status(port)->open) { 400 if (get_status(port)->open) {
400 printk(KERN_ERR "%s: port already open\n", dev->name); 401 netdev_err(dev, "port already open\n");
401 return -EIO; 402 return -EIO;
402 } 403 }
403 if ((i = hdlc_open(dev)) != 0) 404 if ((i = hdlc_open(dev)) != 0)
@@ -417,7 +418,7 @@ static int wanxl_open(struct net_device *dev)
417 } 418 }
418 } while (time_after(timeout, jiffies)); 419 } while (time_after(timeout, jiffies));
419 420
420 printk(KERN_ERR "%s: unable to open port\n", dev->name); 421 netdev_err(dev, "unable to open port\n");
421 /* ask the card to close the port, should it be still alive */ 422 /* ask the card to close the port, should it be still alive */
422 writel(1 << (DOORBELL_TO_CARD_CLOSE_0 + port->node), dbr); 423 writel(1 << (DOORBELL_TO_CARD_CLOSE_0 + port->node), dbr);
423 return -EFAULT; 424 return -EFAULT;
@@ -443,7 +444,7 @@ static int wanxl_close(struct net_device *dev)
443 } while (time_after(timeout, jiffies)); 444 } while (time_after(timeout, jiffies));
444 445
445 if (get_status(port)->open) 446 if (get_status(port)->open)
446 printk(KERN_ERR "%s: unable to close port\n", dev->name); 447 netdev_err(dev, "unable to close port\n");
447 448
448 netif_stop_queue(dev); 449 netif_stop_queue(dev);
449 450
@@ -568,11 +569,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
568 int i, ports, alloc_size; 569 int i, ports, alloc_size;
569 570
570#ifndef MODULE 571#ifndef MODULE
571 static int printed_version; 572 pr_info_once("%s\n", version);
572 if (!printed_version) {
573 printed_version++;
574 printk(KERN_INFO "%s\n", version);
575 }
576#endif 573#endif
577 574
578 i = pci_enable_device(pdev); 575 i = pci_enable_device(pdev);
@@ -588,7 +585,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
588 work on most platforms */ 585 work on most platforms */
589 if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(28)) || 586 if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(28)) ||
590 pci_set_dma_mask(pdev, DMA_BIT_MASK(28))) { 587 pci_set_dma_mask(pdev, DMA_BIT_MASK(28))) {
591 printk(KERN_ERR "wanXL: No usable DMA configuration\n"); 588 pr_err("No usable DMA configuration\n");
592 return -EIO; 589 return -EIO;
593 } 590 }
594 591
@@ -607,8 +604,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
607 alloc_size = sizeof(card_t) + ports * sizeof(port_t); 604 alloc_size = sizeof(card_t) + ports * sizeof(port_t);
608 card = kzalloc(alloc_size, GFP_KERNEL); 605 card = kzalloc(alloc_size, GFP_KERNEL);
609 if (card == NULL) { 606 if (card == NULL) {
610 printk(KERN_ERR "wanXL %s: unable to allocate memory\n", 607 pr_err("%s: unable to allocate memory\n", pci_name(pdev));
611 pci_name(pdev));
612 pci_release_regions(pdev); 608 pci_release_regions(pdev);
613 pci_disable_device(pdev); 609 pci_disable_device(pdev);
614 return -ENOBUFS; 610 return -ENOBUFS;
@@ -635,7 +631,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
635 to indicate the card can do 32-bit DMA addressing */ 631 to indicate the card can do 32-bit DMA addressing */
636 if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) || 632 if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)) ||
637 pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { 633 pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
638 printk(KERN_ERR "wanXL: No usable DMA configuration\n"); 634 pr_err("No usable DMA configuration\n");
639 wanxl_pci_remove_one(pdev); 635 wanxl_pci_remove_one(pdev);
640 return -EIO; 636 return -EIO;
641 } 637 }
@@ -645,7 +641,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
645 641
646 card->plx = ioremap_nocache(plx_phy, 0x70); 642 card->plx = ioremap_nocache(plx_phy, 0x70);
647 if (!card->plx) { 643 if (!card->plx) {
648 printk(KERN_ERR "wanxl: ioremap() failed\n"); 644 pr_err("ioremap() failed\n");
649 wanxl_pci_remove_one(pdev); 645 wanxl_pci_remove_one(pdev);
650 return -EFAULT; 646 return -EFAULT;
651 } 647 }
@@ -657,8 +653,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
657 timeout = jiffies + 20 * HZ; 653 timeout = jiffies + 20 * HZ;
658 while ((stat = readl(card->plx + PLX_MAILBOX_0)) != 0) { 654 while ((stat = readl(card->plx + PLX_MAILBOX_0)) != 0) {
659 if (time_before(timeout, jiffies)) { 655 if (time_before(timeout, jiffies)) {
660 printk(KERN_WARNING "wanXL %s: timeout waiting for" 656 pr_warn("%s: timeout waiting for PUTS to complete\n",
661 " PUTS to complete\n", pci_name(pdev)); 657 pci_name(pdev));
662 wanxl_pci_remove_one(pdev); 658 wanxl_pci_remove_one(pdev);
663 return -ENODEV; 659 return -ENODEV;
664 } 660 }
@@ -669,8 +665,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
669 break; 665 break;
670 666
671 default: 667 default:
672 printk(KERN_WARNING "wanXL %s: PUTS test 0x%X" 668 pr_warn("%s: PUTS test 0x%X failed\n",
673 " failed\n", pci_name(pdev), stat & 0x30); 669 pci_name(pdev), stat & 0x30);
674 wanxl_pci_remove_one(pdev); 670 wanxl_pci_remove_one(pdev);
675 return -ENODEV; 671 return -ENODEV;
676 } 672 }
@@ -688,17 +684,16 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
688 /* sanity check the board's reported memory size */ 684 /* sanity check the board's reported memory size */
689 if (ramsize < BUFFERS_ADDR + 685 if (ramsize < BUFFERS_ADDR +
690 (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports) { 686 (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports) {
691 printk(KERN_WARNING "wanXL %s: no enough on-board RAM" 687 pr_warn("%s: no enough on-board RAM (%u bytes detected, %u bytes required)\n",
692 " (%u bytes detected, %u bytes required)\n", 688 pci_name(pdev), ramsize,
693 pci_name(pdev), ramsize, BUFFERS_ADDR + 689 BUFFERS_ADDR +
694 (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports); 690 (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports);
695 wanxl_pci_remove_one(pdev); 691 wanxl_pci_remove_one(pdev);
696 return -ENODEV; 692 return -ENODEV;
697 } 693 }
698 694
699 if (wanxl_puts_command(card, MBX1_CMD_BSWAP)) { 695 if (wanxl_puts_command(card, MBX1_CMD_BSWAP)) {
700 printk(KERN_WARNING "wanXL %s: unable to Set Byte Swap" 696 pr_warn("%s: unable to Set Byte Swap Mode\n", pci_name(pdev));
701 " Mode\n", pci_name(pdev));
702 wanxl_pci_remove_one(pdev); 697 wanxl_pci_remove_one(pdev);
703 return -ENODEV; 698 return -ENODEV;
704 } 699 }
@@ -715,7 +710,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
715 710
716 mem = ioremap_nocache(mem_phy, PDM_OFFSET + sizeof(firmware)); 711 mem = ioremap_nocache(mem_phy, PDM_OFFSET + sizeof(firmware));
717 if (!mem) { 712 if (!mem) {
718 printk(KERN_ERR "wanxl: ioremap() failed\n"); 713 pr_err("ioremap() failed\n");
719 wanxl_pci_remove_one(pdev); 714 wanxl_pci_remove_one(pdev);
720 return -EFAULT; 715 return -EFAULT;
721 } 716 }
@@ -734,8 +729,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
734 writel(0, card->plx + PLX_MAILBOX_5); 729 writel(0, card->plx + PLX_MAILBOX_5);
735 730
736 if (wanxl_puts_command(card, MBX1_CMD_ABORTJ)) { 731 if (wanxl_puts_command(card, MBX1_CMD_ABORTJ)) {
737 printk(KERN_WARNING "wanXL %s: unable to Abort and Jump\n", 732 pr_warn("%s: unable to Abort and Jump\n", pci_name(pdev));
738 pci_name(pdev));
739 wanxl_pci_remove_one(pdev); 733 wanxl_pci_remove_one(pdev);
740 return -ENODEV; 734 return -ENODEV;
741 } 735 }
@@ -749,8 +743,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
749 }while (time_after(timeout, jiffies)); 743 }while (time_after(timeout, jiffies));
750 744
751 if (!stat) { 745 if (!stat) {
752 printk(KERN_WARNING "wanXL %s: timeout while initializing card " 746 pr_warn("%s: timeout while initializing card firmware\n",
753 "firmware\n", pci_name(pdev)); 747 pci_name(pdev));
754 wanxl_pci_remove_one(pdev); 748 wanxl_pci_remove_one(pdev);
755 return -ENODEV; 749 return -ENODEV;
756 } 750 }
@@ -759,13 +753,13 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
759 ramsize = stat; 753 ramsize = stat;
760#endif 754#endif
761 755
762 printk(KERN_INFO "wanXL %s: at 0x%X, %u KB of RAM at 0x%X, irq %u\n", 756 pr_info("%s: at 0x%X, %u KB of RAM at 0x%X, irq %u\n",
763 pci_name(pdev), plx_phy, ramsize / 1024, mem_phy, pdev->irq); 757 pci_name(pdev), plx_phy, ramsize / 1024, mem_phy, pdev->irq);
764 758
765 /* Allocate IRQ */ 759 /* Allocate IRQ */
766 if (request_irq(pdev->irq, wanxl_intr, IRQF_SHARED, "wanXL", card)) { 760 if (request_irq(pdev->irq, wanxl_intr, IRQF_SHARED, "wanXL", card)) {
767 printk(KERN_WARNING "wanXL %s: could not allocate IRQ%i.\n", 761 pr_warn("%s: could not allocate IRQ%i\n",
768 pci_name(pdev), pdev->irq); 762 pci_name(pdev), pdev->irq);
769 wanxl_pci_remove_one(pdev); 763 wanxl_pci_remove_one(pdev);
770 return -EBUSY; 764 return -EBUSY;
771 } 765 }
@@ -776,8 +770,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
776 port_t *port = &card->ports[i]; 770 port_t *port = &card->ports[i];
777 struct net_device *dev = alloc_hdlcdev(port); 771 struct net_device *dev = alloc_hdlcdev(port);
778 if (!dev) { 772 if (!dev) {
779 printk(KERN_ERR "wanXL %s: unable to allocate" 773 pr_err("%s: unable to allocate memory\n",
780 " memory\n", pci_name(pdev)); 774 pci_name(pdev));
781 wanxl_pci_remove_one(pdev); 775 wanxl_pci_remove_one(pdev);
782 return -ENOMEM; 776 return -ENOMEM;
783 } 777 }
@@ -793,8 +787,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
793 port->node = i; 787 port->node = i;
794 get_status(port)->clocking = CLOCK_EXT; 788 get_status(port)->clocking = CLOCK_EXT;
795 if (register_hdlc_device(dev)) { 789 if (register_hdlc_device(dev)) {
796 printk(KERN_ERR "wanXL %s: unable to register hdlc" 790 pr_err("%s: unable to register hdlc device\n",
797 " device\n", pci_name(pdev)); 791 pci_name(pdev));
798 free_netdev(dev); 792 free_netdev(dev);
799 wanxl_pci_remove_one(pdev); 793 wanxl_pci_remove_one(pdev);
800 return -ENOBUFS; 794 return -ENOBUFS;
@@ -802,11 +796,11 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
802 card->n_ports++; 796 card->n_ports++;
803 } 797 }
804 798
805 printk(KERN_INFO "wanXL %s: port", pci_name(pdev)); 799 pr_info("%s: port", pci_name(pdev));
806 for (i = 0; i < ports; i++) 800 for (i = 0; i < ports; i++)
807 printk("%s #%i: %s", i ? "," : "", i, 801 pr_cont("%s #%i: %s",
808 card->ports[i].dev->name); 802 i ? "," : "", i, card->ports[i].dev->name);
809 printk("\n"); 803 pr_cont("\n");
810 804
811 for (i = 0; i < ports; i++) 805 for (i = 0; i < ports; i++)
812 wanxl_cable_intr(&card->ports[i]); /* get carrier status etc.*/ 806 wanxl_cable_intr(&card->ports[i]); /* get carrier status etc.*/
@@ -836,7 +830,7 @@ static struct pci_driver wanxl_pci_driver = {
836static int __init wanxl_init_module(void) 830static int __init wanxl_init_module(void)
837{ 831{
838#ifdef MODULE 832#ifdef MODULE
839 printk(KERN_INFO "%s\n", version); 833 pr_info("%s\n", version);
840#endif 834#endif
841 return pci_register_driver(&wanxl_pci_driver); 835 return pci_register_driver(&wanxl_pci_driver);
842} 836}