diff options
author | Joe Perches <joe@perches.com> | 2010-02-21 12:08:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-22 18:45:49 -0500 |
commit | 0bc88e4af07621bc4b84477374745d01a470e85d (patch) | |
tree | caab26fa939f68f49acc9c086b37c5dac9381ae1 /drivers/net/typhoon.c | |
parent | 53639207c032ec63dac3661af94447f9774cd40b (diff) |
drivers/net/typhoon.c: Use (pr|netdev)_<level> macro helpers
David Dillow took my suggestions and improved on them.
Here is this latest version.
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Remove #define PFX
Remove #define ERR_PFX
Remove now unused member name from struct typhoon
Use pr_<level>
Use netdev_<level>
Coalesce long formats
Remove version information
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David Dillow <dave@thedillows.org>
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: David Dillow <dave@thedillows.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/typhoon.c')
-rw-r--r-- | drivers/net/typhoon.c | 243 |
1 files changed, 96 insertions, 147 deletions
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index edabc49a49bc..38c216132ef5 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -98,14 +98,10 @@ static const int multicast_filter_limit = 32; | |||
98 | #define TX_TIMEOUT (2*HZ) | 98 | #define TX_TIMEOUT (2*HZ) |
99 | 99 | ||
100 | #define PKT_BUF_SZ 1536 | 100 | #define PKT_BUF_SZ 1536 |
101 | |||
102 | #define DRV_MODULE_NAME "typhoon" | ||
103 | #define DRV_MODULE_VERSION "1.5.9" | ||
104 | #define DRV_MODULE_RELDATE "Mar 2, 2009" | ||
105 | #define PFX DRV_MODULE_NAME ": " | ||
106 | #define ERR_PFX KERN_ERR PFX | ||
107 | #define FIRMWARE_NAME "3com/typhoon.bin" | 101 | #define FIRMWARE_NAME "3com/typhoon.bin" |
108 | 102 | ||
103 | #define pr_fmt(fmt) KBUILD_MODNAME " " fmt | ||
104 | |||
109 | #include <linux/module.h> | 105 | #include <linux/module.h> |
110 | #include <linux/kernel.h> | 106 | #include <linux/kernel.h> |
111 | #include <linux/sched.h> | 107 | #include <linux/sched.h> |
@@ -132,14 +128,12 @@ static const int multicast_filter_limit = 32; | |||
132 | #include <linux/in6.h> | 128 | #include <linux/in6.h> |
133 | #include <linux/dma-mapping.h> | 129 | #include <linux/dma-mapping.h> |
134 | #include <linux/firmware.h> | 130 | #include <linux/firmware.h> |
131 | #include <generated/utsrelease.h> | ||
135 | 132 | ||
136 | #include "typhoon.h" | 133 | #include "typhoon.h" |
137 | 134 | ||
138 | static char version[] __devinitdata = | ||
139 | "typhoon.c: version " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | ||
140 | |||
141 | MODULE_AUTHOR("David Dillow <dave@thedillows.org>"); | 135 | MODULE_AUTHOR("David Dillow <dave@thedillows.org>"); |
142 | MODULE_VERSION(DRV_MODULE_VERSION); | 136 | MODULE_VERSION(UTS_RELEASE); |
143 | MODULE_LICENSE("GPL"); | 137 | MODULE_LICENSE("GPL"); |
144 | MODULE_FIRMWARE(FIRMWARE_NAME); | 138 | MODULE_FIRMWARE(FIRMWARE_NAME); |
145 | MODULE_DESCRIPTION("3Com Typhoon Family (3C990, 3CR990, and variants)"); | 139 | MODULE_DESCRIPTION("3Com Typhoon Family (3C990, 3CR990, and variants)"); |
@@ -161,8 +155,8 @@ module_param(use_mmio, int, 0); | |||
161 | #endif | 155 | #endif |
162 | 156 | ||
163 | struct typhoon_card_info { | 157 | struct typhoon_card_info { |
164 | char *name; | 158 | const char *name; |
165 | int capabilities; | 159 | const int capabilities; |
166 | }; | 160 | }; |
167 | 161 | ||
168 | #define TYPHOON_CRYPTO_NONE 0x00 | 162 | #define TYPHOON_CRYPTO_NONE 0x00 |
@@ -299,7 +293,6 @@ struct typhoon { | |||
299 | struct basic_ring respRing; | 293 | struct basic_ring respRing; |
300 | struct net_device_stats stats; | 294 | struct net_device_stats stats; |
301 | struct net_device_stats stats_saved; | 295 | struct net_device_stats stats_saved; |
302 | const char * name; | ||
303 | struct typhoon_shared * shared; | 296 | struct typhoon_shared * shared; |
304 | dma_addr_t shared_dma; | 297 | dma_addr_t shared_dma; |
305 | __le16 xcvr_select; | 298 | __le16 xcvr_select; |
@@ -534,13 +527,13 @@ typhoon_process_response(struct typhoon *tp, int resp_size, | |||
534 | } else if(resp->cmd == TYPHOON_CMD_HELLO_RESP) { | 527 | } else if(resp->cmd == TYPHOON_CMD_HELLO_RESP) { |
535 | typhoon_hello(tp); | 528 | typhoon_hello(tp); |
536 | } else { | 529 | } else { |
537 | printk(KERN_ERR "%s: dumping unexpected response " | 530 | netdev_err(tp->dev, |
538 | "0x%04x:%d:0x%02x:0x%04x:%08x:%08x\n", | 531 | "dumping unexpected response 0x%04x:%d:0x%02x:0x%04x:%08x:%08x\n", |
539 | tp->name, le16_to_cpu(resp->cmd), | 532 | le16_to_cpu(resp->cmd), |
540 | resp->numDesc, resp->flags, | 533 | resp->numDesc, resp->flags, |
541 | le16_to_cpu(resp->parm1), | 534 | le16_to_cpu(resp->parm1), |
542 | le32_to_cpu(resp->parm2), | 535 | le32_to_cpu(resp->parm2), |
543 | le32_to_cpu(resp->parm3)); | 536 | le32_to_cpu(resp->parm3)); |
544 | } | 537 | } |
545 | 538 | ||
546 | cleanup: | 539 | cleanup: |
@@ -606,9 +599,8 @@ typhoon_issue_command(struct typhoon *tp, int num_cmd, struct cmd_desc *cmd, | |||
606 | freeResp = typhoon_num_free_resp(tp); | 599 | freeResp = typhoon_num_free_resp(tp); |
607 | 600 | ||
608 | if(freeCmd < num_cmd || freeResp < num_resp) { | 601 | if(freeCmd < num_cmd || freeResp < num_resp) { |
609 | printk("%s: no descs for cmd, had (needed) %d (%d) cmd, " | 602 | netdev_err(tp->dev, "no descs for cmd, had (needed) %d (%d) cmd, %d (%d) resp\n", |
610 | "%d (%d) resp\n", tp->name, freeCmd, num_cmd, | 603 | freeCmd, num_cmd, freeResp, num_resp); |
611 | freeResp, num_resp); | ||
612 | err = -ENOMEM; | 604 | err = -ENOMEM; |
613 | goto out; | 605 | goto out; |
614 | } | 606 | } |
@@ -733,7 +725,7 @@ typhoon_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) | |||
733 | spin_unlock_bh(&tp->state_lock); | 725 | spin_unlock_bh(&tp->state_lock); |
734 | err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); | 726 | err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); |
735 | if(err < 0) | 727 | if(err < 0) |
736 | printk("%s: vlan offload error %d\n", tp->name, -err); | 728 | netdev_err(tp->dev, "vlan offload error %d\n", -err); |
737 | spin_lock_bh(&tp->state_lock); | 729 | spin_lock_bh(&tp->state_lock); |
738 | } | 730 | } |
739 | 731 | ||
@@ -1021,7 +1013,7 @@ typhoon_get_stats(struct net_device *dev) | |||
1021 | return saved; | 1013 | return saved; |
1022 | 1014 | ||
1023 | if(typhoon_do_get_stats(tp) < 0) { | 1015 | if(typhoon_do_get_stats(tp) < 0) { |
1024 | printk(KERN_ERR "%s: error getting stats\n", dev->name); | 1016 | netdev_err(dev, "error getting stats\n"); |
1025 | return saved; | 1017 | return saved; |
1026 | } | 1018 | } |
1027 | 1019 | ||
@@ -1063,8 +1055,8 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
1063 | } | 1055 | } |
1064 | } | 1056 | } |
1065 | 1057 | ||
1066 | strcpy(info->driver, DRV_MODULE_NAME); | 1058 | strcpy(info->driver, KBUILD_MODNAME); |
1067 | strcpy(info->version, DRV_MODULE_VERSION); | 1059 | strcpy(info->version, UTS_RELEASE); |
1068 | strcpy(info->bus_info, pci_name(pci_dev)); | 1060 | strcpy(info->bus_info, pci_name(pci_dev)); |
1069 | } | 1061 | } |
1070 | 1062 | ||
@@ -1366,8 +1358,8 @@ typhoon_request_firmware(struct typhoon *tp) | |||
1366 | 1358 | ||
1367 | err = request_firmware(&typhoon_fw, FIRMWARE_NAME, &tp->pdev->dev); | 1359 | err = request_firmware(&typhoon_fw, FIRMWARE_NAME, &tp->pdev->dev); |
1368 | if (err) { | 1360 | if (err) { |
1369 | printk(KERN_ERR "%s: Failed to load firmware \"%s\"\n", | 1361 | netdev_err(tp->dev, "Failed to load firmware \"%s\"\n", |
1370 | tp->name, FIRMWARE_NAME); | 1362 | FIRMWARE_NAME); |
1371 | return err; | 1363 | return err; |
1372 | } | 1364 | } |
1373 | 1365 | ||
@@ -1402,7 +1394,7 @@ typhoon_request_firmware(struct typhoon *tp) | |||
1402 | return 0; | 1394 | return 0; |
1403 | 1395 | ||
1404 | invalid_fw: | 1396 | invalid_fw: |
1405 | printk(KERN_ERR "%s: Invalid firmware image\n", tp->name); | 1397 | netdev_err(tp->dev, "Invalid firmware image\n"); |
1406 | release_firmware(typhoon_fw); | 1398 | release_firmware(typhoon_fw); |
1407 | typhoon_fw = NULL; | 1399 | typhoon_fw = NULL; |
1408 | return -EINVAL; | 1400 | return -EINVAL; |
@@ -1439,7 +1431,7 @@ typhoon_download_firmware(struct typhoon *tp) | |||
1439 | err = -ENOMEM; | 1431 | err = -ENOMEM; |
1440 | dpage = pci_alloc_consistent(pdev, PAGE_SIZE, &dpage_dma); | 1432 | dpage = pci_alloc_consistent(pdev, PAGE_SIZE, &dpage_dma); |
1441 | if(!dpage) { | 1433 | if(!dpage) { |
1442 | printk(KERN_ERR "%s: no DMA mem for firmware\n", tp->name); | 1434 | netdev_err(tp->dev, "no DMA mem for firmware\n"); |
1443 | goto err_out; | 1435 | goto err_out; |
1444 | } | 1436 | } |
1445 | 1437 | ||
@@ -1452,7 +1444,7 @@ typhoon_download_firmware(struct typhoon *tp) | |||
1452 | 1444 | ||
1453 | err = -ETIMEDOUT; | 1445 | err = -ETIMEDOUT; |
1454 | if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) { | 1446 | if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) { |
1455 | printk(KERN_ERR "%s: card ready timeout\n", tp->name); | 1447 | netdev_err(tp->dev, "card ready timeout\n"); |
1456 | goto err_out_irq; | 1448 | goto err_out_irq; |
1457 | } | 1449 | } |
1458 | 1450 | ||
@@ -1492,8 +1484,7 @@ typhoon_download_firmware(struct typhoon *tp) | |||
1492 | if(typhoon_wait_interrupt(ioaddr) < 0 || | 1484 | if(typhoon_wait_interrupt(ioaddr) < 0 || |
1493 | ioread32(ioaddr + TYPHOON_REG_STATUS) != | 1485 | ioread32(ioaddr + TYPHOON_REG_STATUS) != |
1494 | TYPHOON_STATUS_WAITING_FOR_SEGMENT) { | 1486 | TYPHOON_STATUS_WAITING_FOR_SEGMENT) { |
1495 | printk(KERN_ERR "%s: segment ready timeout\n", | 1487 | netdev_err(tp->dev, "segment ready timeout\n"); |
1496 | tp->name); | ||
1497 | goto err_out_irq; | 1488 | goto err_out_irq; |
1498 | } | 1489 | } |
1499 | 1490 | ||
@@ -1503,8 +1494,8 @@ typhoon_download_firmware(struct typhoon *tp) | |||
1503 | * the checksum, we can do this once, at the end. | 1494 | * the checksum, we can do this once, at the end. |
1504 | */ | 1495 | */ |
1505 | csum = csum_fold(csum_partial_copy_nocheck(image_data, | 1496 | csum = csum_fold(csum_partial_copy_nocheck(image_data, |
1506 | dpage, len, | 1497 | dpage, len, |
1507 | 0)); | 1498 | 0)); |
1508 | 1499 | ||
1509 | iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH); | 1500 | iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH); |
1510 | iowrite32(le16_to_cpu((__force __le16)csum), | 1501 | iowrite32(le16_to_cpu((__force __le16)csum), |
@@ -1515,7 +1506,7 @@ typhoon_download_firmware(struct typhoon *tp) | |||
1515 | iowrite32(dpage_dma, ioaddr + TYPHOON_REG_BOOT_DATA_LO); | 1506 | iowrite32(dpage_dma, ioaddr + TYPHOON_REG_BOOT_DATA_LO); |
1516 | typhoon_post_pci_writes(ioaddr); | 1507 | typhoon_post_pci_writes(ioaddr); |
1517 | iowrite32(TYPHOON_BOOTCMD_SEG_AVAILABLE, | 1508 | iowrite32(TYPHOON_BOOTCMD_SEG_AVAILABLE, |
1518 | ioaddr + TYPHOON_REG_COMMAND); | 1509 | ioaddr + TYPHOON_REG_COMMAND); |
1519 | 1510 | ||
1520 | image_data += len; | 1511 | image_data += len; |
1521 | load_addr += len; | 1512 | load_addr += len; |
@@ -1526,15 +1517,15 @@ typhoon_download_firmware(struct typhoon *tp) | |||
1526 | if(typhoon_wait_interrupt(ioaddr) < 0 || | 1517 | if(typhoon_wait_interrupt(ioaddr) < 0 || |
1527 | ioread32(ioaddr + TYPHOON_REG_STATUS) != | 1518 | ioread32(ioaddr + TYPHOON_REG_STATUS) != |
1528 | TYPHOON_STATUS_WAITING_FOR_SEGMENT) { | 1519 | TYPHOON_STATUS_WAITING_FOR_SEGMENT) { |
1529 | printk(KERN_ERR "%s: final segment ready timeout\n", tp->name); | 1520 | netdev_err(tp->dev, "final segment ready timeout\n"); |
1530 | goto err_out_irq; | 1521 | goto err_out_irq; |
1531 | } | 1522 | } |
1532 | 1523 | ||
1533 | iowrite32(TYPHOON_BOOTCMD_DNLD_COMPLETE, ioaddr + TYPHOON_REG_COMMAND); | 1524 | iowrite32(TYPHOON_BOOTCMD_DNLD_COMPLETE, ioaddr + TYPHOON_REG_COMMAND); |
1534 | 1525 | ||
1535 | if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_WAITING_FOR_BOOT) < 0) { | 1526 | if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_WAITING_FOR_BOOT) < 0) { |
1536 | printk(KERN_ERR "%s: boot ready timeout, status 0x%0x\n", | 1527 | netdev_err(tp->dev, "boot ready timeout, status 0x%0x\n", |
1537 | tp->name, ioread32(ioaddr + TYPHOON_REG_STATUS)); | 1528 | ioread32(ioaddr + TYPHOON_REG_STATUS)); |
1538 | goto err_out_irq; | 1529 | goto err_out_irq; |
1539 | } | 1530 | } |
1540 | 1531 | ||
@@ -1556,7 +1547,7 @@ typhoon_boot_3XP(struct typhoon *tp, u32 initial_status) | |||
1556 | void __iomem *ioaddr = tp->ioaddr; | 1547 | void __iomem *ioaddr = tp->ioaddr; |
1557 | 1548 | ||
1558 | if(typhoon_wait_status(ioaddr, initial_status) < 0) { | 1549 | if(typhoon_wait_status(ioaddr, initial_status) < 0) { |
1559 | printk(KERN_ERR "%s: boot ready timeout\n", tp->name); | 1550 | netdev_err(tp->dev, "boot ready timeout\n"); |
1560 | goto out_timeout; | 1551 | goto out_timeout; |
1561 | } | 1552 | } |
1562 | 1553 | ||
@@ -1567,8 +1558,8 @@ typhoon_boot_3XP(struct typhoon *tp, u32 initial_status) | |||
1567 | ioaddr + TYPHOON_REG_COMMAND); | 1558 | ioaddr + TYPHOON_REG_COMMAND); |
1568 | 1559 | ||
1569 | if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_RUNNING) < 0) { | 1560 | if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_RUNNING) < 0) { |
1570 | printk(KERN_ERR "%s: boot finish timeout (status 0x%x)\n", | 1561 | netdev_err(tp->dev, "boot finish timeout (status 0x%x)\n", |
1571 | tp->name, ioread32(ioaddr + TYPHOON_REG_STATUS)); | 1562 | ioread32(ioaddr + TYPHOON_REG_STATUS)); |
1572 | goto out_timeout; | 1563 | goto out_timeout; |
1573 | } | 1564 | } |
1574 | 1565 | ||
@@ -1867,8 +1858,7 @@ typhoon_interrupt(int irq, void *dev_instance) | |||
1867 | typhoon_post_pci_writes(ioaddr); | 1858 | typhoon_post_pci_writes(ioaddr); |
1868 | __napi_schedule(&tp->napi); | 1859 | __napi_schedule(&tp->napi); |
1869 | } else { | 1860 | } else { |
1870 | printk(KERN_ERR "%s: Error, poll already scheduled\n", | 1861 | netdev_err(dev, "Error, poll already scheduled\n"); |
1871 | dev->name); | ||
1872 | } | 1862 | } |
1873 | return IRQ_HANDLED; | 1863 | return IRQ_HANDLED; |
1874 | } | 1864 | } |
@@ -1901,16 +1891,15 @@ typhoon_sleep(struct typhoon *tp, pci_power_t state, __le16 events) | |||
1901 | xp_cmd.parm1 = events; | 1891 | xp_cmd.parm1 = events; |
1902 | err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); | 1892 | err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); |
1903 | if(err < 0) { | 1893 | if(err < 0) { |
1904 | printk(KERN_ERR "%s: typhoon_sleep(): wake events cmd err %d\n", | 1894 | netdev_err(tp->dev, "typhoon_sleep(): wake events cmd err %d\n", |
1905 | tp->name, err); | 1895 | err); |
1906 | return err; | 1896 | return err; |
1907 | } | 1897 | } |
1908 | 1898 | ||
1909 | INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_GOTO_SLEEP); | 1899 | INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_GOTO_SLEEP); |
1910 | err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); | 1900 | err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); |
1911 | if(err < 0) { | 1901 | if(err < 0) { |
1912 | printk(KERN_ERR "%s: typhoon_sleep(): sleep cmd err %d\n", | 1902 | netdev_err(tp->dev, "typhoon_sleep(): sleep cmd err %d\n", err); |
1913 | tp->name, err); | ||
1914 | return err; | 1903 | return err; |
1915 | } | 1904 | } |
1916 | 1905 | ||
@@ -1961,12 +1950,12 @@ typhoon_start_runtime(struct typhoon *tp) | |||
1961 | 1950 | ||
1962 | err = typhoon_download_firmware(tp); | 1951 | err = typhoon_download_firmware(tp); |
1963 | if(err < 0) { | 1952 | if(err < 0) { |
1964 | printk("%s: cannot load runtime on 3XP\n", tp->name); | 1953 | netdev_err(tp->dev, "cannot load runtime on 3XP\n"); |
1965 | goto error_out; | 1954 | goto error_out; |
1966 | } | 1955 | } |
1967 | 1956 | ||
1968 | if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_BOOT) < 0) { | 1957 | if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_BOOT) < 0) { |
1969 | printk("%s: cannot boot 3XP\n", tp->name); | 1958 | netdev_err(tp->dev, "cannot boot 3XP\n"); |
1970 | err = -EIO; | 1959 | err = -EIO; |
1971 | goto error_out; | 1960 | goto error_out; |
1972 | } | 1961 | } |
@@ -2070,9 +2059,7 @@ typhoon_stop_runtime(struct typhoon *tp, int wait_type) | |||
2070 | } | 2059 | } |
2071 | 2060 | ||
2072 | if(i == TYPHOON_WAIT_TIMEOUT) | 2061 | if(i == TYPHOON_WAIT_TIMEOUT) |
2073 | printk(KERN_ERR | 2062 | netdev_err(tp->dev, "halt timed out waiting for Tx to complete\n"); |
2074 | "%s: halt timed out waiting for Tx to complete\n", | ||
2075 | tp->name); | ||
2076 | 2063 | ||
2077 | INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_TX_DISABLE); | 2064 | INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_TX_DISABLE); |
2078 | typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); | 2065 | typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); |
@@ -2089,11 +2076,10 @@ typhoon_stop_runtime(struct typhoon *tp, int wait_type) | |||
2089 | typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); | 2076 | typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); |
2090 | 2077 | ||
2091 | if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_HALTED) < 0) | 2078 | if(typhoon_wait_status(ioaddr, TYPHOON_STATUS_HALTED) < 0) |
2092 | printk(KERN_ERR "%s: timed out waiting for 3XP to halt\n", | 2079 | netdev_err(tp->dev, "timed out waiting for 3XP to halt\n"); |
2093 | tp->name); | ||
2094 | 2080 | ||
2095 | if(typhoon_reset(ioaddr, wait_type) < 0) { | 2081 | if(typhoon_reset(ioaddr, wait_type) < 0) { |
2096 | printk(KERN_ERR "%s: unable to reset 3XP\n", tp->name); | 2082 | netdev_err(tp->dev, "unable to reset 3XP\n"); |
2097 | return -ETIMEDOUT; | 2083 | return -ETIMEDOUT; |
2098 | } | 2084 | } |
2099 | 2085 | ||
@@ -2112,8 +2098,7 @@ typhoon_tx_timeout(struct net_device *dev) | |||
2112 | struct typhoon *tp = netdev_priv(dev); | 2098 | struct typhoon *tp = netdev_priv(dev); |
2113 | 2099 | ||
2114 | if(typhoon_reset(tp->ioaddr, WaitNoSleep) < 0) { | 2100 | if(typhoon_reset(tp->ioaddr, WaitNoSleep) < 0) { |
2115 | printk(KERN_WARNING "%s: could not reset in tx timeout\n", | 2101 | netdev_warn(dev, "could not reset in tx timeout\n"); |
2116 | dev->name); | ||
2117 | goto truely_dead; | 2102 | goto truely_dead; |
2118 | } | 2103 | } |
2119 | 2104 | ||
@@ -2122,8 +2107,7 @@ typhoon_tx_timeout(struct net_device *dev) | |||
2122 | typhoon_free_rx_rings(tp); | 2107 | typhoon_free_rx_rings(tp); |
2123 | 2108 | ||
2124 | if(typhoon_start_runtime(tp) < 0) { | 2109 | if(typhoon_start_runtime(tp) < 0) { |
2125 | printk(KERN_ERR "%s: could not start runtime in tx timeout\n", | 2110 | netdev_err(dev, "could not start runtime in tx timeout\n"); |
2126 | dev->name); | ||
2127 | goto truely_dead; | 2111 | goto truely_dead; |
2128 | } | 2112 | } |
2129 | 2113 | ||
@@ -2148,7 +2132,7 @@ typhoon_open(struct net_device *dev) | |||
2148 | 2132 | ||
2149 | err = typhoon_wakeup(tp, WaitSleep); | 2133 | err = typhoon_wakeup(tp, WaitSleep); |
2150 | if(err < 0) { | 2134 | if(err < 0) { |
2151 | printk(KERN_ERR "%s: unable to wakeup device\n", dev->name); | 2135 | netdev_err(dev, "unable to wakeup device\n"); |
2152 | goto out_sleep; | 2136 | goto out_sleep; |
2153 | } | 2137 | } |
2154 | 2138 | ||
@@ -2173,14 +2157,13 @@ out_irq: | |||
2173 | 2157 | ||
2174 | out_sleep: | 2158 | out_sleep: |
2175 | if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) { | 2159 | if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) { |
2176 | printk(KERN_ERR "%s: unable to reboot into sleep img\n", | 2160 | netdev_err(dev, "unable to reboot into sleep img\n"); |
2177 | dev->name); | ||
2178 | typhoon_reset(tp->ioaddr, NoWait); | 2161 | typhoon_reset(tp->ioaddr, NoWait); |
2179 | goto out; | 2162 | goto out; |
2180 | } | 2163 | } |
2181 | 2164 | ||
2182 | if(typhoon_sleep(tp, PCI_D3hot, 0) < 0) | 2165 | if(typhoon_sleep(tp, PCI_D3hot, 0) < 0) |
2183 | printk(KERN_ERR "%s: unable to go back to sleep\n", dev->name); | 2166 | netdev_err(dev, "unable to go back to sleep\n"); |
2184 | 2167 | ||
2185 | out: | 2168 | out: |
2186 | return err; | 2169 | return err; |
@@ -2195,7 +2178,7 @@ typhoon_close(struct net_device *dev) | |||
2195 | napi_disable(&tp->napi); | 2178 | napi_disable(&tp->napi); |
2196 | 2179 | ||
2197 | if(typhoon_stop_runtime(tp, WaitSleep) < 0) | 2180 | if(typhoon_stop_runtime(tp, WaitSleep) < 0) |
2198 | printk(KERN_ERR "%s: unable to stop runtime\n", dev->name); | 2181 | netdev_err(dev, "unable to stop runtime\n"); |
2199 | 2182 | ||
2200 | /* Make sure there is no irq handler running on a different CPU. */ | 2183 | /* Make sure there is no irq handler running on a different CPU. */ |
2201 | free_irq(dev->irq, dev); | 2184 | free_irq(dev->irq, dev); |
@@ -2204,10 +2187,10 @@ typhoon_close(struct net_device *dev) | |||
2204 | typhoon_init_rings(tp); | 2187 | typhoon_init_rings(tp); |
2205 | 2188 | ||
2206 | if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) | 2189 | if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) |
2207 | printk(KERN_ERR "%s: unable to boot sleep image\n", dev->name); | 2190 | netdev_err(dev, "unable to boot sleep image\n"); |
2208 | 2191 | ||
2209 | if(typhoon_sleep(tp, PCI_D3hot, 0) < 0) | 2192 | if(typhoon_sleep(tp, PCI_D3hot, 0) < 0) |
2210 | printk(KERN_ERR "%s: unable to put card to sleep\n", dev->name); | 2193 | netdev_err(dev, "unable to put card to sleep\n"); |
2211 | 2194 | ||
2212 | return 0; | 2195 | return 0; |
2213 | } | 2196 | } |
@@ -2225,14 +2208,12 @@ typhoon_resume(struct pci_dev *pdev) | |||
2225 | return 0; | 2208 | return 0; |
2226 | 2209 | ||
2227 | if(typhoon_wakeup(tp, WaitNoSleep) < 0) { | 2210 | if(typhoon_wakeup(tp, WaitNoSleep) < 0) { |
2228 | printk(KERN_ERR "%s: critical: could not wake up in resume\n", | 2211 | netdev_err(dev, "critical: could not wake up in resume\n"); |
2229 | dev->name); | ||
2230 | goto reset; | 2212 | goto reset; |
2231 | } | 2213 | } |
2232 | 2214 | ||
2233 | if(typhoon_start_runtime(tp) < 0) { | 2215 | if(typhoon_start_runtime(tp) < 0) { |
2234 | printk(KERN_ERR "%s: critical: could not start runtime in " | 2216 | netdev_err(dev, "critical: could not start runtime in resume\n"); |
2235 | "resume\n", dev->name); | ||
2236 | goto reset; | 2217 | goto reset; |
2237 | } | 2218 | } |
2238 | 2219 | ||
@@ -2259,8 +2240,7 @@ typhoon_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2259 | spin_lock_bh(&tp->state_lock); | 2240 | spin_lock_bh(&tp->state_lock); |
2260 | if(tp->vlgrp && tp->wol_events & TYPHOON_WAKE_MAGIC_PKT) { | 2241 | if(tp->vlgrp && tp->wol_events & TYPHOON_WAKE_MAGIC_PKT) { |
2261 | spin_unlock_bh(&tp->state_lock); | 2242 | spin_unlock_bh(&tp->state_lock); |
2262 | printk(KERN_ERR "%s: cannot do WAKE_MAGIC with VLANS\n", | 2243 | netdev_err(dev, "cannot do WAKE_MAGIC with VLANS\n"); |
2263 | dev->name); | ||
2264 | return -EBUSY; | 2244 | return -EBUSY; |
2265 | } | 2245 | } |
2266 | spin_unlock_bh(&tp->state_lock); | 2246 | spin_unlock_bh(&tp->state_lock); |
@@ -2268,7 +2248,7 @@ typhoon_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2268 | netif_device_detach(dev); | 2248 | netif_device_detach(dev); |
2269 | 2249 | ||
2270 | if(typhoon_stop_runtime(tp, WaitNoSleep) < 0) { | 2250 | if(typhoon_stop_runtime(tp, WaitNoSleep) < 0) { |
2271 | printk(KERN_ERR "%s: unable to stop runtime\n", dev->name); | 2251 | netdev_err(dev, "unable to stop runtime\n"); |
2272 | goto need_resume; | 2252 | goto need_resume; |
2273 | } | 2253 | } |
2274 | 2254 | ||
@@ -2276,7 +2256,7 @@ typhoon_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2276 | typhoon_init_rings(tp); | 2256 | typhoon_init_rings(tp); |
2277 | 2257 | ||
2278 | if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) { | 2258 | if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) { |
2279 | printk(KERN_ERR "%s: unable to boot sleep image\n", dev->name); | 2259 | netdev_err(dev, "unable to boot sleep image\n"); |
2280 | goto need_resume; | 2260 | goto need_resume; |
2281 | } | 2261 | } |
2282 | 2262 | ||
@@ -2284,21 +2264,19 @@ typhoon_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2284 | xp_cmd.parm1 = cpu_to_le16(ntohs(*(__be16 *)&dev->dev_addr[0])); | 2264 | xp_cmd.parm1 = cpu_to_le16(ntohs(*(__be16 *)&dev->dev_addr[0])); |
2285 | xp_cmd.parm2 = cpu_to_le32(ntohl(*(__be32 *)&dev->dev_addr[2])); | 2265 | xp_cmd.parm2 = cpu_to_le32(ntohl(*(__be32 *)&dev->dev_addr[2])); |
2286 | if(typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL) < 0) { | 2266 | if(typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL) < 0) { |
2287 | printk(KERN_ERR "%s: unable to set mac address in suspend\n", | 2267 | netdev_err(dev, "unable to set mac address in suspend\n"); |
2288 | dev->name); | ||
2289 | goto need_resume; | 2268 | goto need_resume; |
2290 | } | 2269 | } |
2291 | 2270 | ||
2292 | INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_SET_RX_FILTER); | 2271 | INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_SET_RX_FILTER); |
2293 | xp_cmd.parm1 = TYPHOON_RX_FILTER_DIRECTED | TYPHOON_RX_FILTER_BROADCAST; | 2272 | xp_cmd.parm1 = TYPHOON_RX_FILTER_DIRECTED | TYPHOON_RX_FILTER_BROADCAST; |
2294 | if(typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL) < 0) { | 2273 | if(typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL) < 0) { |
2295 | printk(KERN_ERR "%s: unable to set rx filter in suspend\n", | 2274 | netdev_err(dev, "unable to set rx filter in suspend\n"); |
2296 | dev->name); | ||
2297 | goto need_resume; | 2275 | goto need_resume; |
2298 | } | 2276 | } |
2299 | 2277 | ||
2300 | if(typhoon_sleep(tp, pci_choose_state(pdev, state), tp->wol_events) < 0) { | 2278 | if(typhoon_sleep(tp, pci_choose_state(pdev, state), tp->wol_events) < 0) { |
2301 | printk(KERN_ERR "%s: unable to put card to sleep\n", dev->name); | 2279 | netdev_err(dev, "unable to put card to sleep\n"); |
2302 | goto need_resume; | 2280 | goto need_resume; |
2303 | } | 2281 | } |
2304 | 2282 | ||
@@ -2352,7 +2330,7 @@ out_unmap: | |||
2352 | 2330 | ||
2353 | out: | 2331 | out: |
2354 | if(!mode) | 2332 | if(!mode) |
2355 | printk(KERN_INFO PFX "falling back to port IO\n"); | 2333 | pr_info("%s: falling back to port IO\n", pci_name(pdev)); |
2356 | return mode; | 2334 | return mode; |
2357 | } | 2335 | } |
2358 | 2336 | ||
@@ -2372,7 +2350,6 @@ static const struct net_device_ops typhoon_netdev_ops = { | |||
2372 | static int __devinit | 2350 | static int __devinit |
2373 | typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 2351 | typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
2374 | { | 2352 | { |
2375 | static int did_version = 0; | ||
2376 | struct net_device *dev; | 2353 | struct net_device *dev; |
2377 | struct typhoon *tp; | 2354 | struct typhoon *tp; |
2378 | int card_id = (int) ent->driver_data; | 2355 | int card_id = (int) ent->driver_data; |
@@ -2382,14 +2359,11 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2382 | struct cmd_desc xp_cmd; | 2359 | struct cmd_desc xp_cmd; |
2383 | struct resp_desc xp_resp[3]; | 2360 | struct resp_desc xp_resp[3]; |
2384 | int err = 0; | 2361 | int err = 0; |
2385 | 2362 | const char *err_msg; | |
2386 | if(!did_version++) | ||
2387 | printk(KERN_INFO "%s", version); | ||
2388 | 2363 | ||
2389 | dev = alloc_etherdev(sizeof(*tp)); | 2364 | dev = alloc_etherdev(sizeof(*tp)); |
2390 | if(dev == NULL) { | 2365 | if(dev == NULL) { |
2391 | printk(ERR_PFX "%s: unable to alloc new net device\n", | 2366 | err_msg = "unable to alloc new net device"; |
2392 | pci_name(pdev)); | ||
2393 | err = -ENOMEM; | 2367 | err = -ENOMEM; |
2394 | goto error_out; | 2368 | goto error_out; |
2395 | } | 2369 | } |
@@ -2397,57 +2371,48 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2397 | 2371 | ||
2398 | err = pci_enable_device(pdev); | 2372 | err = pci_enable_device(pdev); |
2399 | if(err < 0) { | 2373 | if(err < 0) { |
2400 | printk(ERR_PFX "%s: unable to enable device\n", | 2374 | err_msg = "unable to enable device"; |
2401 | pci_name(pdev)); | ||
2402 | goto error_out_dev; | 2375 | goto error_out_dev; |
2403 | } | 2376 | } |
2404 | 2377 | ||
2405 | err = pci_set_mwi(pdev); | 2378 | err = pci_set_mwi(pdev); |
2406 | if(err < 0) { | 2379 | if(err < 0) { |
2407 | printk(ERR_PFX "%s: unable to set MWI\n", pci_name(pdev)); | 2380 | err_msg = "unable to set MWI"; |
2408 | goto error_out_disable; | 2381 | goto error_out_disable; |
2409 | } | 2382 | } |
2410 | 2383 | ||
2411 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 2384 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
2412 | if(err < 0) { | 2385 | if(err < 0) { |
2413 | printk(ERR_PFX "%s: No usable DMA configuration\n", | 2386 | err_msg = "No usable DMA configuration"; |
2414 | pci_name(pdev)); | ||
2415 | goto error_out_mwi; | 2387 | goto error_out_mwi; |
2416 | } | 2388 | } |
2417 | 2389 | ||
2418 | /* sanity checks on IO and MMIO BARs | 2390 | /* sanity checks on IO and MMIO BARs |
2419 | */ | 2391 | */ |
2420 | if(!(pci_resource_flags(pdev, 0) & IORESOURCE_IO)) { | 2392 | if(!(pci_resource_flags(pdev, 0) & IORESOURCE_IO)) { |
2421 | printk(ERR_PFX | 2393 | err_msg = "region #1 not a PCI IO resource, aborting"; |
2422 | "%s: region #1 not a PCI IO resource, aborting\n", | ||
2423 | pci_name(pdev)); | ||
2424 | err = -ENODEV; | 2394 | err = -ENODEV; |
2425 | goto error_out_mwi; | 2395 | goto error_out_mwi; |
2426 | } | 2396 | } |
2427 | if(pci_resource_len(pdev, 0) < 128) { | 2397 | if(pci_resource_len(pdev, 0) < 128) { |
2428 | printk(ERR_PFX "%s: Invalid PCI IO region size, aborting\n", | 2398 | err_msg = "Invalid PCI IO region size, aborting"; |
2429 | pci_name(pdev)); | ||
2430 | err = -ENODEV; | 2399 | err = -ENODEV; |
2431 | goto error_out_mwi; | 2400 | goto error_out_mwi; |
2432 | } | 2401 | } |
2433 | if(!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { | 2402 | if(!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { |
2434 | printk(ERR_PFX | 2403 | err_msg = "region #1 not a PCI MMIO resource, aborting"; |
2435 | "%s: region #1 not a PCI MMIO resource, aborting\n", | ||
2436 | pci_name(pdev)); | ||
2437 | err = -ENODEV; | 2404 | err = -ENODEV; |
2438 | goto error_out_mwi; | 2405 | goto error_out_mwi; |
2439 | } | 2406 | } |
2440 | if(pci_resource_len(pdev, 1) < 128) { | 2407 | if(pci_resource_len(pdev, 1) < 128) { |
2441 | printk(ERR_PFX "%s: Invalid PCI MMIO region size, aborting\n", | 2408 | err_msg = "Invalid PCI MMIO region size, aborting"; |
2442 | pci_name(pdev)); | ||
2443 | err = -ENODEV; | 2409 | err = -ENODEV; |
2444 | goto error_out_mwi; | 2410 | goto error_out_mwi; |
2445 | } | 2411 | } |
2446 | 2412 | ||
2447 | err = pci_request_regions(pdev, "typhoon"); | 2413 | err = pci_request_regions(pdev, KBUILD_MODNAME); |
2448 | if(err < 0) { | 2414 | if(err < 0) { |
2449 | printk(ERR_PFX "%s: could not request regions\n", | 2415 | err_msg = "could not request regions"; |
2450 | pci_name(pdev)); | ||
2451 | goto error_out_mwi; | 2416 | goto error_out_mwi; |
2452 | } | 2417 | } |
2453 | 2418 | ||
@@ -2458,8 +2423,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2458 | 2423 | ||
2459 | ioaddr = pci_iomap(pdev, use_mmio, 128); | 2424 | ioaddr = pci_iomap(pdev, use_mmio, 128); |
2460 | if (!ioaddr) { | 2425 | if (!ioaddr) { |
2461 | printk(ERR_PFX "%s: cannot remap registers, aborting\n", | 2426 | err_msg = "cannot remap registers, aborting"; |
2462 | pci_name(pdev)); | ||
2463 | err = -EIO; | 2427 | err = -EIO; |
2464 | goto error_out_regions; | 2428 | goto error_out_regions; |
2465 | } | 2429 | } |
@@ -2469,8 +2433,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2469 | shared = pci_alloc_consistent(pdev, sizeof(struct typhoon_shared), | 2433 | shared = pci_alloc_consistent(pdev, sizeof(struct typhoon_shared), |
2470 | &shared_dma); | 2434 | &shared_dma); |
2471 | if(!shared) { | 2435 | if(!shared) { |
2472 | printk(ERR_PFX "%s: could not allocate DMA memory\n", | 2436 | err_msg = "could not allocate DMA memory"; |
2473 | pci_name(pdev)); | ||
2474 | err = -ENOMEM; | 2437 | err = -ENOMEM; |
2475 | goto error_out_remap; | 2438 | goto error_out_remap; |
2476 | } | 2439 | } |
@@ -2493,7 +2456,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2493 | * 5) Put the card to sleep. | 2456 | * 5) Put the card to sleep. |
2494 | */ | 2457 | */ |
2495 | if (typhoon_reset(ioaddr, WaitSleep) < 0) { | 2458 | if (typhoon_reset(ioaddr, WaitSleep) < 0) { |
2496 | printk(ERR_PFX "%s: could not reset 3XP\n", pci_name(pdev)); | 2459 | err_msg = "could not reset 3XP"; |
2497 | err = -EIO; | 2460 | err = -EIO; |
2498 | goto error_out_dma; | 2461 | goto error_out_dma; |
2499 | } | 2462 | } |
@@ -2505,26 +2468,18 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2505 | pci_set_master(pdev); | 2468 | pci_set_master(pdev); |
2506 | pci_save_state(pdev); | 2469 | pci_save_state(pdev); |
2507 | 2470 | ||
2508 | /* dev->name is not valid until we register, but we need to | ||
2509 | * use some common routines to initialize the card. So that those | ||
2510 | * routines print the right name, we keep our oun pointer to the name | ||
2511 | */ | ||
2512 | tp->name = pci_name(pdev); | ||
2513 | |||
2514 | typhoon_init_interface(tp); | 2471 | typhoon_init_interface(tp); |
2515 | typhoon_init_rings(tp); | 2472 | typhoon_init_rings(tp); |
2516 | 2473 | ||
2517 | if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) { | 2474 | if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0) { |
2518 | printk(ERR_PFX "%s: cannot boot 3XP sleep image\n", | 2475 | err_msg = "cannot boot 3XP sleep image"; |
2519 | pci_name(pdev)); | ||
2520 | err = -EIO; | 2476 | err = -EIO; |
2521 | goto error_out_reset; | 2477 | goto error_out_reset; |
2522 | } | 2478 | } |
2523 | 2479 | ||
2524 | INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_MAC_ADDRESS); | 2480 | INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_MAC_ADDRESS); |
2525 | if(typhoon_issue_command(tp, 1, &xp_cmd, 1, xp_resp) < 0) { | 2481 | if(typhoon_issue_command(tp, 1, &xp_cmd, 1, xp_resp) < 0) { |
2526 | printk(ERR_PFX "%s: cannot read MAC address\n", | 2482 | err_msg = "cannot read MAC address"; |
2527 | pci_name(pdev)); | ||
2528 | err = -EIO; | 2483 | err = -EIO; |
2529 | goto error_out_reset; | 2484 | goto error_out_reset; |
2530 | } | 2485 | } |
@@ -2533,8 +2488,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2533 | *(__be32 *)&dev->dev_addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2)); | 2488 | *(__be32 *)&dev->dev_addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2)); |
2534 | 2489 | ||
2535 | if(!is_valid_ether_addr(dev->dev_addr)) { | 2490 | if(!is_valid_ether_addr(dev->dev_addr)) { |
2536 | printk(ERR_PFX "%s: Could not obtain valid ethernet address, " | 2491 | err_msg = "Could not obtain valid ethernet address, aborting"; |
2537 | "aborting\n", pci_name(pdev)); | ||
2538 | goto error_out_reset; | 2492 | goto error_out_reset; |
2539 | } | 2493 | } |
2540 | 2494 | ||
@@ -2543,8 +2497,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2543 | */ | 2497 | */ |
2544 | INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_VERSIONS); | 2498 | INIT_COMMAND_WITH_RESPONSE(&xp_cmd, TYPHOON_CMD_READ_VERSIONS); |
2545 | if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { | 2499 | if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { |
2546 | printk(ERR_PFX "%s: Could not get Sleep Image version\n", | 2500 | err_msg = "Could not get Sleep Image version"; |
2547 | pci_name(pdev)); | ||
2548 | goto error_out_reset; | 2501 | goto error_out_reset; |
2549 | } | 2502 | } |
2550 | 2503 | ||
@@ -2561,8 +2514,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2561 | tp->capabilities |= TYPHOON_WAKEUP_NEEDS_RESET; | 2514 | tp->capabilities |= TYPHOON_WAKEUP_NEEDS_RESET; |
2562 | 2515 | ||
2563 | if(typhoon_sleep(tp, PCI_D3hot, 0) < 0) { | 2516 | if(typhoon_sleep(tp, PCI_D3hot, 0) < 0) { |
2564 | printk(ERR_PFX "%s: cannot put adapter to sleep\n", | 2517 | err_msg = "cannot put adapter to sleep"; |
2565 | pci_name(pdev)); | ||
2566 | err = -EIO; | 2518 | err = -EIO; |
2567 | goto error_out_reset; | 2519 | goto error_out_reset; |
2568 | } | 2520 | } |
@@ -2581,19 +2533,18 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2581 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | 2533 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; |
2582 | dev->features |= NETIF_F_TSO; | 2534 | dev->features |= NETIF_F_TSO; |
2583 | 2535 | ||
2584 | if(register_netdev(dev) < 0) | 2536 | if(register_netdev(dev) < 0) { |
2537 | err_msg = "unable to register netdev"; | ||
2585 | goto error_out_reset; | 2538 | goto error_out_reset; |
2586 | 2539 | } | |
2587 | /* fixup our local name */ | ||
2588 | tp->name = dev->name; | ||
2589 | 2540 | ||
2590 | pci_set_drvdata(pdev, dev); | 2541 | pci_set_drvdata(pdev, dev); |
2591 | 2542 | ||
2592 | printk(KERN_INFO "%s: %s at %s 0x%llx, %pM\n", | 2543 | netdev_info(dev, "%s at %s 0x%llx, %pM\n", |
2593 | dev->name, typhoon_card_info[card_id].name, | 2544 | typhoon_card_info[card_id].name, |
2594 | use_mmio ? "MMIO" : "IO", | 2545 | use_mmio ? "MMIO" : "IO", |
2595 | (unsigned long long)pci_resource_start(pdev, use_mmio), | 2546 | (unsigned long long)pci_resource_start(pdev, use_mmio), |
2596 | dev->dev_addr); | 2547 | dev->dev_addr); |
2597 | 2548 | ||
2598 | /* xp_resp still contains the response to the READ_VERSIONS command. | 2549 | /* xp_resp still contains the response to the READ_VERSIONS command. |
2599 | * For debugging, let the user know what version he has. | 2550 | * For debugging, let the user know what version he has. |
@@ -2603,23 +2554,20 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2603 | * of version is Month/Day of build. | 2554 | * of version is Month/Day of build. |
2604 | */ | 2555 | */ |
2605 | u16 monthday = le32_to_cpu(xp_resp[0].parm2) & 0xffff; | 2556 | u16 monthday = le32_to_cpu(xp_resp[0].parm2) & 0xffff; |
2606 | printk(KERN_INFO "%s: Typhoon 1.0 Sleep Image built " | 2557 | netdev_info(dev, "Typhoon 1.0 Sleep Image built %02u/%02u/2000\n", |
2607 | "%02u/%02u/2000\n", dev->name, monthday >> 8, | 2558 | monthday >> 8, monthday & 0xff); |
2608 | monthday & 0xff); | ||
2609 | } else if(xp_resp[0].numDesc == 2) { | 2559 | } else if(xp_resp[0].numDesc == 2) { |
2610 | /* This is the Typhoon 1.1+ type Sleep Image | 2560 | /* This is the Typhoon 1.1+ type Sleep Image |
2611 | */ | 2561 | */ |
2612 | u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2); | 2562 | u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2); |
2613 | u8 *ver_string = (u8 *) &xp_resp[1]; | 2563 | u8 *ver_string = (u8 *) &xp_resp[1]; |
2614 | ver_string[25] = 0; | 2564 | ver_string[25] = 0; |
2615 | printk(KERN_INFO "%s: Typhoon 1.1+ Sleep Image version " | 2565 | netdev_info(dev, "Typhoon 1.1+ Sleep Image version %02x.%03x.%03x %s\n", |
2616 | "%02x.%03x.%03x %s\n", dev->name, sleep_ver >> 24, | 2566 | sleep_ver >> 24, (sleep_ver >> 12) & 0xfff, |
2617 | (sleep_ver >> 12) & 0xfff, sleep_ver & 0xfff, | 2567 | sleep_ver & 0xfff, ver_string); |
2618 | ver_string); | ||
2619 | } else { | 2568 | } else { |
2620 | printk(KERN_WARNING "%s: Unknown Sleep Image version " | 2569 | netdev_warn(dev, "Unknown Sleep Image version (%u:%04x)\n", |
2621 | "(%u:%04x)\n", dev->name, xp_resp[0].numDesc, | 2570 | xp_resp[0].numDesc, le32_to_cpu(xp_resp[0].parm2)); |
2622 | le32_to_cpu(xp_resp[0].parm2)); | ||
2623 | } | 2571 | } |
2624 | 2572 | ||
2625 | return 0; | 2573 | return 0; |
@@ -2641,6 +2589,7 @@ error_out_disable: | |||
2641 | error_out_dev: | 2589 | error_out_dev: |
2642 | free_netdev(dev); | 2590 | free_netdev(dev); |
2643 | error_out: | 2591 | error_out: |
2592 | pr_err("%s: %s\n", pci_name(pdev), err_msg); | ||
2644 | return err; | 2593 | return err; |
2645 | } | 2594 | } |
2646 | 2595 | ||
@@ -2665,7 +2614,7 @@ typhoon_remove_one(struct pci_dev *pdev) | |||
2665 | } | 2614 | } |
2666 | 2615 | ||
2667 | static struct pci_driver typhoon_driver = { | 2616 | static struct pci_driver typhoon_driver = { |
2668 | .name = DRV_MODULE_NAME, | 2617 | .name = KBUILD_MODNAME, |
2669 | .id_table = typhoon_pci_tbl, | 2618 | .id_table = typhoon_pci_tbl, |
2670 | .probe = typhoon_init_one, | 2619 | .probe = typhoon_init_one, |
2671 | .remove = __devexit_p(typhoon_remove_one), | 2620 | .remove = __devexit_p(typhoon_remove_one), |