aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/atl1/atl1_main.c
diff options
context:
space:
mode:
authorJay Cliburn <jacliburn@bellsouth.net>2007-04-29 22:42:10 -0400
committerJeff Garzik <jeff@garzik.org>2007-05-08 01:20:15 -0400
commit1e0063645ef1e89c63778fbb0417e79b7dc65b5f (patch)
treed0804c056ea4e711d8ebe75cb09473096aca8ce2 /drivers/net/atl1/atl1_main.c
parent88ca2d070c3a169611ec38f00e945a036564ca26 (diff)
atl1: use dev_printk macros
Use dev_printk macros for PCI related errors, warnings, debug and info console messages. Signed-off-by: Jay Cliburn <jacliburn@bellsouth.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/atl1/atl1_main.c')
-rw-r--r--drivers/net/atl1/atl1_main.c83
1 files changed, 37 insertions, 46 deletions
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 4b1d4d153ecf..d28f88bbdd5f 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -188,8 +188,7 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
188 size = sizeof(struct atl1_buffer) * (tpd_ring->count + rfd_ring->count); 188 size = sizeof(struct atl1_buffer) * (tpd_ring->count + rfd_ring->count);
189 tpd_ring->buffer_info = kzalloc(size, GFP_KERNEL); 189 tpd_ring->buffer_info = kzalloc(size, GFP_KERNEL);
190 if (unlikely(!tpd_ring->buffer_info)) { 190 if (unlikely(!tpd_ring->buffer_info)) {
191 printk(KERN_WARNING "%s: kzalloc failed , size = D%d\n", 191 dev_err(&pdev->dev, "kzalloc failed , size = D%d\n", size);
192 atl1_driver_name, size);
193 goto err_nomem; 192 goto err_nomem;
194 } 193 }
195 rfd_ring->buffer_info = 194 rfd_ring->buffer_info =
@@ -207,9 +206,7 @@ s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
207 ring_header->desc = pci_alloc_consistent(pdev, ring_header->size, 206 ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
208 &ring_header->dma); 207 &ring_header->dma);
209 if (unlikely(!ring_header->desc)) { 208 if (unlikely(!ring_header->desc)) {
210 printk(KERN_WARNING 209 dev_err(&pdev->dev, "pci_alloc_consistent failed\n");
211 "%s: pci_alloc_consistent failed, size = D%d\n",
212 atl1_driver_name, size);
213 goto err_nomem; 210 goto err_nomem;
214 } 211 }
215 212
@@ -373,8 +370,7 @@ static void atl1_rx_checksum(struct atl1_adapter *adapter,
373 if (rrd->err_flg & (ERR_FLAG_CRC | ERR_FLAG_TRUNC | 370 if (rrd->err_flg & (ERR_FLAG_CRC | ERR_FLAG_TRUNC |
374 ERR_FLAG_CODE | ERR_FLAG_OV)) { 371 ERR_FLAG_CODE | ERR_FLAG_OV)) {
375 adapter->hw_csum_err++; 372 adapter->hw_csum_err++;
376 printk(KERN_DEBUG "%s: rx checksum error\n", 373 dev_dbg(&adapter->pdev->dev, "rx checksum error\n");
377 atl1_driver_name);
378 return; 374 return;
379 } 375 }
380 } 376 }
@@ -393,8 +389,9 @@ static void atl1_rx_checksum(struct atl1_adapter *adapter,
393 } 389 }
394 390
395 /* IPv4, but hardware thinks its checksum is wrong */ 391 /* IPv4, but hardware thinks its checksum is wrong */
396 printk(KERN_DEBUG "%s: hw csum wrong pkt_flag:%x, err_flag:%x\n", 392 dev_dbg(&adapter->pdev->dev,
397 atl1_driver_name, rrd->pkt_flg, rrd->err_flg); 393 "hw csum wrong, pkt_flag:%x, err_flag:%x\n",
394 rrd->pkt_flg, rrd->err_flg);
398 skb->ip_summed = CHECKSUM_COMPLETE; 395 skb->ip_summed = CHECKSUM_COMPLETE;
399 skb->csum = htons(rrd->xsz.xsum_sz.rx_chksum); 396 skb->csum = htons(rrd->xsz.xsum_sz.rx_chksum);
400 adapter->hw_csum_err++; 397 adapter->hw_csum_err++;
@@ -507,14 +504,13 @@ chk_rrd:
507 /* rrd seems to be bad */ 504 /* rrd seems to be bad */
508 if (unlikely(i-- > 0)) { 505 if (unlikely(i-- > 0)) {
509 /* rrd may not be DMAed completely */ 506 /* rrd may not be DMAed completely */
510 printk(KERN_DEBUG 507 dev_dbg(&adapter->pdev->dev,
511 "%s: RRD may not be DMAed completely\n", 508 "incomplete RRD DMA transfer\n");
512 atl1_driver_name);
513 udelay(1); 509 udelay(1);
514 goto chk_rrd; 510 goto chk_rrd;
515 } 511 }
516 /* bad rrd */ 512 /* bad rrd */
517 printk(KERN_DEBUG "%s: bad RRD\n", atl1_driver_name); 513 dev_dbg(&adapter->pdev->dev, "bad RRD\n");
518 /* see if update RFD index */ 514 /* see if update RFD index */
519 if (rrd->num_buf > 1) { 515 if (rrd->num_buf > 1) {
520 u16 num_buf; 516 u16 num_buf;
@@ -685,8 +681,8 @@ static void atl1_check_for_link(struct atl1_adapter *adapter)
685 /* notify upper layer link down ASAP */ 681 /* notify upper layer link down ASAP */
686 if (!(phy_data & BMSR_LSTATUS)) { /* Link Down */ 682 if (!(phy_data & BMSR_LSTATUS)) { /* Link Down */
687 if (netif_carrier_ok(netdev)) { /* old link state: Up */ 683 if (netif_carrier_ok(netdev)) { /* old link state: Up */
688 printk(KERN_INFO "%s: %s link is down\n", 684 dev_info(&adapter->pdev->dev, "%s link is down\n",
689 atl1_driver_name, netdev->name); 685 netdev->name);
690 adapter->link_speed = SPEED_0; 686 adapter->link_speed = SPEED_0;
691 netif_carrier_off(netdev); 687 netif_carrier_off(netdev);
692 netif_stop_queue(netdev); 688 netif_stop_queue(netdev);
@@ -731,8 +727,8 @@ static irqreturn_t atl1_intr(int irq, void *data)
731 727
732 /* check if PCIE PHY Link down */ 728 /* check if PCIE PHY Link down */
733 if (status & ISR_PHY_LINKDOWN) { 729 if (status & ISR_PHY_LINKDOWN) {
734 printk(KERN_DEBUG "%s: pcie phy link down %x\n", 730 dev_dbg(&adapter->pdev->dev, "pcie phy link down %x\n",
735 atl1_driver_name, status); 731 status);
736 if (netif_running(adapter->netdev)) { /* reset MAC */ 732 if (netif_running(adapter->netdev)) { /* reset MAC */
737 iowrite32(0, adapter->hw.hw_addr + REG_IMR); 733 iowrite32(0, adapter->hw.hw_addr + REG_IMR);
738 schedule_work(&adapter->pcie_dma_to_rst_task); 734 schedule_work(&adapter->pcie_dma_to_rst_task);
@@ -742,9 +738,9 @@ static irqreturn_t atl1_intr(int irq, void *data)
742 738
743 /* check if DMA read/write error ? */ 739 /* check if DMA read/write error ? */
744 if (status & (ISR_DMAR_TO_RST | ISR_DMAW_TO_RST)) { 740 if (status & (ISR_DMAR_TO_RST | ISR_DMAW_TO_RST)) {
745 printk(KERN_DEBUG 741 dev_dbg(&adapter->pdev->dev,
746 "%s: pcie DMA r/w error (status = 0x%x)\n", 742 "pcie DMA r/w error (status = 0x%x)\n",
747 atl1_driver_name, status); 743 status);
748 iowrite32(0, adapter->hw.hw_addr + REG_IMR); 744 iowrite32(0, adapter->hw.hw_addr + REG_IMR);
749 schedule_work(&adapter->pcie_dma_to_rst_task); 745 schedule_work(&adapter->pcie_dma_to_rst_task);
750 return IRQ_HANDLED; 746 return IRQ_HANDLED;
@@ -762,14 +758,13 @@ static irqreturn_t atl1_intr(int irq, void *data)
762 758
763 /* rx exception */ 759 /* rx exception */
764 if (unlikely(status & (ISR_RXF_OV | ISR_RFD_UNRUN | 760 if (unlikely(status & (ISR_RXF_OV | ISR_RFD_UNRUN |
761 ISR_RRD_OV | ISR_HOST_RFD_UNRUN |
762 ISR_HOST_RRD_OV | ISR_CMB_RX))) {
763 if (status & (ISR_RXF_OV | ISR_RFD_UNRUN |
765 ISR_RRD_OV | ISR_HOST_RFD_UNRUN | 764 ISR_RRD_OV | ISR_HOST_RFD_UNRUN |
766 ISR_HOST_RRD_OV | ISR_CMB_RX))) { 765 ISR_HOST_RRD_OV))
767 if (status & 766 dev_dbg(&adapter->pdev->dev,
768 (ISR_RXF_OV | ISR_RFD_UNRUN | ISR_RRD_OV | 767 "rx exception, ISR = 0x%x\n", status);
769 ISR_HOST_RFD_UNRUN | ISR_HOST_RRD_OV))
770 printk(KERN_INFO
771 "%s: rx exception: status = 0x%x\n",
772 atl1_driver_name, status);
773 atl1_intr_rx(adapter); 768 atl1_intr_rx(adapter);
774 } 769 }
775 770
@@ -874,8 +869,7 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
874 atl1_read_phy_reg(hw, MII_BMSR, &phy_data); 869 atl1_read_phy_reg(hw, MII_BMSR, &phy_data);
875 if (!(phy_data & BMSR_LSTATUS)) { /* link down */ 870 if (!(phy_data & BMSR_LSTATUS)) { /* link down */
876 if (netif_carrier_ok(netdev)) { /* old link state: Up */ 871 if (netif_carrier_ok(netdev)) { /* old link state: Up */
877 printk(KERN_INFO "%s: link is down\n", 872 dev_info(&adapter->pdev->dev, "link is down\n");
878 atl1_driver_name);
879 adapter->link_speed = SPEED_0; 873 adapter->link_speed = SPEED_0;
880 netif_carrier_off(netdev); 874 netif_carrier_off(netdev);
881 netif_stop_queue(netdev); 875 netif_stop_queue(netdev);
@@ -918,11 +912,11 @@ static u32 atl1_check_link(struct atl1_adapter *adapter)
918 adapter->link_speed = speed; 912 adapter->link_speed = speed;
919 adapter->link_duplex = duplex; 913 adapter->link_duplex = duplex;
920 atl1_setup_mac_ctrl(adapter); 914 atl1_setup_mac_ctrl(adapter);
921 printk(KERN_INFO "%s: %s link is up %d Mbps %s\n", 915 dev_info(&adapter->pdev->dev,
922 atl1_driver_name, netdev->name, 916 "%s link is up %d Mbps %s\n",
923 adapter->link_speed, 917 netdev->name, adapter->link_speed,
924 adapter->link_duplex == 918 adapter->link_duplex == FULL_DUPLEX ?
925 FULL_DUPLEX ? "full duplex" : "half duplex"); 919 "full duplex" : "half duplex");
926 } 920 }
927 if (!netif_carrier_ok(netdev)) { /* Link down -> Up */ 921 if (!netif_carrier_ok(netdev)) { /* Link down -> Up */
928 netif_carrier_on(netdev); 922 netif_carrier_on(netdev);
@@ -1330,8 +1324,8 @@ static int atl1_tx_csum(struct atl1_adapter *adapter, struct sk_buff *skb,
1330 cso = skb_transport_offset(skb); 1324 cso = skb_transport_offset(skb);
1331 css = cso + skb->csum_offset; 1325 css = cso + skb->csum_offset;
1332 if (unlikely(cso & 0x1)) { 1326 if (unlikely(cso & 0x1)) {
1333 printk(KERN_DEBUG "%s: payload offset != even number\n", 1327 dev_dbg(&adapter->pdev->dev,
1334 atl1_driver_name); 1328 "payload offset not an even number\n");
1335 return -1; 1329 return -1;
1336 } 1330 }
1337 csum->csumpl |= (cso & CSUM_PARAM_PLOADOFFSET_MASK) << 1331 csum->csumpl |= (cso & CSUM_PARAM_PLOADOFFSET_MASK) <<
@@ -1579,7 +1573,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1579 if (!spin_trylock(&adapter->lock)) { 1573 if (!spin_trylock(&adapter->lock)) {
1580 /* Can't get lock - tell upper layer to requeue */ 1574 /* Can't get lock - tell upper layer to requeue */
1581 local_irq_restore(flags); 1575 local_irq_restore(flags);
1582 printk(KERN_DEBUG "%s: TX locked\n", atl1_driver_name); 1576 dev_dbg(&adapter->pdev->dev, "tx locked\n");
1583 return NETDEV_TX_LOCKED; 1577 return NETDEV_TX_LOCKED;
1584 } 1578 }
1585 1579
@@ -1587,7 +1581,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1587 /* not enough descriptors */ 1581 /* not enough descriptors */
1588 netif_stop_queue(netdev); 1582 netif_stop_queue(netdev);
1589 spin_unlock_irqrestore(&adapter->lock, flags); 1583 spin_unlock_irqrestore(&adapter->lock, flags);
1590 printk(KERN_DEBUG "%s: TX busy\n", atl1_driver_name); 1584 dev_dbg(&adapter->pdev->dev, "tx busy\n");
1591 return NETDEV_TX_BUSY; 1585 return NETDEV_TX_BUSY;
1592 } 1586 }
1593 1587
@@ -1841,8 +1835,7 @@ static int atl1_change_mtu(struct net_device *netdev, int new_mtu)
1841 1835
1842 if ((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) || 1836 if ((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) ||
1843 (max_frame > MAX_JUMBO_FRAME_SIZE)) { 1837 (max_frame > MAX_JUMBO_FRAME_SIZE)) {
1844 printk(KERN_WARNING "%s: invalid MTU setting\n", 1838 dev_warn(&adapter->pdev->dev, "invalid MTU setting\n");
1845 atl1_driver_name);
1846 return -EINVAL; 1839 return -EINVAL;
1847 } 1840 }
1848 1841
@@ -2136,9 +2129,7 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
2136 if (err) { 2129 if (err) {
2137 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK); 2130 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
2138 if (err) { 2131 if (err) {
2139 printk(KERN_DEBUG 2132 dev_err(&pdev->dev, "no usable DMA configuration\n");
2140 "%s: no usable DMA configuration, aborting\n",
2141 atl1_driver_name);
2142 goto err_dma; 2133 goto err_dma;
2143 } 2134 }
2144 pci_using_64 = false; 2135 pci_using_64 = false;
@@ -2175,7 +2166,9 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
2175 goto err_pci_iomap; 2166 goto err_pci_iomap;
2176 } 2167 }
2177 /* get device revision number */ 2168 /* get device revision number */
2178 adapter->hw.dev_rev = ioread16(adapter->hw.hw_addr + (REG_MASTER_CTRL + 2)); 2169 adapter->hw.dev_rev = ioread16(adapter->hw.hw_addr +
2170 (REG_MASTER_CTRL + 2));
2171 dev_info(&pdev->dev, "version %s\n", DRIVER_VERSION);
2179 2172
2180 /* set default ring resource counts */ 2173 /* set default ring resource counts */
2181 adapter->rfd_ring.count = adapter->rrd_ring.count = ATL1_DEFAULT_RFD; 2174 adapter->rfd_ring.count = adapter->rrd_ring.count = ATL1_DEFAULT_RFD;
@@ -2466,8 +2459,6 @@ static void __exit atl1_exit_module(void)
2466 */ 2459 */
2467static int __init atl1_init_module(void) 2460static int __init atl1_init_module(void)
2468{ 2461{
2469 printk(KERN_INFO "%s - version %s\n", atl1_driver_string, DRIVER_VERSION);
2470 printk(KERN_INFO "%s\n", atl1_copyright);
2471 return pci_register_driver(&atl1_driver); 2462 return pci_register_driver(&atl1_driver);
2472} 2463}
2473 2464