aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/spider_net.c
diff options
context:
space:
mode:
authorLinas Vepstas <linas@austin.ibm.com>2007-06-11 14:41:38 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-08 22:16:41 -0400
commite6311d855e100184d42c0165ab9d5215fd792c89 (patch)
treef7aea297aff2b512d862a20553ef7bb2746c4aa5 /drivers/net/spider_net.c
parent91e745aa46336087e1295d44685ee2839bbba07d (diff)
spidernet: beautify error messages
Use dev_err() to print device error messages. Signed-off-by: Linas Vepstas <linas@austin.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/spider_net.c')
-rw-r--r--drivers/net/spider_net.c64
1 files changed, 34 insertions, 30 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 7a4aa6a9f949..4c8243a7f9c1 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -434,7 +434,8 @@ spider_net_prepare_rx_descr(struct spider_net_card *card,
434 bufsize + SPIDER_NET_RXBUF_ALIGN - 1); 434 bufsize + SPIDER_NET_RXBUF_ALIGN - 1);
435 if (!descr->skb) { 435 if (!descr->skb) {
436 if (netif_msg_rx_err(card) && net_ratelimit()) 436 if (netif_msg_rx_err(card) && net_ratelimit())
437 pr_err("Not enough memory to allocate rx buffer\n"); 437 dev_err(&card->netdev->dev,
438 "Not enough memory to allocate rx buffer\n");
438 card->spider_stats.alloc_rx_skb_error++; 439 card->spider_stats.alloc_rx_skb_error++;
439 return -ENOMEM; 440 return -ENOMEM;
440 } 441 }
@@ -455,7 +456,7 @@ spider_net_prepare_rx_descr(struct spider_net_card *card,
455 dev_kfree_skb_any(descr->skb); 456 dev_kfree_skb_any(descr->skb);
456 descr->skb = NULL; 457 descr->skb = NULL;
457 if (netif_msg_rx_err(card) && net_ratelimit()) 458 if (netif_msg_rx_err(card) && net_ratelimit())
458 pr_err("Could not iommu-map rx buffer\n"); 459 dev_err(&card->netdev->dev, "Could not iommu-map rx buffer\n");
459 card->spider_stats.rx_iommu_map_error++; 460 card->spider_stats.rx_iommu_map_error++;
460 hwdescr->dmac_cmd_status = SPIDER_NET_DESCR_NOT_IN_USE; 461 hwdescr->dmac_cmd_status = SPIDER_NET_DESCR_NOT_IN_USE;
461 } else { 462 } else {
@@ -692,7 +693,7 @@ spider_net_prepare_tx_descr(struct spider_net_card *card,
692 buf = pci_map_single(card->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); 693 buf = pci_map_single(card->pdev, skb->data, skb->len, PCI_DMA_TODEVICE);
693 if (pci_dma_mapping_error(buf)) { 694 if (pci_dma_mapping_error(buf)) {
694 if (netif_msg_tx_err(card) && net_ratelimit()) 695 if (netif_msg_tx_err(card) && net_ratelimit())
695 pr_err("could not iommu-map packet (%p, %i). " 696 dev_err(&card->netdev->dev, "could not iommu-map packet (%p, %i). "
696 "Dropping packet\n", skb->data, skb->len); 697 "Dropping packet\n", skb->data, skb->len);
697 card->spider_stats.tx_iommu_map_error++; 698 card->spider_stats.tx_iommu_map_error++;
698 return -ENOMEM; 699 return -ENOMEM;
@@ -832,9 +833,8 @@ spider_net_release_tx_chain(struct spider_net_card *card, int brutal)
832 case SPIDER_NET_DESCR_PROTECTION_ERROR: 833 case SPIDER_NET_DESCR_PROTECTION_ERROR:
833 case SPIDER_NET_DESCR_FORCE_END: 834 case SPIDER_NET_DESCR_FORCE_END:
834 if (netif_msg_tx_err(card)) 835 if (netif_msg_tx_err(card))
835 pr_err("%s: forcing end of tx descriptor " 836 dev_err(&card->netdev->dev, "forcing end of tx descriptor "
836 "with status x%02x\n", 837 "with status x%02x\n", status);
837 card->netdev->name, status);
838 card->netdev_stats.tx_errors++; 838 card->netdev_stats.tx_errors++;
839 break; 839 break;
840 840
@@ -1147,8 +1147,8 @@ spider_net_decode_one_descr(struct spider_net_card *card)
1147 (status == SPIDER_NET_DESCR_PROTECTION_ERROR) || 1147 (status == SPIDER_NET_DESCR_PROTECTION_ERROR) ||
1148 (status == SPIDER_NET_DESCR_FORCE_END) ) { 1148 (status == SPIDER_NET_DESCR_FORCE_END) ) {
1149 if (netif_msg_rx_err(card)) 1149 if (netif_msg_rx_err(card))
1150 pr_err("%s: dropping RX descriptor with state %d\n", 1150 dev_err(&card->netdev->dev,
1151 card->netdev->name, status); 1151 "dropping RX descriptor with state %d\n", status);
1152 card->netdev_stats.rx_dropped++; 1152 card->netdev_stats.rx_dropped++;
1153 goto bad_desc; 1153 goto bad_desc;
1154 } 1154 }
@@ -1156,8 +1156,8 @@ spider_net_decode_one_descr(struct spider_net_card *card)
1156 if ( (status != SPIDER_NET_DESCR_COMPLETE) && 1156 if ( (status != SPIDER_NET_DESCR_COMPLETE) &&
1157 (status != SPIDER_NET_DESCR_FRAME_END) ) { 1157 (status != SPIDER_NET_DESCR_FRAME_END) ) {
1158 if (netif_msg_rx_err(card)) 1158 if (netif_msg_rx_err(card))
1159 pr_err("%s: RX descriptor with unknown state %d\n", 1159 dev_err(&card->netdev->dev,
1160 card->netdev->name, status); 1160 "RX descriptor with unknown state %d\n", status);
1161 card->spider_stats.rx_desc_unk_state++; 1161 card->spider_stats.rx_desc_unk_state++;
1162 goto bad_desc; 1162 goto bad_desc;
1163 } 1163 }
@@ -1165,16 +1165,15 @@ spider_net_decode_one_descr(struct spider_net_card *card)
1165 /* The cases we'll throw away the packet immediately */ 1165 /* The cases we'll throw away the packet immediately */
1166 if (hwdescr->data_error & SPIDER_NET_DESTROY_RX_FLAGS) { 1166 if (hwdescr->data_error & SPIDER_NET_DESTROY_RX_FLAGS) {
1167 if (netif_msg_rx_err(card)) 1167 if (netif_msg_rx_err(card))
1168 pr_err("%s: error in received descriptor found, " 1168 dev_err(&card->netdev->dev,
1169 "error in received descriptor found, "
1169 "data_status=x%08x, data_error=x%08x\n", 1170 "data_status=x%08x, data_error=x%08x\n",
1170 card->netdev->name,
1171 hwdescr->data_status, hwdescr->data_error); 1171 hwdescr->data_status, hwdescr->data_error);
1172 goto bad_desc; 1172 goto bad_desc;
1173 } 1173 }
1174 1174
1175 if (hwdescr->dmac_cmd_status & 0xfcf4) { 1175 if (hwdescr->dmac_cmd_status & 0xfcf4) {
1176 pr_err("%s: bad status, cmd_status=x%08x\n", 1176 dev_err(&card->netdev->dev, "bad status, cmd_status=x%08x\n",
1177 card->netdev->name,
1178 hwdescr->dmac_cmd_status); 1177 hwdescr->dmac_cmd_status);
1179 pr_err("buf_addr=x%08x\n", hwdescr->buf_addr); 1178 pr_err("buf_addr=x%08x\n", hwdescr->buf_addr);
1180 pr_err("buf_size=x%08x\n", hwdescr->buf_size); 1179 pr_err("buf_size=x%08x\n", hwdescr->buf_size);
@@ -1415,7 +1414,7 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg)
1415 case SPIDER_NET_GPWFFINT: 1414 case SPIDER_NET_GPWFFINT:
1416 /* PHY command queue full */ 1415 /* PHY command queue full */
1417 if (netif_msg_intr(card)) 1416 if (netif_msg_intr(card))
1418 pr_err("PHY write queue full\n"); 1417 dev_err(&card->netdev->dev, "PHY write queue full\n");
1419 show_error = 0; 1418 show_error = 0;
1420 break; 1419 break;
1421 1420
@@ -1582,9 +1581,8 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg)
1582 } 1581 }
1583 1582
1584 if ((show_error) && (netif_msg_intr(card)) && net_ratelimit()) 1583 if ((show_error) && (netif_msg_intr(card)) && net_ratelimit())
1585 pr_err("Got error interrupt on %s, GHIINT0STS = 0x%08x, " 1584 dev_err(&card->netdev->dev, "Error interrupt, GHIINT0STS = 0x%08x, "
1586 "GHIINT1STS = 0x%08x, GHIINT2STS = 0x%08x\n", 1585 "GHIINT1STS = 0x%08x, GHIINT2STS = 0x%08x\n",
1587 card->netdev->name,
1588 status_reg, error_reg1, error_reg2); 1586 status_reg, error_reg1, error_reg2);
1589 1587
1590 /* clear interrupt sources */ 1588 /* clear interrupt sources */
@@ -1849,7 +1847,8 @@ spider_net_init_firmware(struct spider_net_card *card)
1849 SPIDER_NET_FIRMWARE_NAME, &card->pdev->dev) == 0) { 1847 SPIDER_NET_FIRMWARE_NAME, &card->pdev->dev) == 0) {
1850 if ( (firmware->size != SPIDER_NET_FIRMWARE_LEN) && 1848 if ( (firmware->size != SPIDER_NET_FIRMWARE_LEN) &&
1851 netif_msg_probe(card) ) { 1849 netif_msg_probe(card) ) {
1852 pr_err("Incorrect size of spidernet firmware in " \ 1850 dev_err(&card->netdev->dev,
1851 "Incorrect size of spidernet firmware in " \
1853 "filesystem. Looking in host firmware...\n"); 1852 "filesystem. Looking in host firmware...\n");
1854 goto try_host_fw; 1853 goto try_host_fw;
1855 } 1854 }
@@ -1873,8 +1872,8 @@ try_host_fw:
1873 1872
1874 if ( (fw_size != SPIDER_NET_FIRMWARE_LEN) && 1873 if ( (fw_size != SPIDER_NET_FIRMWARE_LEN) &&
1875 netif_msg_probe(card) ) { 1874 netif_msg_probe(card) ) {
1876 pr_err("Incorrect size of spidernet firmware in " \ 1875 dev_err(&card->netdev->dev,
1877 "host firmware\n"); 1876 "Incorrect size of spidernet firmware in host firmware\n");
1878 goto done; 1877 goto done;
1879 } 1878 }
1880 1879
@@ -1884,7 +1883,8 @@ done:
1884 return err; 1883 return err;
1885out_err: 1884out_err:
1886 if (netif_msg_probe(card)) 1885 if (netif_msg_probe(card))
1887 pr_err("Couldn't find spidernet firmware in filesystem " \ 1886 dev_err(&card->netdev->dev,
1887 "Couldn't find spidernet firmware in filesystem " \
1888 "or host firmware\n"); 1888 "or host firmware\n");
1889 return err; 1889 return err;
1890} 1890}
@@ -2279,13 +2279,14 @@ spider_net_setup_netdev(struct spider_net_card *card)
2279 2279
2280 result = spider_net_set_mac(netdev, &addr); 2280 result = spider_net_set_mac(netdev, &addr);
2281 if ((result) && (netif_msg_probe(card))) 2281 if ((result) && (netif_msg_probe(card)))
2282 pr_err("Failed to set MAC address: %i\n", result); 2282 dev_err(&card->netdev->dev,
2283 "Failed to set MAC address: %i\n", result);
2283 2284
2284 result = register_netdev(netdev); 2285 result = register_netdev(netdev);
2285 if (result) { 2286 if (result) {
2286 if (netif_msg_probe(card)) 2287 if (netif_msg_probe(card))
2287 pr_err("Couldn't register net_device: %i\n", 2288 dev_err(&card->netdev->dev,
2288 result); 2289 "Couldn't register net_device: %i\n", result);
2289 return result; 2290 return result;
2290 } 2291 }
2291 2292
@@ -2363,17 +2364,19 @@ spider_net_setup_pci_dev(struct pci_dev *pdev)
2363 unsigned long mmio_start, mmio_len; 2364 unsigned long mmio_start, mmio_len;
2364 2365
2365 if (pci_enable_device(pdev)) { 2366 if (pci_enable_device(pdev)) {
2366 pr_err("Couldn't enable PCI device\n"); 2367 dev_err(&pdev->dev, "Couldn't enable PCI device\n");
2367 return NULL; 2368 return NULL;
2368 } 2369 }
2369 2370
2370 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { 2371 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
2371 pr_err("Couldn't find proper PCI device base address.\n"); 2372 dev_err(&pdev->dev,
2373 "Couldn't find proper PCI device base address.\n");
2372 goto out_disable_dev; 2374 goto out_disable_dev;
2373 } 2375 }
2374 2376
2375 if (pci_request_regions(pdev, spider_net_driver_name)) { 2377 if (pci_request_regions(pdev, spider_net_driver_name)) {
2376 pr_err("Couldn't obtain PCI resources, aborting.\n"); 2378 dev_err(&pdev->dev,
2379 "Couldn't obtain PCI resources, aborting.\n");
2377 goto out_disable_dev; 2380 goto out_disable_dev;
2378 } 2381 }
2379 2382
@@ -2381,8 +2384,8 @@ spider_net_setup_pci_dev(struct pci_dev *pdev)
2381 2384
2382 card = spider_net_alloc_card(); 2385 card = spider_net_alloc_card();
2383 if (!card) { 2386 if (!card) {
2384 pr_err("Couldn't allocate net_device structure, " 2387 dev_err(&pdev->dev,
2385 "aborting.\n"); 2388 "Couldn't allocate net_device structure, aborting.\n");
2386 goto out_release_regions; 2389 goto out_release_regions;
2387 } 2390 }
2388 card->pdev = pdev; 2391 card->pdev = pdev;
@@ -2396,7 +2399,8 @@ spider_net_setup_pci_dev(struct pci_dev *pdev)
2396 card->regs = ioremap(mmio_start, mmio_len); 2399 card->regs = ioremap(mmio_start, mmio_len);
2397 2400
2398 if (!card->regs) { 2401 if (!card->regs) {
2399 pr_err("Couldn't obtain PCI resources, aborting.\n"); 2402 dev_err(&pdev->dev,
2403 "Couldn't obtain PCI resources, aborting.\n");
2400 goto out_release_regions; 2404 goto out_release_regions;
2401 } 2405 }
2402 2406