]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/tg3.c
tg3: Use VPD fw version when present
[net-next-2.6.git] / drivers / net / tg3.c
index 0fa7688ab483fb729c22fbc1f0a1fa54d05b1261..c002b9f97cdf86ef4966c53216d2ff30892ec2d7 100644 (file)
@@ -1098,7 +1098,7 @@ static int tg3_mdio_init(struct tg3 *tp)
 
        i = mdiobus_register(tp->mdio_bus);
        if (i) {
-               netdev_warn(tp->dev, "mdiobus_reg failed (0x%x)\n", i);
+               dev_warn(&tp->pdev->dev, "mdiobus_reg failed (0x%x)\n", i);
                mdiobus_free(tp->mdio_bus);
                return i;
        }
@@ -1106,7 +1106,7 @@ static int tg3_mdio_init(struct tg3 *tp)
        phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
 
        if (!phydev || !phydev->drv) {
-               netdev_warn(tp->dev, "No PHY devices\n");
+               dev_warn(&tp->pdev->dev, "No PHY devices\n");
                mdiobus_unregister(tp->mdio_bus);
                mdiobus_free(tp->mdio_bus);
                return -ENODEV;
@@ -1464,7 +1464,7 @@ static int tg3_phy_init(struct tg3 *tp)
        phydev = phy_connect(tp->dev, dev_name(&phydev->dev), tg3_adjust_link,
                             phydev->dev_flags, phydev->interface);
        if (IS_ERR(phydev)) {
-               netdev_err(tp->dev, "Could not attach to PHY\n");
+               dev_err(&tp->pdev->dev, "Could not attach to PHY\n");
                return PTR_ERR(phydev);
        }
 
@@ -4335,8 +4335,11 @@ static void tg3_tx_recover(struct tg3 *tp)
        BUG_ON((tp->tg3_flags & TG3_FLAG_MBOX_WRITE_REORDER) ||
               tp->write32_tx_mbox == tg3_write_indirect_mbox);
 
-       netdev_warn(tp->dev, "The system may be re-ordering memory-mapped I/O cycles to the network device, attempting to recover\n"
-                   "Please report the problem to the driver maintainer and include system chipset information.\n");
+       netdev_warn(tp->dev,
+                   "The system may be re-ordering memory-mapped I/O "
+                   "cycles to the network device, attempting to recover. "
+                   "Please report the problem to the driver maintainer "
+                   "and include system chipset information.\n");
 
        spin_lock(&tp->lock);
        tp->tg3_flags |= TG3_FLAG_TX_RECOVERY_PENDING;
@@ -4987,8 +4990,8 @@ static int tg3_poll_msix(struct napi_struct *napi, int budget)
                rmb();
 
                /* check for RX/TX work to do */
-               if (sblk->idx[0].tx_consumer == tnapi->tx_cons &&
-                   *(tnapi->rx_rcb_prod_idx) == tnapi->rx_rcb_ptr) {
+               if (likely(sblk->idx[0].tx_consumer == tnapi->tx_cons &&
+                          *(tnapi->rx_rcb_prod_idx) == tnapi->rx_rcb_ptr)) {
                        napi_complete(napi);
                        /* Reenable interrupts. */
                        tw32_mailbox(tnapi->int_mbox, tnapi->last_tag << 24);
@@ -5260,7 +5263,8 @@ static int tg3_restart_hw(struct tg3 *tp, int reset_phy)
 
        err = tg3_init_hw(tp, reset_phy);
        if (err) {
-               netdev_err(tp->dev, "Failed to re-initialize device, aborting\n");
+               netdev_err(tp->dev,
+                          "Failed to re-initialize device, aborting\n");
                tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
                tg3_full_unlock(tp);
                del_timer_sync(&tp->timer);
@@ -5279,7 +5283,7 @@ static void tg3_poll_controller(struct net_device *dev)
        struct tg3 *tp = netdev_priv(dev);
 
        for (i = 0; i < tp->irq_cnt; i++)
-               tg3_interrupt(tp->napi[i].irq_vec, dev);
+               tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]);
 }
 #endif
 
@@ -5508,7 +5512,8 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
                        netif_tx_stop_queue(txq);
 
                        /* This is a hard error, log it. */
-                       netdev_err(dev, "BUG! Tx Ring full when queue awake!\n");
+                       netdev_err(dev,
+                                  "BUG! Tx Ring full when queue awake!\n");
                }
                return NETDEV_TX_BUSY;
        }
@@ -5711,7 +5716,8 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
                        netif_tx_stop_queue(txq);
 
                        /* This is a hard error, log it. */
-                       netdev_err(dev, "BUG! Tx Ring full when queue awake!\n");
+                       netdev_err(dev,
+                                  "BUG! Tx Ring full when queue awake!\n");
                }
                return NETDEV_TX_BUSY;
        }
@@ -6058,8 +6064,10 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp,
        /* Now allocate fresh SKBs for each rx ring. */
        for (i = 0; i < tp->rx_pending; i++) {
                if (tg3_alloc_rx_skb(tp, tpr, RXD_OPAQUE_RING_STD, i) < 0) {
-                       netdev_warn(tp->dev, "Using a smaller RX standard ring, only %d out of %d buffers were allocated successfully\n",
-                                   i, tp->rx_pending);
+                       netdev_warn(tp->dev,
+                                   "Using a smaller RX standard ring. Only "
+                                   "%d out of %d buffers were allocated "
+                                   "successfully\n", i, tp->rx_pending);
                        if (i == 0)
                                goto initfail;
                        tp->rx_pending = i;
@@ -6088,8 +6096,10 @@ static int tg3_rx_prodring_alloc(struct tg3 *tp,
 
        for (i = 0; i < tp->rx_jumbo_pending; i++) {
                if (tg3_alloc_rx_skb(tp, tpr, RXD_OPAQUE_RING_JUMBO, i) < 0) {
-                       netdev_warn(tp->dev, "Using a smaller RX jumbo ring, only %d out of %d buffers were allocated successfully\n",
-                                   i, tp->rx_jumbo_pending);
+                       netdev_warn(tp->dev,
+                                   "Using a smaller RX jumbo ring. Only %d "
+                                   "out of %d buffers were allocated "
+                                   "successfully\n", i, tp->rx_jumbo_pending);
                        if (i == 0)
                                goto initfail;
                        tp->rx_jumbo_pending = i;
@@ -6433,8 +6443,9 @@ static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit, int
        }
 
        if (i == MAX_WAIT_CNT && !silent) {
-               pr_err("tg3_stop_block timed out, ofs=%lx enable_bit=%x\n",
-                      ofs, enable_bit);
+               dev_err(&tp->pdev->dev,
+                       "tg3_stop_block timed out, ofs=%lx enable_bit=%x\n",
+                       ofs, enable_bit);
                return -ENODEV;
        }
 
@@ -6480,8 +6491,9 @@ static int tg3_abort_hw(struct tg3 *tp, int silent)
                        break;
        }
        if (i >= MAX_WAIT_CNT) {
-               netdev_err(tp->dev, "%s timed out, TX_MODE_ENABLE will not clear MAC_TX_MODE=%08x\n",
-                          __func__, tr32(MAC_TX_MODE));
+               dev_err(&tp->pdev->dev,
+                       "%s timed out, TX_MODE_ENABLE will not clear "
+                       "MAC_TX_MODE=%08x\n", __func__, tr32(MAC_TX_MODE));
                err |= -ENODEV;
        }
 
@@ -7156,7 +7168,8 @@ static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_b
 
        if (cpu_base == TX_CPU_BASE &&
            (tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) {
-               netdev_err(tp->dev, "%s: Trying to load TX cpu firmware which is 5705\n",
+               netdev_err(tp->dev,
+                          "%s: Trying to load TX cpu firmware which is 5705\n",
                           __func__);
                return -EINVAL;
        }
@@ -7236,7 +7249,8 @@ static int tg3_load_5701_a0_firmware_fix(struct tg3 *tp)
                udelay(1000);
        }
        if (i >= 5) {
-               netdev_err(tp->dev, "tg3_load_firmware fails to set RX CPU PC, is %08x should be %08x\n",
+               netdev_err(tp->dev, "%s fails to set RX CPU PC, is %08x "
+                          "should be %08x\n", __func__,
                           tr32(RX_CPU_BASE + CPU_PC), info.fw_base);
                return -ENODEV;
        }
@@ -7300,7 +7314,8 @@ static int tg3_load_tso_firmware(struct tg3 *tp)
                udelay(1000);
        }
        if (i >= 5) {
-               netdev_err(tp->dev, "%s fails to set CPU PC, is %08x should be %08x\n",
+               netdev_err(tp->dev,
+                          "%s fails to set CPU PC, is %08x should be %08x\n",
                           __func__, tr32(cpu_base + CPU_PC), info.fw_base);
                return -ENODEV;
        }
@@ -8625,8 +8640,9 @@ static int tg3_test_msi(struct tg3 *tp)
                return err;
 
        /* MSI test failed, go back to INTx mode */
-       netdev_warn(tp->dev, "No interrupt was generated using MSI, switching to INTx mode\n"
-                   "Please report this failure to the PCI maintainer and include system chipset information\n");
+       netdev_warn(tp->dev, "No interrupt was generated using MSI. Switching "
+                   "to INTx mode. Please report this failure to the PCI "
+                   "maintainer and include system chipset information\n");
 
        free_irq(tp->napi[0].irq_vec, &tp->napi[0]);
 
@@ -8738,7 +8754,8 @@ static void tg3_ints_init(struct tg3 *tp)
                /* All MSI supporting chips should support tagged
                 * status.  Assert that this is the case.
                 */
-               netdev_warn(tp->dev, "MSI without TAGGED? Not using MSI\n");
+               netdev_warn(tp->dev,
+                           "MSI without TAGGED_STATUS? Not using MSI\n");
                goto defcfg;
        }
 
@@ -9457,14 +9474,14 @@ static void __tg3_set_rx_mode(struct net_device *dev)
                tg3_set_multi (tp, 0);
        } else {
                /* Accept one or more multicast(s). */
-               struct dev_mc_list *mclist;
+               struct netdev_hw_addr *ha;
                u32 mc_filter[4] = { 0, };
                u32 regidx;
                u32 bit;
                u32 crc;
 
-               netdev_for_each_mc_addr(mclist, dev) {
-                       crc = calc_crc (mclist->dmi_addr, ETH_ALEN);
+               netdev_for_each_mc_addr(ha, dev) {
+                       crc = calc_crc(ha->addr, ETH_ALEN);
                        bit = ~crc & 0x7f;
                        regidx = (bit & 0x60) >> 5;
                        bit &= 0x1f;
@@ -9776,7 +9793,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                           ADVERTISED_Pause |
                           ADVERTISED_Asym_Pause;
 
-               if (!(tp->tg3_flags2 & TG3_FLAG_10_100_ONLY))
+               if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY))
                        mask |= ADVERTISED_1000baseT_Half |
                                ADVERTISED_1000baseT_Full;
 
@@ -10648,7 +10665,8 @@ static int tg3_test_registers(struct tg3 *tp)
 
 out:
        if (netif_msg_hw(tp))
-               pr_err("Register test failed at offset %x\n", offset);
+               netdev_err(tp->dev,
+                          "Register test failed at offset %x\n", offset);
        tw32(offset, save_val);
        return -EIO;
 }
@@ -11775,7 +11793,8 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
                tp->tg3_flags |= TG3_FLAG_NVRAM;
 
                if (tg3_nvram_lock(tp)) {
-                       netdev_warn(tp->dev, "Cannot get nvram lock, %s failed\n",
+                       netdev_warn(tp->dev,
+                                   "Cannot get nvram lock, %s failed\n",
                                    __func__);
                        return;
                }
@@ -12544,11 +12563,11 @@ skip_phy_reset:
        return err;
 }
 
-static void __devinit tg3_read_partno(struct tg3 *tp)
+static void __devinit tg3_read_vpd(struct tg3 *tp)
 {
-       unsigned char vpd_data[TG3_NVM_VPD_LEN];   /* in little-endian format */
+       u8 vpd_data[TG3_NVM_VPD_LEN];
        unsigned int block_end, rosize, len;
-       int i = 0;
+       int j, i = 0;
        u32 magic;
 
        if ((tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) ||
@@ -12597,6 +12616,32 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
        if (block_end > TG3_NVM_VPD_LEN)
                goto out_not_found;
 
+       j = pci_vpd_find_info_keyword(vpd_data, i, rosize,
+                                     PCI_VPD_RO_KEYWORD_MFR_ID);
+       if (j > 0) {
+               len = pci_vpd_info_field_size(&vpd_data[j]);
+
+               j += PCI_VPD_INFO_FLD_HDR_SIZE;
+               if (j + len > block_end || len != 4 ||
+                   memcmp(&vpd_data[j], "1028", 4))
+                       goto partno;
+
+               j = pci_vpd_find_info_keyword(vpd_data, i, rosize,
+                                             PCI_VPD_RO_KEYWORD_VENDOR0);
+               if (j < 0)
+                       goto partno;
+
+               len = pci_vpd_info_field_size(&vpd_data[j]);
+
+               j += PCI_VPD_INFO_FLD_HDR_SIZE;
+               if (j + len > block_end)
+                       goto partno;
+
+               memcpy(tp->fw_ver, &vpd_data[j], len);
+               strncat(tp->fw_ver, " bc ", TG3_NVM_VPD_LEN - len - 1);
+       }
+
+partno:
        i = pci_vpd_find_info_keyword(vpd_data, i, rosize,
                                      PCI_VPD_RO_KEYWORD_PARTNO);
        if (i < 0)
@@ -12666,7 +12711,7 @@ static int __devinit tg3_fw_img_is_valid(struct tg3 *tp, u32 offset)
 static void __devinit tg3_read_bc_ver(struct tg3 *tp)
 {
        u32 val, offset, start, ver_offset;
-       int i;
+       int i, dst_off;
        bool newver = false;
 
        if (tg3_nvram_read(tp, 0xc, &offset) ||
@@ -12686,8 +12731,11 @@ static void __devinit tg3_read_bc_ver(struct tg3 *tp)
                        newver = true;
        }
 
+       dst_off = strlen(tp->fw_ver);
+
        if (newver) {
-               if (tg3_nvram_read(tp, offset + 8, &ver_offset))
+               if (TG3_VER_SIZE - dst_off < 16 ||
+                   tg3_nvram_read(tp, offset + 8, &ver_offset))
                        return;
 
                offset = offset + ver_offset - start;
@@ -12696,7 +12744,7 @@ static void __devinit tg3_read_bc_ver(struct tg3 *tp)
                        if (tg3_nvram_read_be32(tp, offset + i, &v))
                                return;
 
-                       memcpy(tp->fw_ver + i, &v, sizeof(v));
+                       memcpy(tp->fw_ver + dst_off + i, &v, sizeof(v));
                }
        } else {
                u32 major, minor;
@@ -12707,7 +12755,8 @@ static void __devinit tg3_read_bc_ver(struct tg3 *tp)
                major = (ver_offset & TG3_NVM_BCVER_MAJMSK) >>
                        TG3_NVM_BCVER_MAJSFT;
                minor = ver_offset & TG3_NVM_BCVER_MINMSK;
-               snprintf(&tp->fw_ver[0], 32, "v%d.%02d", major, minor);
+               snprintf(&tp->fw_ver[dst_off], TG3_VER_SIZE - dst_off,
+                        "v%d.%02d", major, minor);
        }
 }
 
@@ -12731,9 +12780,7 @@ static void __devinit tg3_read_sb_ver(struct tg3 *tp, u32 val)
 {
        u32 offset, major, minor, build;
 
-       tp->fw_ver[0] = 's';
-       tp->fw_ver[1] = 'b';
-       tp->fw_ver[2] = '\0';
+       strncat(tp->fw_ver, "sb", TG3_VER_SIZE - strlen(tp->fw_ver) - 1);
 
        if ((val & TG3_EEPROM_SB_FORMAT_MASK) != TG3_EEPROM_SB_FORMAT_1)
                return;
@@ -12770,11 +12817,14 @@ static void __devinit tg3_read_sb_ver(struct tg3 *tp, u32 val)
        if (minor > 99 || build > 26)
                return;
 
-       snprintf(&tp->fw_ver[2], 30, " v%d.%02d", major, minor);
+       offset = strlen(tp->fw_ver);
+       snprintf(&tp->fw_ver[offset], TG3_VER_SIZE - offset,
+                " v%d.%02d", major, minor);
 
        if (build > 0) {
-               tp->fw_ver[8] = 'a' + build - 1;
-               tp->fw_ver[9] = '\0';
+               offset = strlen(tp->fw_ver);
+               if (offset < TG3_VER_SIZE - 1)
+                       tp->fw_ver[offset] = 'a' + build - 1;
        }
 }
 
@@ -12861,12 +12911,13 @@ static void __devinit tg3_read_dash_ver(struct tg3 *tp)
 static void __devinit tg3_read_fw_ver(struct tg3 *tp)
 {
        u32 val;
+       bool vpd_vers = false;
 
-       if (tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) {
-               tp->fw_ver[0] = 's';
-               tp->fw_ver[1] = 'b';
-               tp->fw_ver[2] = '\0';
+       if (tp->fw_ver[0] != 0)
+               vpd_vers = true;
 
+       if (tp->tg3_flags3 & TG3_FLG3_NO_NVRAM) {
+               strcat(tp->fw_ver, "sb");
                return;
        }
 
@@ -12883,11 +12934,12 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
                return;
 
        if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) ||
-            (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE))
-               return;
+            (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) || vpd_vers)
+               goto done;
 
        tg3_read_mgmtfw_ver(tp);
 
+done:
        tp->fw_ver[TG3_VER_SIZE - 1] = 0;
 }
 
@@ -13223,7 +13275,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
                   (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) {
                tp->pcix_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_PCIX);
                if (!tp->pcix_cap) {
-                       pr_err("Cannot find PCI-X capability, aborting\n");
+                       dev_err(&tp->pdev->dev,
+                               "Cannot find PCI-X capability, aborting\n");
                        return -EIO;
                }
 
@@ -13420,7 +13473,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
        /* Force the chip into D0. */
        err = tg3_set_power_state(tp, PCI_D0);
        if (err) {
-               pr_err("(%s) transition to D0 failed\n", pci_name(tp->pdev));
+               dev_err(&tp->pdev->dev, "Transition to D0 failed\n");
                return err;
        }
 
@@ -13594,13 +13647,12 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
 
        err = tg3_phy_probe(tp);
        if (err) {
-               pr_err("(%s) phy probe failed, err %d\n",
-                      pci_name(tp->pdev), err);
+               dev_err(&tp->pdev->dev, "phy probe failed, err %d\n", err);
                /* ... but do not return immediately ... */
                tg3_mdio_fini(tp);
        }
 
-       tg3_read_partno(tp);
+       tg3_read_vpd(tp);
        tg3_read_fw_ver(tp);
 
        if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) {
@@ -14104,8 +14156,9 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
                /* Send the buffer to the chip. */
                ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 1);
                if (ret) {
-                       pr_err("tg3_test_dma() Write the buffer failed %d\n",
-                              ret);
+                       dev_err(&tp->pdev->dev,
+                               "%s: Buffer write failed. err = %d\n",
+                               __func__, ret);
                        break;
                }
 
@@ -14115,8 +14168,9 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
                        u32 val;
                        tg3_read_mem(tp, 0x2100 + (i*4), &val);
                        if (le32_to_cpu(val) != p[i]) {
-                               pr_err("  tg3_test_dma()  Card buffer corrupted on write! (%d != %d)\n",
-                                      val, i);
+                               dev_err(&tp->pdev->dev,
+                                       "%s: Buffer corrupted on device! "
+                                       "(%d != %d)\n", __func__, val, i);
                                /* ret = -ENODEV here? */
                        }
                        p[i] = 0;
@@ -14125,9 +14179,8 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
                /* Now read it back. */
                ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, 0);
                if (ret) {
-                       pr_err("tg3_test_dma() Read the buffer failed %d\n",
-                              ret);
-
+                       dev_err(&tp->pdev->dev, "%s: Buffer read failed. "
+                               "err = %d\n", __func__, ret);
                        break;
                }
 
@@ -14143,8 +14196,9 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
                                tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
                                break;
                        } else {
-                               pr_err("tg3_test_dma() buffer corrupted on read back! (%d != %d)\n",
-                                      p[i], i);
+                               dev_err(&tp->pdev->dev,
+                                       "%s: Buffer corrupted on read back! "
+                                       "(%d != %d)\n", __func__, p[i], i);
                                ret = -ENODEV;
                                goto out;
                        }
@@ -14436,13 +14490,13 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
 
        err = pci_enable_device(pdev);
        if (err) {
-               pr_err("Cannot enable PCI device, aborting\n");
+               dev_err(&pdev->dev, "Cannot enable PCI device, aborting\n");
                return err;
        }
 
        err = pci_request_regions(pdev, DRV_MODULE_NAME);
        if (err) {
-               pr_err("Cannot obtain PCI resources, aborting\n");
+               dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting\n");
                goto err_out_disable_pdev;
        }
 
@@ -14451,14 +14505,15 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
        /* Find power-management capability. */
        pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
        if (pm_cap == 0) {
-               pr_err("Cannot find PowerManagement capability, aborting\n");
+               dev_err(&pdev->dev,
+                       "Cannot find Power Management capability, aborting\n");
                err = -EIO;
                goto err_out_free_res;
        }
 
        dev = alloc_etherdev_mq(sizeof(*tp), TG3_IRQ_MAX_VECS);
        if (!dev) {
-               pr_err("Etherdev alloc failed, aborting\n");
+               dev_err(&pdev->dev, "Etherdev alloc failed, aborting\n");
                err = -ENOMEM;
                goto err_out_free_res;
        }
@@ -14508,7 +14563,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
 
        tp->regs = pci_ioremap_bar(pdev, BAR_0);
        if (!tp->regs) {
-               netdev_err(dev, "Cannot map device registers, aborting\n");
+               dev_err(&pdev->dev, "Cannot map device registers, aborting\n");
                err = -ENOMEM;
                goto err_out_free_dev;
        }
@@ -14524,7 +14579,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
 
        err = tg3_get_invariants(tp);
        if (err) {
-               netdev_err(dev, "Problem fetching invariants of chip, aborting\n");
+               dev_err(&pdev->dev,
+                       "Problem fetching invariants of chip, aborting\n");
                goto err_out_iounmap;
        }
 
@@ -14559,7 +14615,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
                        err = pci_set_consistent_dma_mask(pdev,
                                                          persist_dma_mask);
                        if (err < 0) {
-                               netdev_err(dev, "Unable to obtain 64 bit DMA for consistent allocations\n");
+                               dev_err(&pdev->dev, "Unable to obtain 64 bit "
+                                       "DMA for consistent allocations\n");
                                goto err_out_iounmap;
                        }
                }
@@ -14567,7 +14624,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
        if (err || dma_mask == DMA_BIT_MASK(32)) {
                err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
                if (err) {
-                       netdev_err(dev, "No usable DMA configuration, aborting\n");
+                       dev_err(&pdev->dev,
+                               "No usable DMA configuration, aborting\n");
                        goto err_out_iounmap;
                }
        }
@@ -14616,14 +14674,16 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
 
        err = tg3_get_device_address(tp);
        if (err) {
-               netdev_err(dev, "Could not obtain valid ethernet address, aborting\n");
+               dev_err(&pdev->dev,
+                       "Could not obtain valid ethernet address, aborting\n");
                goto err_out_iounmap;
        }
 
        if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
                tp->aperegs = pci_ioremap_bar(pdev, BAR_2);
                if (!tp->aperegs) {
-                       netdev_err(dev, "Cannot map APE registers, aborting\n");
+                       dev_err(&pdev->dev,
+                               "Cannot map APE registers, aborting\n");
                        err = -ENOMEM;
                        goto err_out_iounmap;
                }
@@ -14647,7 +14707,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
 
        err = tg3_test_dma(tp);
        if (err) {
-               netdev_err(dev, "DMA engine test failed, aborting\n");
+               dev_err(&pdev->dev, "DMA engine test failed, aborting\n");
                goto err_out_apeunmap;
        }
 
@@ -14708,7 +14768,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
 
        err = register_netdev(dev);
        if (err) {
-               netdev_err(dev, "Cannot register net device, aborting\n");
+               dev_err(&pdev->dev, "Cannot register net device, aborting\n");
                goto err_out_apeunmap;
        }
 
@@ -14721,11 +14781,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
        if (tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED) {
                struct phy_device *phydev;
                phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
-               netdev_info(dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
+               netdev_info(dev,
+                           "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
                            phydev->drv->name, dev_name(&phydev->dev));
        } else
-               netdev_info(dev, "attached PHY is %s (%s Ethernet) (WireSpeed[%d])\n",
-                           tg3_phy_string(tp),
+               netdev_info(dev, "attached PHY is %s (%s Ethernet) "
+                           "(WireSpeed[%d])\n", tg3_phy_string(tp),
                            ((tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100Base-TX" :
                             ((tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) ? "1000Base-SX" :
                              "10/100/1000Base-T")),