diff options
author | Joe Perches <joe@perches.com> | 2010-08-02 19:01:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-02 19:01:35 -0400 |
commit | 3f326d40994f922e0a3e468dd7fd9999eaf71574 (patch) | |
tree | 8cb01880e24fdc59caed2823f011519a79d3ec56 /drivers/net/wan | |
parent | 4fc6eb7d35a28d808ff6c77fa36e637e334dceac (diff) |
drivers/net/wan/farsync.c: Use standard pr_<level>
Remove locally defined equivalents
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wan')
-rw-r--r-- | drivers/net/wan/farsync.c | 111 |
1 files changed, 53 insertions, 58 deletions
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 43b77271532b..ad7719fe6d0a 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -15,6 +15,8 @@ | |||
15 | * Maintainer: Kevin Curtis <kevin.curtis@farsite.co.uk> | 15 | * Maintainer: Kevin Curtis <kevin.curtis@farsite.co.uk> |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
19 | |||
18 | #include <linux/module.h> | 20 | #include <linux/module.h> |
19 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
20 | #include <linux/version.h> | 22 | #include <linux/version.h> |
@@ -511,21 +513,19 @@ static int fst_debug_mask = { FST_DEBUG }; | |||
511 | * support variable numbers of macro parameters. The inverted if prevents us | 513 | * support variable numbers of macro parameters. The inverted if prevents us |
512 | * eating someone else's else clause. | 514 | * eating someone else's else clause. |
513 | */ | 515 | */ |
514 | #define dbg(F,fmt,A...) if ( ! ( fst_debug_mask & (F))) \ | 516 | #define dbg(F, fmt, args...) \ |
515 | ; \ | 517 | do { \ |
516 | else \ | 518 | if (fst_debug_mask & (F)) \ |
517 | printk ( KERN_DEBUG FST_NAME ": " fmt, ## A ) | 519 | printk(KERN_DEBUG pr_fmt(fmt), ##args); \ |
518 | 520 | } while (0) | |
519 | #else | 521 | #else |
520 | #define dbg(X...) /* NOP */ | 522 | #define dbg(F, fmt, args...) \ |
523 | do { \ | ||
524 | if (0) \ | ||
525 | printk(KERN_DEBUG pr_fmt(fmt), ##args); \ | ||
526 | } while (0) | ||
521 | #endif | 527 | #endif |
522 | 528 | ||
523 | /* Printing short cuts | ||
524 | */ | ||
525 | #define printk_err(fmt,A...) printk ( KERN_ERR FST_NAME ": " fmt, ## A ) | ||
526 | #define printk_warn(fmt,A...) printk ( KERN_WARNING FST_NAME ": " fmt, ## A ) | ||
527 | #define printk_info(fmt,A...) printk ( KERN_INFO FST_NAME ": " fmt, ## A ) | ||
528 | |||
529 | /* | 529 | /* |
530 | * PCI ID lookup table | 530 | * PCI ID lookup table |
531 | */ | 531 | */ |
@@ -961,7 +961,7 @@ fst_issue_cmd(struct fst_port_info *port, unsigned short cmd) | |||
961 | spin_lock_irqsave(&card->card_lock, flags); | 961 | spin_lock_irqsave(&card->card_lock, flags); |
962 | 962 | ||
963 | if (++safety > 2000) { | 963 | if (++safety > 2000) { |
964 | printk_err("Mailbox safety timeout\n"); | 964 | pr_err("Mailbox safety timeout\n"); |
965 | break; | 965 | break; |
966 | } | 966 | } |
967 | 967 | ||
@@ -1241,8 +1241,8 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port) | |||
1241 | * This seems to happen on the TE1 interface sometimes | 1241 | * This seems to happen on the TE1 interface sometimes |
1242 | * so throw the frame away and log the event. | 1242 | * so throw the frame away and log the event. |
1243 | */ | 1243 | */ |
1244 | printk_err("Frame received with 0 length. Card %d Port %d\n", | 1244 | pr_err("Frame received with 0 length. Card %d Port %d\n", |
1245 | card->card_no, port->index); | 1245 | card->card_no, port->index); |
1246 | /* Return descriptor to card */ | 1246 | /* Return descriptor to card */ |
1247 | FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); | 1247 | FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); |
1248 | 1248 | ||
@@ -1486,9 +1486,8 @@ fst_intr(int dummy, void *dev_id) | |||
1486 | */ | 1486 | */ |
1487 | dbg(DBG_INTR, "intr: %d %p\n", card->irq, card); | 1487 | dbg(DBG_INTR, "intr: %d %p\n", card->irq, card); |
1488 | if (card->state != FST_RUNNING) { | 1488 | if (card->state != FST_RUNNING) { |
1489 | printk_err | 1489 | pr_err("Interrupt received for card %d in a non running state (%d)\n", |
1490 | ("Interrupt received for card %d in a non running state (%d)\n", | 1490 | card->card_no, card->state); |
1491 | card->card_no, card->state); | ||
1492 | 1491 | ||
1493 | /* | 1492 | /* |
1494 | * It is possible to really be running, i.e. we have re-loaded | 1493 | * It is possible to really be running, i.e. we have re-loaded |
@@ -1614,8 +1613,7 @@ fst_intr(int dummy, void *dev_id) | |||
1614 | break; | 1613 | break; |
1615 | 1614 | ||
1616 | default: | 1615 | default: |
1617 | printk_err("intr: unknown card event %d. ignored\n", | 1616 | pr_err("intr: unknown card event %d. ignored\n", event); |
1618 | event); | ||
1619 | break; | 1617 | break; |
1620 | } | 1618 | } |
1621 | 1619 | ||
@@ -1637,13 +1635,13 @@ check_started_ok(struct fst_card_info *card) | |||
1637 | 1635 | ||
1638 | /* Check structure version and end marker */ | 1636 | /* Check structure version and end marker */ |
1639 | if (FST_RDW(card, smcVersion) != SMC_VERSION) { | 1637 | if (FST_RDW(card, smcVersion) != SMC_VERSION) { |
1640 | printk_err("Bad shared memory version %d expected %d\n", | 1638 | pr_err("Bad shared memory version %d expected %d\n", |
1641 | FST_RDW(card, smcVersion), SMC_VERSION); | 1639 | FST_RDW(card, smcVersion), SMC_VERSION); |
1642 | card->state = FST_BADVERSION; | 1640 | card->state = FST_BADVERSION; |
1643 | return; | 1641 | return; |
1644 | } | 1642 | } |
1645 | if (FST_RDL(card, endOfSmcSignature) != END_SIG) { | 1643 | if (FST_RDL(card, endOfSmcSignature) != END_SIG) { |
1646 | printk_err("Missing shared memory signature\n"); | 1644 | pr_err("Missing shared memory signature\n"); |
1647 | card->state = FST_BADVERSION; | 1645 | card->state = FST_BADVERSION; |
1648 | return; | 1646 | return; |
1649 | } | 1647 | } |
@@ -1651,11 +1649,11 @@ check_started_ok(struct fst_card_info *card) | |||
1651 | if ((i = FST_RDB(card, taskStatus)) == 0x01) { | 1649 | if ((i = FST_RDB(card, taskStatus)) == 0x01) { |
1652 | card->state = FST_RUNNING; | 1650 | card->state = FST_RUNNING; |
1653 | } else if (i == 0xFF) { | 1651 | } else if (i == 0xFF) { |
1654 | printk_err("Firmware initialisation failed. Card halted\n"); | 1652 | pr_err("Firmware initialisation failed. Card halted\n"); |
1655 | card->state = FST_HALTED; | 1653 | card->state = FST_HALTED; |
1656 | return; | 1654 | return; |
1657 | } else if (i != 0x00) { | 1655 | } else if (i != 0x00) { |
1658 | printk_err("Unknown firmware status 0x%x\n", i); | 1656 | pr_err("Unknown firmware status 0x%x\n", i); |
1659 | card->state = FST_HALTED; | 1657 | card->state = FST_HALTED; |
1660 | return; | 1658 | return; |
1661 | } | 1659 | } |
@@ -1665,9 +1663,10 @@ check_started_ok(struct fst_card_info *card) | |||
1665 | * existing firmware etc so we just report it for the moment. | 1663 | * existing firmware etc so we just report it for the moment. |
1666 | */ | 1664 | */ |
1667 | if (FST_RDL(card, numberOfPorts) != card->nports) { | 1665 | if (FST_RDL(card, numberOfPorts) != card->nports) { |
1668 | printk_warn("Port count mismatch on card %d." | 1666 | pr_warning("Port count mismatch on card %d. " |
1669 | " Firmware thinks %d we say %d\n", card->card_no, | 1667 | "Firmware thinks %d we say %d\n", |
1670 | FST_RDL(card, numberOfPorts), card->nports); | 1668 | card->card_no, |
1669 | FST_RDL(card, numberOfPorts), card->nports); | ||
1671 | } | 1670 | } |
1672 | } | 1671 | } |
1673 | 1672 | ||
@@ -2090,9 +2089,8 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2090 | */ | 2089 | */ |
2091 | 2090 | ||
2092 | if (card->state != FST_RUNNING) { | 2091 | if (card->state != FST_RUNNING) { |
2093 | printk_err | 2092 | pr_err("Attempt to configure card %d in non-running state (%d)\n", |
2094 | ("Attempt to configure card %d in non-running state (%d)\n", | 2093 | card->card_no, card->state); |
2095 | card->card_no, card->state); | ||
2096 | return -EIO; | 2094 | return -EIO; |
2097 | } | 2095 | } |
2098 | if (copy_from_user(&info, ifr->ifr_data, sizeof (info))) { | 2096 | if (copy_from_user(&info, ifr->ifr_data, sizeof (info))) { |
@@ -2384,8 +2382,8 @@ fst_init_card(struct fst_card_info *card) | |||
2384 | err = register_hdlc_device(card->ports[i].dev); | 2382 | err = register_hdlc_device(card->ports[i].dev); |
2385 | if (err < 0) { | 2383 | if (err < 0) { |
2386 | int j; | 2384 | int j; |
2387 | printk_err ("Cannot register HDLC device for port %d" | 2385 | pr_err("Cannot register HDLC device for port %d (errno %d)\n", |
2388 | " (errno %d)\n", i, -err ); | 2386 | i, -err); |
2389 | for (j = i; j < card->nports; j++) { | 2387 | for (j = i; j < card->nports; j++) { |
2390 | free_netdev(card->ports[j].dev); | 2388 | free_netdev(card->ports[j].dev); |
2391 | card->ports[j].dev = NULL; | 2389 | card->ports[j].dev = NULL; |
@@ -2395,10 +2393,10 @@ fst_init_card(struct fst_card_info *card) | |||
2395 | } | 2393 | } |
2396 | } | 2394 | } |
2397 | 2395 | ||
2398 | printk_info("%s-%s: %s IRQ%d, %d ports\n", | 2396 | pr_info("%s-%s: %s IRQ%d, %d ports\n", |
2399 | port_to_dev(&card->ports[0])->name, | 2397 | port_to_dev(&card->ports[0])->name, |
2400 | port_to_dev(&card->ports[card->nports - 1])->name, | 2398 | port_to_dev(&card->ports[card->nports - 1])->name, |
2401 | type_strings[card->type], card->irq, card->nports); | 2399 | type_strings[card->type], card->irq, card->nports); |
2402 | } | 2400 | } |
2403 | 2401 | ||
2404 | static const struct net_device_ops fst_ops = { | 2402 | static const struct net_device_ops fst_ops = { |
@@ -2417,19 +2415,17 @@ static const struct net_device_ops fst_ops = { | |||
2417 | static int __devinit | 2415 | static int __devinit |
2418 | fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 2416 | fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
2419 | { | 2417 | { |
2420 | static int firsttime_done = 0; | ||
2421 | static int no_of_cards_added = 0; | 2418 | static int no_of_cards_added = 0; |
2422 | struct fst_card_info *card; | 2419 | struct fst_card_info *card; |
2423 | int err = 0; | 2420 | int err = 0; |
2424 | int i; | 2421 | int i; |
2425 | 2422 | ||
2426 | if (!firsttime_done) { | 2423 | printk_once(KERN_INFO |
2427 | printk_info("FarSync WAN driver " FST_USER_VERSION | 2424 | pr_fmt("FarSync WAN driver " FST_USER_VERSION |
2428 | " (c) 2001-2004 FarSite Communications Ltd.\n"); | 2425 | " (c) 2001-2004 FarSite Communications Ltd.\n")); |
2429 | firsttime_done = 1; | 2426 | #if FST_DEBUG |
2430 | dbg(DBG_ASS, "The value of debug mask is %x\n", fst_debug_mask); | 2427 | dbg(DBG_ASS, "The value of debug mask is %x\n", fst_debug_mask); |
2431 | } | 2428 | #endif |
2432 | |||
2433 | /* | 2429 | /* |
2434 | * We are going to be clever and allow certain cards not to be | 2430 | * We are going to be clever and allow certain cards not to be |
2435 | * configured. An exclude list can be provided in /etc/modules.conf | 2431 | * configured. An exclude list can be provided in /etc/modules.conf |
@@ -2441,8 +2437,8 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2441 | */ | 2437 | */ |
2442 | for (i = 0; i < fst_excluded_cards; i++) { | 2438 | for (i = 0; i < fst_excluded_cards; i++) { |
2443 | if ((pdev->devfn) >> 3 == fst_excluded_list[i]) { | 2439 | if ((pdev->devfn) >> 3 == fst_excluded_list[i]) { |
2444 | printk_info("FarSync PCI device %d not assigned\n", | 2440 | pr_info("FarSync PCI device %d not assigned\n", |
2445 | (pdev->devfn) >> 3); | 2441 | (pdev->devfn) >> 3); |
2446 | return -EBUSY; | 2442 | return -EBUSY; |
2447 | } | 2443 | } |
2448 | } | 2444 | } |
@@ -2451,20 +2447,19 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2451 | /* Allocate driver private data */ | 2447 | /* Allocate driver private data */ |
2452 | card = kzalloc(sizeof (struct fst_card_info), GFP_KERNEL); | 2448 | card = kzalloc(sizeof (struct fst_card_info), GFP_KERNEL); |
2453 | if (card == NULL) { | 2449 | if (card == NULL) { |
2454 | printk_err("FarSync card found but insufficient memory for" | 2450 | pr_err("FarSync card found but insufficient memory for driver storage\n"); |
2455 | " driver storage\n"); | ||
2456 | return -ENOMEM; | 2451 | return -ENOMEM; |
2457 | } | 2452 | } |
2458 | 2453 | ||
2459 | /* Try to enable the device */ | 2454 | /* Try to enable the device */ |
2460 | if ((err = pci_enable_device(pdev)) != 0) { | 2455 | if ((err = pci_enable_device(pdev)) != 0) { |
2461 | printk_err("Failed to enable card. Err %d\n", -err); | 2456 | pr_err("Failed to enable card. Err %d\n", -err); |
2462 | kfree(card); | 2457 | kfree(card); |
2463 | return err; | 2458 | return err; |
2464 | } | 2459 | } |
2465 | 2460 | ||
2466 | if ((err = pci_request_regions(pdev, "FarSync")) !=0) { | 2461 | if ((err = pci_request_regions(pdev, "FarSync")) !=0) { |
2467 | printk_err("Failed to allocate regions. Err %d\n", -err); | 2462 | pr_err("Failed to allocate regions. Err %d\n", -err); |
2468 | pci_disable_device(pdev); | 2463 | pci_disable_device(pdev); |
2469 | kfree(card); | 2464 | kfree(card); |
2470 | return err; | 2465 | return err; |
@@ -2475,14 +2470,14 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2475 | card->phys_mem = pci_resource_start(pdev, 2); | 2470 | card->phys_mem = pci_resource_start(pdev, 2); |
2476 | card->phys_ctlmem = pci_resource_start(pdev, 3); | 2471 | card->phys_ctlmem = pci_resource_start(pdev, 3); |
2477 | if ((card->mem = ioremap(card->phys_mem, FST_MEMSIZE)) == NULL) { | 2472 | if ((card->mem = ioremap(card->phys_mem, FST_MEMSIZE)) == NULL) { |
2478 | printk_err("Physical memory remap failed\n"); | 2473 | pr_err("Physical memory remap failed\n"); |
2479 | pci_release_regions(pdev); | 2474 | pci_release_regions(pdev); |
2480 | pci_disable_device(pdev); | 2475 | pci_disable_device(pdev); |
2481 | kfree(card); | 2476 | kfree(card); |
2482 | return -ENODEV; | 2477 | return -ENODEV; |
2483 | } | 2478 | } |
2484 | if ((card->ctlmem = ioremap(card->phys_ctlmem, 0x10)) == NULL) { | 2479 | if ((card->ctlmem = ioremap(card->phys_ctlmem, 0x10)) == NULL) { |
2485 | printk_err("Control memory remap failed\n"); | 2480 | pr_err("Control memory remap failed\n"); |
2486 | pci_release_regions(pdev); | 2481 | pci_release_regions(pdev); |
2487 | pci_disable_device(pdev); | 2482 | pci_disable_device(pdev); |
2488 | kfree(card); | 2483 | kfree(card); |
@@ -2492,7 +2487,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2492 | 2487 | ||
2493 | /* Register the interrupt handler */ | 2488 | /* Register the interrupt handler */ |
2494 | if (request_irq(pdev->irq, fst_intr, IRQF_SHARED, FST_DEV_NAME, card)) { | 2489 | if (request_irq(pdev->irq, fst_intr, IRQF_SHARED, FST_DEV_NAME, card)) { |
2495 | printk_err("Unable to register interrupt %d\n", card->irq); | 2490 | pr_err("Unable to register interrupt %d\n", card->irq); |
2496 | pci_release_regions(pdev); | 2491 | pci_release_regions(pdev); |
2497 | pci_disable_device(pdev); | 2492 | pci_disable_device(pdev); |
2498 | iounmap(card->ctlmem); | 2493 | iounmap(card->ctlmem); |
@@ -2523,7 +2518,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2523 | if (!dev) { | 2518 | if (!dev) { |
2524 | while (i--) | 2519 | while (i--) |
2525 | free_netdev(card->ports[i].dev); | 2520 | free_netdev(card->ports[i].dev); |
2526 | printk_err ("FarSync: out of memory\n"); | 2521 | pr_err("FarSync: out of memory\n"); |
2527 | free_irq(card->irq, card); | 2522 | free_irq(card->irq, card); |
2528 | pci_release_regions(pdev); | 2523 | pci_release_regions(pdev); |
2529 | pci_disable_device(pdev); | 2524 | pci_disable_device(pdev); |
@@ -2587,7 +2582,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2587 | pci_alloc_consistent(card->device, FST_MAX_MTU, | 2582 | pci_alloc_consistent(card->device, FST_MAX_MTU, |
2588 | &card->rx_dma_handle_card); | 2583 | &card->rx_dma_handle_card); |
2589 | if (card->rx_dma_handle_host == NULL) { | 2584 | if (card->rx_dma_handle_host == NULL) { |
2590 | printk_err("Could not allocate rx dma buffer\n"); | 2585 | pr_err("Could not allocate rx dma buffer\n"); |
2591 | fst_disable_intr(card); | 2586 | fst_disable_intr(card); |
2592 | pci_release_regions(pdev); | 2587 | pci_release_regions(pdev); |
2593 | pci_disable_device(pdev); | 2588 | pci_disable_device(pdev); |
@@ -2600,7 +2595,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2600 | pci_alloc_consistent(card->device, FST_MAX_MTU, | 2595 | pci_alloc_consistent(card->device, FST_MAX_MTU, |
2601 | &card->tx_dma_handle_card); | 2596 | &card->tx_dma_handle_card); |
2602 | if (card->tx_dma_handle_host == NULL) { | 2597 | if (card->tx_dma_handle_host == NULL) { |
2603 | printk_err("Could not allocate tx dma buffer\n"); | 2598 | pr_err("Could not allocate tx dma buffer\n"); |
2604 | fst_disable_intr(card); | 2599 | fst_disable_intr(card); |
2605 | pci_release_regions(pdev); | 2600 | pci_release_regions(pdev); |
2606 | pci_disable_device(pdev); | 2601 | pci_disable_device(pdev); |
@@ -2672,7 +2667,7 @@ fst_init(void) | |||
2672 | static void __exit | 2667 | static void __exit |
2673 | fst_cleanup_module(void) | 2668 | fst_cleanup_module(void) |
2674 | { | 2669 | { |
2675 | printk_info("FarSync WAN driver unloading\n"); | 2670 | pr_info("FarSync WAN driver unloading\n"); |
2676 | pci_unregister_driver(&fst_driver); | 2671 | pci_unregister_driver(&fst_driver); |
2677 | } | 2672 | } |
2678 | 2673 | ||