aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-02-09 06:49:48 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-12 16:27:44 -0500
commitba211e3ec35820eced89bfe12e2d94e6352a4c5f (patch)
tree997d133bb18f347534b7a70536b693cd2a9843a1 /drivers
parent571ba42303813106d533bf6bda929d8e289f51bf (diff)
drivers/net/atl1e: Use netdev_printk helpers
Logging messages sometimes had duplicated "ATL1E" output. For instance: ATL1E 0000:03:00.0: ATL1E: eth0 NIC Link is Up<100 Mbps Full Duplex> is now: ATL1E 0000:03:00.0: eth0: NIC Link is Up <100 Mbps Full Duplex> Add some consistency to logging messages Add some missing \n's to logging messages Miscellaneous typo spelling corrections Change atl1e_validate_option argument from pdev to adapter Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/atl1e/atl1e_hw.c23
-rw-r--r--drivers/net/atl1e/atl1e_main.c153
-rw-r--r--drivers/net/atl1e/atl1e_param.c35
3 files changed, 99 insertions, 112 deletions
diff --git a/drivers/net/atl1e/atl1e_hw.c b/drivers/net/atl1e/atl1e_hw.c
index 4a7700620119..76cc043def8c 100644
--- a/drivers/net/atl1e/atl1e_hw.c
+++ b/drivers/net/atl1e/atl1e_hw.c
@@ -394,7 +394,6 @@ static int atl1e_phy_setup_autoneg_adv(struct atl1e_hw *hw)
394int atl1e_phy_commit(struct atl1e_hw *hw) 394int atl1e_phy_commit(struct atl1e_hw *hw)
395{ 395{
396 struct atl1e_adapter *adapter = hw->adapter; 396 struct atl1e_adapter *adapter = hw->adapter;
397 struct pci_dev *pdev = adapter->pdev;
398 int ret_val; 397 int ret_val;
399 u16 phy_data; 398 u16 phy_data;
400 399
@@ -415,12 +414,12 @@ int atl1e_phy_commit(struct atl1e_hw *hw)
415 } 414 }
416 415
417 if (0 != (val & (MDIO_START | MDIO_BUSY))) { 416 if (0 != (val & (MDIO_START | MDIO_BUSY))) {
418 dev_err(&pdev->dev, 417 netdev_err(adapter->netdev,
419 "pcie linkdown at least for 25ms\n"); 418 "pcie linkdown at least for 25ms\n");
420 return ret_val; 419 return ret_val;
421 } 420 }
422 421
423 dev_err(&pdev->dev, "pcie linkup after %d ms\n", i); 422 netdev_err(adapter->netdev, "pcie linkup after %d ms\n", i);
424 } 423 }
425 return 0; 424 return 0;
426} 425}
@@ -428,7 +427,6 @@ int atl1e_phy_commit(struct atl1e_hw *hw)
428int atl1e_phy_init(struct atl1e_hw *hw) 427int atl1e_phy_init(struct atl1e_hw *hw)
429{ 428{
430 struct atl1e_adapter *adapter = hw->adapter; 429 struct atl1e_adapter *adapter = hw->adapter;
431 struct pci_dev *pdev = adapter->pdev;
432 s32 ret_val; 430 s32 ret_val;
433 u16 phy_val; 431 u16 phy_val;
434 432
@@ -492,20 +490,22 @@ int atl1e_phy_init(struct atl1e_hw *hw)
492 /*Enable PHY LinkChange Interrupt */ 490 /*Enable PHY LinkChange Interrupt */
493 ret_val = atl1e_write_phy_reg(hw, MII_INT_CTRL, 0xC00); 491 ret_val = atl1e_write_phy_reg(hw, MII_INT_CTRL, 0xC00);
494 if (ret_val) { 492 if (ret_val) {
495 dev_err(&pdev->dev, "Error enable PHY linkChange Interrupt\n"); 493 netdev_err(adapter->netdev,
494 "Error enable PHY linkChange Interrupt\n");
496 return ret_val; 495 return ret_val;
497 } 496 }
498 /* setup AutoNeg parameters */ 497 /* setup AutoNeg parameters */
499 ret_val = atl1e_phy_setup_autoneg_adv(hw); 498 ret_val = atl1e_phy_setup_autoneg_adv(hw);
500 if (ret_val) { 499 if (ret_val) {
501 dev_err(&pdev->dev, "Error Setting up Auto-Negotiation\n"); 500 netdev_err(adapter->netdev,
501 "Error Setting up Auto-Negotiation\n");
502 return ret_val; 502 return ret_val;
503 } 503 }
504 /* SW.Reset & En-Auto-Neg to restart Auto-Neg*/ 504 /* SW.Reset & En-Auto-Neg to restart Auto-Neg*/
505 dev_dbg(&pdev->dev, "Restarting Auto-Neg"); 505 netdev_dbg(adapter->netdev, "Restarting Auto-Negotiation\n");
506 ret_val = atl1e_phy_commit(hw); 506 ret_val = atl1e_phy_commit(hw);
507 if (ret_val) { 507 if (ret_val) {
508 dev_err(&pdev->dev, "Error Resetting the phy"); 508 netdev_err(adapter->netdev, "Error resetting the phy\n");
509 return ret_val; 509 return ret_val;
510 } 510 }
511 511
@@ -559,9 +559,8 @@ int atl1e_reset_hw(struct atl1e_hw *hw)
559 } 559 }
560 560
561 if (timeout >= AT_HW_MAX_IDLE_DELAY) { 561 if (timeout >= AT_HW_MAX_IDLE_DELAY) {
562 dev_err(&pdev->dev, 562 netdev_err(adapter->netdev,
563 "MAC state machine cann't be idle since" 563 "MAC state machine can't be idle since disabled for 10ms second\n");
564 " disabled for 10ms second\n");
565 return AT_ERR_TIMEOUT; 564 return AT_ERR_TIMEOUT;
566 } 565 }
567 566
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c
index d59f8e89c65d..7d8de10ba628 100644
--- a/drivers/net/atl1e/atl1e_main.c
+++ b/drivers/net/atl1e/atl1e_main.c
@@ -164,11 +164,10 @@ static int atl1e_check_link(struct atl1e_adapter *adapter)
164{ 164{
165 struct atl1e_hw *hw = &adapter->hw; 165 struct atl1e_hw *hw = &adapter->hw;
166 struct net_device *netdev = adapter->netdev; 166 struct net_device *netdev = adapter->netdev;
167 struct pci_dev *pdev = adapter->pdev;
168 int err = 0; 167 int err = 0;
169 u16 speed, duplex, phy_data; 168 u16 speed, duplex, phy_data;
170 169
171 /* MII_BMSR must read twise */ 170 /* MII_BMSR must read twice */
172 atl1e_read_phy_reg(hw, MII_BMSR, &phy_data); 171 atl1e_read_phy_reg(hw, MII_BMSR, &phy_data);
173 atl1e_read_phy_reg(hw, MII_BMSR, &phy_data); 172 atl1e_read_phy_reg(hw, MII_BMSR, &phy_data);
174 if ((phy_data & BMSR_LSTATUS) == 0) { 173 if ((phy_data & BMSR_LSTATUS) == 0) {
@@ -195,12 +194,11 @@ static int atl1e_check_link(struct atl1e_adapter *adapter)
195 adapter->link_speed = speed; 194 adapter->link_speed = speed;
196 adapter->link_duplex = duplex; 195 adapter->link_duplex = duplex;
197 atl1e_setup_mac_ctrl(adapter); 196 atl1e_setup_mac_ctrl(adapter);
198 dev_info(&pdev->dev, 197 netdev_info(netdev,
199 "%s: %s NIC Link is Up<%d Mbps %s>\n", 198 "NIC Link is Up <%d Mbps %s Duplex>\n",
200 atl1e_driver_name, netdev->name, 199 adapter->link_speed,
201 adapter->link_speed, 200 adapter->link_duplex == FULL_DUPLEX ?
202 adapter->link_duplex == FULL_DUPLEX ? 201 "Full" : "Half");
203 "Full Duplex" : "Half Duplex");
204 } 202 }
205 203
206 if (!netif_carrier_ok(netdev)) { 204 if (!netif_carrier_ok(netdev)) {
@@ -230,7 +228,6 @@ static void atl1e_link_chg_task(struct work_struct *work)
230static void atl1e_link_chg_event(struct atl1e_adapter *adapter) 228static void atl1e_link_chg_event(struct atl1e_adapter *adapter)
231{ 229{
232 struct net_device *netdev = adapter->netdev; 230 struct net_device *netdev = adapter->netdev;
233 struct pci_dev *pdev = adapter->pdev;
234 u16 phy_data = 0; 231 u16 phy_data = 0;
235 u16 link_up = 0; 232 u16 link_up = 0;
236 233
@@ -243,8 +240,7 @@ static void atl1e_link_chg_event(struct atl1e_adapter *adapter)
243 if (!link_up) { 240 if (!link_up) {
244 if (netif_carrier_ok(netdev)) { 241 if (netif_carrier_ok(netdev)) {
245 /* old link state: Up */ 242 /* old link state: Up */
246 dev_info(&pdev->dev, "%s: %s NIC Link is Down\n", 243 netdev_info(netdev, "NIC Link is Down\n");
247 atl1e_driver_name, netdev->name);
248 adapter->link_speed = SPEED_0; 244 adapter->link_speed = SPEED_0;
249 netif_stop_queue(netdev); 245 netif_stop_queue(netdev);
250 } 246 }
@@ -321,10 +317,9 @@ static void atl1e_vlan_rx_register(struct net_device *netdev,
321 struct vlan_group *grp) 317 struct vlan_group *grp)
322{ 318{
323 struct atl1e_adapter *adapter = netdev_priv(netdev); 319 struct atl1e_adapter *adapter = netdev_priv(netdev);
324 struct pci_dev *pdev = adapter->pdev;
325 u32 mac_ctrl_data = 0; 320 u32 mac_ctrl_data = 0;
326 321
327 dev_dbg(&pdev->dev, "atl1e_vlan_rx_register\n"); 322 netdev_dbg(adapter->netdev, "%s\n", __func__);
328 323
329 atl1e_irq_disable(adapter); 324 atl1e_irq_disable(adapter);
330 325
@@ -345,9 +340,7 @@ static void atl1e_vlan_rx_register(struct net_device *netdev,
345 340
346static void atl1e_restore_vlan(struct atl1e_adapter *adapter) 341static void atl1e_restore_vlan(struct atl1e_adapter *adapter)
347{ 342{
348 struct pci_dev *pdev = adapter->pdev; 343 netdev_dbg(adapter->netdev, "%s\n", __func__);
349
350 dev_dbg(&pdev->dev, "atl1e_restore_vlan !");
351 atl1e_vlan_rx_register(adapter->netdev, adapter->vlgrp); 344 atl1e_vlan_rx_register(adapter->netdev, adapter->vlgrp);
352} 345}
353/* 346/*
@@ -391,7 +384,7 @@ static int atl1e_change_mtu(struct net_device *netdev, int new_mtu)
391 384
392 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || 385 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
393 (max_frame > MAX_JUMBO_FRAME_SIZE)) { 386 (max_frame > MAX_JUMBO_FRAME_SIZE)) {
394 dev_warn(&adapter->pdev->dev, "invalid MTU setting\n"); 387 netdev_warn(adapter->netdev, "invalid MTU setting\n");
395 return -EINVAL; 388 return -EINVAL;
396 } 389 }
397 /* set MTU */ 390 /* set MTU */
@@ -438,7 +431,6 @@ static int atl1e_mii_ioctl(struct net_device *netdev,
438 struct ifreq *ifr, int cmd) 431 struct ifreq *ifr, int cmd)
439{ 432{
440 struct atl1e_adapter *adapter = netdev_priv(netdev); 433 struct atl1e_adapter *adapter = netdev_priv(netdev);
441 struct pci_dev *pdev = adapter->pdev;
442 struct mii_ioctl_data *data = if_mii(ifr); 434 struct mii_ioctl_data *data = if_mii(ifr);
443 unsigned long flags; 435 unsigned long flags;
444 int retval = 0; 436 int retval = 0;
@@ -466,8 +458,8 @@ static int atl1e_mii_ioctl(struct net_device *netdev,
466 goto out; 458 goto out;
467 } 459 }
468 460
469 dev_dbg(&pdev->dev, "<atl1e_mii_ioctl> write %x %x", 461 netdev_dbg(adapter->netdev, "<atl1e_mii_ioctl> write %x %x\n",
470 data->reg_num, data->val_in); 462 data->reg_num, data->val_in);
471 if (atl1e_write_phy_reg(&adapter->hw, 463 if (atl1e_write_phy_reg(&adapter->hw,
472 data->reg_num, data->val_in)) { 464 data->reg_num, data->val_in)) {
473 retval = -EIO; 465 retval = -EIO;
@@ -602,7 +594,7 @@ static int __devinit atl1e_sw_init(struct atl1e_adapter *adapter)
602 hw->dmaw_dly_cnt = 4; 594 hw->dmaw_dly_cnt = 4;
603 595
604 if (atl1e_alloc_queues(adapter)) { 596 if (atl1e_alloc_queues(adapter)) {
605 dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); 597 netdev_err(adapter->netdev, "Unable to allocate memory for queues\n");
606 return -ENOMEM; 598 return -ENOMEM;
607 } 599 }
608 600
@@ -800,8 +792,8 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter)
800 adapter->ring_size, &adapter->ring_dma); 792 adapter->ring_size, &adapter->ring_dma);
801 793
802 if (adapter->ring_vir_addr == NULL) { 794 if (adapter->ring_vir_addr == NULL) {
803 dev_err(&pdev->dev, "pci_alloc_consistent failed, " 795 netdev_err(adapter->netdev,
804 "size = D%d", size); 796 "pci_alloc_consistent failed, size = D%d\n", size);
805 return -ENOMEM; 797 return -ENOMEM;
806 } 798 }
807 799
@@ -817,7 +809,8 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter)
817 size = sizeof(struct atl1e_tx_buffer) * (tx_ring->count); 809 size = sizeof(struct atl1e_tx_buffer) * (tx_ring->count);
818 tx_ring->tx_buffer = kzalloc(size, GFP_KERNEL); 810 tx_ring->tx_buffer = kzalloc(size, GFP_KERNEL);
819 if (tx_ring->tx_buffer == NULL) { 811 if (tx_ring->tx_buffer == NULL) {
820 dev_err(&pdev->dev, "kzalloc failed , size = D%d", size); 812 netdev_err(adapter->netdev, "kzalloc failed, size = D%d\n",
813 size);
821 err = -ENOMEM; 814 err = -ENOMEM;
822 goto failed; 815 goto failed;
823 } 816 }
@@ -852,8 +845,8 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter)
852 } 845 }
853 846
854 if (unlikely(offset > adapter->ring_size)) { 847 if (unlikely(offset > adapter->ring_size)) {
855 dev_err(&pdev->dev, "offset(%d) > ring size(%d) !!\n", 848 netdev_err(adapter->netdev, "offset(%d) > ring size(%d) !!\n",
856 offset, adapter->ring_size); 849 offset, adapter->ring_size);
857 err = -1; 850 err = -1;
858 goto failed; 851 goto failed;
859 } 852 }
@@ -1077,7 +1070,6 @@ static void atl1e_setup_mac_ctrl(struct atl1e_adapter *adapter)
1077static int atl1e_configure(struct atl1e_adapter *adapter) 1070static int atl1e_configure(struct atl1e_adapter *adapter)
1078{ 1071{
1079 struct atl1e_hw *hw = &adapter->hw; 1072 struct atl1e_hw *hw = &adapter->hw;
1080 struct pci_dev *pdev = adapter->pdev;
1081 1073
1082 u32 intr_status_data = 0; 1074 u32 intr_status_data = 0;
1083 1075
@@ -1130,8 +1122,8 @@ static int atl1e_configure(struct atl1e_adapter *adapter)
1130 1122
1131 intr_status_data = AT_READ_REG(hw, REG_ISR); 1123 intr_status_data = AT_READ_REG(hw, REG_ISR);
1132 if (unlikely((intr_status_data & ISR_PHY_LINKDOWN) != 0)) { 1124 if (unlikely((intr_status_data & ISR_PHY_LINKDOWN) != 0)) {
1133 dev_err(&pdev->dev, "atl1e_configure failed," 1125 netdev_err(adapter->netdev,
1134 "PCIE phy link down\n"); 1126 "atl1e_configure failed, PCIE phy link down\n");
1135 return -1; 1127 return -1;
1136 } 1128 }
1137 1129
@@ -1262,7 +1254,6 @@ static irqreturn_t atl1e_intr(int irq, void *data)
1262{ 1254{
1263 struct net_device *netdev = data; 1255 struct net_device *netdev = data;
1264 struct atl1e_adapter *adapter = netdev_priv(netdev); 1256 struct atl1e_adapter *adapter = netdev_priv(netdev);
1265 struct pci_dev *pdev = adapter->pdev;
1266 struct atl1e_hw *hw = &adapter->hw; 1257 struct atl1e_hw *hw = &adapter->hw;
1267 int max_ints = AT_MAX_INT_WORK; 1258 int max_ints = AT_MAX_INT_WORK;
1268 int handled = IRQ_NONE; 1259 int handled = IRQ_NONE;
@@ -1285,8 +1276,8 @@ static irqreturn_t atl1e_intr(int irq, void *data)
1285 handled = IRQ_HANDLED; 1276 handled = IRQ_HANDLED;
1286 /* check if PCIE PHY Link down */ 1277 /* check if PCIE PHY Link down */
1287 if (status & ISR_PHY_LINKDOWN) { 1278 if (status & ISR_PHY_LINKDOWN) {
1288 dev_err(&pdev->dev, 1279 netdev_err(adapter->netdev,
1289 "pcie phy linkdown %x\n", status); 1280 "pcie phy linkdown %x\n", status);
1290 if (netif_running(adapter->netdev)) { 1281 if (netif_running(adapter->netdev)) {
1291 /* reset MAC */ 1282 /* reset MAC */
1292 atl1e_irq_reset(adapter); 1283 atl1e_irq_reset(adapter);
@@ -1297,9 +1288,9 @@ static irqreturn_t atl1e_intr(int irq, void *data)
1297 1288
1298 /* check if DMA read/write error */ 1289 /* check if DMA read/write error */
1299 if (status & (ISR_DMAR_TO_RST | ISR_DMAW_TO_RST)) { 1290 if (status & (ISR_DMAR_TO_RST | ISR_DMAW_TO_RST)) {
1300 dev_err(&pdev->dev, 1291 netdev_err(adapter->netdev,
1301 "PCIE DMA RW error (status = 0x%x)\n", 1292 "PCIE DMA RW error (status = 0x%x)\n",
1302 status); 1293 status);
1303 atl1e_irq_reset(adapter); 1294 atl1e_irq_reset(adapter);
1304 schedule_work(&adapter->reset_task); 1295 schedule_work(&adapter->reset_task);
1305 break; 1296 break;
@@ -1382,7 +1373,6 @@ static struct atl1e_rx_page *atl1e_get_rx_page(struct atl1e_adapter *adapter,
1382static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que, 1373static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
1383 int *work_done, int work_to_do) 1374 int *work_done, int work_to_do)
1384{ 1375{
1385 struct pci_dev *pdev = adapter->pdev;
1386 struct net_device *netdev = adapter->netdev; 1376 struct net_device *netdev = adapter->netdev;
1387 struct atl1e_rx_ring *rx_ring = (struct atl1e_rx_ring *) 1377 struct atl1e_rx_ring *rx_ring = (struct atl1e_rx_ring *)
1388 &adapter->rx_ring; 1378 &adapter->rx_ring;
@@ -1404,11 +1394,10 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
1404 rx_page->read_offset); 1394 rx_page->read_offset);
1405 /* check sequence number */ 1395 /* check sequence number */
1406 if (prrs->seq_num != rx_page_desc[que].rx_nxseq) { 1396 if (prrs->seq_num != rx_page_desc[que].rx_nxseq) {
1407 dev_err(&pdev->dev, 1397 netdev_err(netdev,
1408 "rx sequence number" 1398 "rx sequence number error (rx=%d) (expect=%d)\n",
1409 " error (rx=%d) (expect=%d)\n", 1399 prrs->seq_num,
1410 prrs->seq_num, 1400 rx_page_desc[que].rx_nxseq);
1411 rx_page_desc[que].rx_nxseq);
1412 rx_page_desc[que].rx_nxseq++; 1401 rx_page_desc[que].rx_nxseq++;
1413 /* just for debug use */ 1402 /* just for debug use */
1414 AT_WRITE_REG(&adapter->hw, REG_DEBUG_DATA0, 1403 AT_WRITE_REG(&adapter->hw, REG_DEBUG_DATA0,
@@ -1424,9 +1413,9 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
1424 RRS_ERR_DRIBBLE | RRS_ERR_CODE | 1413 RRS_ERR_DRIBBLE | RRS_ERR_CODE |
1425 RRS_ERR_TRUNC)) { 1414 RRS_ERR_TRUNC)) {
1426 /* hardware error, discard this packet*/ 1415 /* hardware error, discard this packet*/
1427 dev_err(&pdev->dev, 1416 netdev_err(netdev,
1428 "rx packet desc error %x\n", 1417 "rx packet desc error %x\n",
1429 *((u32 *)prrs + 1)); 1418 *((u32 *)prrs + 1));
1430 goto skip_pkt; 1419 goto skip_pkt;
1431 } 1420 }
1432 } 1421 }
@@ -1435,8 +1424,8 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
1435 RRS_PKT_SIZE_MASK) - 4; /* CRC */ 1424 RRS_PKT_SIZE_MASK) - 4; /* CRC */
1436 skb = netdev_alloc_skb_ip_align(netdev, packet_size); 1425 skb = netdev_alloc_skb_ip_align(netdev, packet_size);
1437 if (skb == NULL) { 1426 if (skb == NULL) {
1438 dev_warn(&pdev->dev, "%s: Memory squeeze," 1427 netdev_warn(netdev,
1439 "deferring packet.\n", netdev->name); 1428 "Memory squeeze, deferring packet\n");
1440 goto skip_pkt; 1429 goto skip_pkt;
1441 } 1430 }
1442 skb->dev = netdev; 1431 skb->dev = netdev;
@@ -1450,9 +1439,9 @@ static void atl1e_clean_rx_irq(struct atl1e_adapter *adapter, u8 que,
1450 u16 vlan_tag = (prrs->vtag >> 4) | 1439 u16 vlan_tag = (prrs->vtag >> 4) |
1451 ((prrs->vtag & 7) << 13) | 1440 ((prrs->vtag & 7) << 13) |
1452 ((prrs->vtag & 8) << 9); 1441 ((prrs->vtag & 8) << 9);
1453 dev_dbg(&pdev->dev, 1442 netdev_dbg(netdev,
1454 "RXD VLAN TAG<RRD>=0x%04x\n", 1443 "RXD VLAN TAG<RRD>=0x%04x\n",
1455 prrs->vtag); 1444 prrs->vtag);
1456 vlan_hwaccel_receive_skb(skb, adapter->vlgrp, 1445 vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
1457 vlan_tag); 1446 vlan_tag);
1458 } else { 1447 } else {
@@ -1500,7 +1489,6 @@ static int atl1e_clean(struct napi_struct *napi, int budget)
1500{ 1489{
1501 struct atl1e_adapter *adapter = 1490 struct atl1e_adapter *adapter =
1502 container_of(napi, struct atl1e_adapter, napi); 1491 container_of(napi, struct atl1e_adapter, napi);
1503 struct pci_dev *pdev = adapter->pdev;
1504 u32 imr_data; 1492 u32 imr_data;
1505 int work_done = 0; 1493 int work_done = 0;
1506 1494
@@ -1519,8 +1507,8 @@ quit_polling:
1519 /* test debug */ 1507 /* test debug */
1520 if (test_bit(__AT_DOWN, &adapter->flags)) { 1508 if (test_bit(__AT_DOWN, &adapter->flags)) {
1521 atomic_dec(&adapter->irq_sem); 1509 atomic_dec(&adapter->irq_sem);
1522 dev_err(&pdev->dev, 1510 netdev_err(adapter->netdev,
1523 "atl1e_clean is called when AT_DOWN\n"); 1511 "atl1e_clean is called when AT_DOWN\n");
1524 } 1512 }
1525 /* reenable RX intr */ 1513 /* reenable RX intr */
1526 /*atl1e_irq_enable(adapter); */ 1514 /*atl1e_irq_enable(adapter); */
@@ -1618,7 +1606,6 @@ static u16 atl1e_cal_tdp_req(const struct sk_buff *skb)
1618static int atl1e_tso_csum(struct atl1e_adapter *adapter, 1606static int atl1e_tso_csum(struct atl1e_adapter *adapter,
1619 struct sk_buff *skb, struct atl1e_tpd_desc *tpd) 1607 struct sk_buff *skb, struct atl1e_tpd_desc *tpd)
1620{ 1608{
1621 struct pci_dev *pdev = adapter->pdev;
1622 u8 hdr_len; 1609 u8 hdr_len;
1623 u32 real_len; 1610 u32 real_len;
1624 unsigned short offload_type; 1611 unsigned short offload_type;
@@ -1642,8 +1629,8 @@ static int atl1e_tso_csum(struct atl1e_adapter *adapter,
1642 hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb)); 1629 hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb));
1643 if (unlikely(skb->len == hdr_len)) { 1630 if (unlikely(skb->len == hdr_len)) {
1644 /* only xsum need */ 1631 /* only xsum need */
1645 dev_warn(&pdev->dev, 1632 netdev_warn(adapter->netdev,
1646 "IPV4 tso with zero data??\n"); 1633 "IPV4 tso with zero data??\n");
1647 goto check_sum; 1634 goto check_sum;
1648 } else { 1635 } else {
1649 ip_hdr(skb)->check = 0; 1636 ip_hdr(skb)->check = 0;
@@ -1672,8 +1659,8 @@ check_sum:
1672 1659
1673 cso = skb_transport_offset(skb); 1660 cso = skb_transport_offset(skb);
1674 if (unlikely(cso & 0x1)) { 1661 if (unlikely(cso & 0x1)) {
1675 dev_err(&adapter->pdev->dev, 1662 netdev_err(adapter->netdev,
1676 "pay load offset should not ant event number\n"); 1663 "payload offset should not ant event number\n");
1677 return -1; 1664 return -1;
1678 } else { 1665 } else {
1679 css = cso + skb->csum_offset; 1666 css = cso + skb->csum_offset;
@@ -1886,8 +1873,8 @@ static int atl1e_request_irq(struct atl1e_adapter *adapter)
1886 adapter->have_msi = true; 1873 adapter->have_msi = true;
1887 err = pci_enable_msi(adapter->pdev); 1874 err = pci_enable_msi(adapter->pdev);
1888 if (err) { 1875 if (err) {
1889 dev_dbg(&pdev->dev, 1876 netdev_dbg(adapter->netdev,
1890 "Unable to allocate MSI interrupt Error: %d\n", err); 1877 "Unable to allocate MSI interrupt Error: %d\n", err);
1891 adapter->have_msi = false; 1878 adapter->have_msi = false;
1892 } else 1879 } else
1893 netdev->irq = pdev->irq; 1880 netdev->irq = pdev->irq;
@@ -1898,13 +1885,13 @@ static int atl1e_request_irq(struct atl1e_adapter *adapter)
1898 err = request_irq(adapter->pdev->irq, atl1e_intr, flags, 1885 err = request_irq(adapter->pdev->irq, atl1e_intr, flags,
1899 netdev->name, netdev); 1886 netdev->name, netdev);
1900 if (err) { 1887 if (err) {
1901 dev_dbg(&pdev->dev, 1888 netdev_dbg(adapter->netdev,
1902 "Unable to allocate interrupt Error: %d\n", err); 1889 "Unable to allocate interrupt Error: %d\n", err);
1903 if (adapter->have_msi) 1890 if (adapter->have_msi)
1904 pci_disable_msi(adapter->pdev); 1891 pci_disable_msi(adapter->pdev);
1905 return err; 1892 return err;
1906 } 1893 }
1907 dev_dbg(&pdev->dev, "atl1e_request_irq OK\n"); 1894 netdev_dbg(adapter->netdev, "atl1e_request_irq OK\n");
1908 return err; 1895 return err;
1909} 1896}
1910 1897
@@ -2078,7 +2065,7 @@ static int atl1e_suspend(struct pci_dev *pdev, pm_message_t state)
2078 (atl1e_write_phy_reg(hw, 2065 (atl1e_write_phy_reg(hw,
2079 MII_ADVERTISE, mii_advertise_data) != 0) || 2066 MII_ADVERTISE, mii_advertise_data) != 0) ||
2080 (atl1e_phy_commit(hw)) != 0) { 2067 (atl1e_phy_commit(hw)) != 0) {
2081 dev_dbg(&pdev->dev, "set phy register failed\n"); 2068 netdev_dbg(adapter->netdev, "set phy register failed\n");
2082 goto wol_dis; 2069 goto wol_dis;
2083 } 2070 }
2084 2071
@@ -2100,17 +2087,14 @@ static int atl1e_suspend(struct pci_dev *pdev, pm_message_t state)
2100 } 2087 }
2101 2088
2102 if ((mii_bmsr_data & BMSR_LSTATUS) == 0) 2089 if ((mii_bmsr_data & BMSR_LSTATUS) == 0)
2103 dev_dbg(&pdev->dev, 2090 netdev_dbg(adapter->netdev,
2104 "%s: Link may change" 2091 "Link may change when suspend\n");
2105 "when suspend\n",
2106 atl1e_driver_name);
2107 } 2092 }
2108 wol_ctrl_data |= WOL_LINK_CHG_EN | WOL_LINK_CHG_PME_EN; 2093 wol_ctrl_data |= WOL_LINK_CHG_EN | WOL_LINK_CHG_PME_EN;
2109 /* only link up can wake up */ 2094 /* only link up can wake up */
2110 if (atl1e_write_phy_reg(hw, MII_INT_CTRL, 0x400) != 0) { 2095 if (atl1e_write_phy_reg(hw, MII_INT_CTRL, 0x400) != 0) {
2111 dev_dbg(&pdev->dev, "%s: read write phy " 2096 netdev_dbg(adapter->netdev,
2112 "register failed.\n", 2097 "read write phy register failed\n");
2113 atl1e_driver_name);
2114 goto wol_dis; 2098 goto wol_dis;
2115 } 2099 }
2116 } 2100 }
@@ -2131,9 +2115,8 @@ static int atl1e_suspend(struct pci_dev *pdev, pm_message_t state)
2131 if (wufc & AT_WUFC_MAG) 2115 if (wufc & AT_WUFC_MAG)
2132 mac_ctrl_data |= MAC_CTRL_BC_EN; 2116 mac_ctrl_data |= MAC_CTRL_BC_EN;
2133 2117
2134 dev_dbg(&pdev->dev, 2118 netdev_dbg(adapter->netdev, "suspend MAC=0x%x\n",
2135 "%s: suspend MAC=0x%x\n", 2119 mac_ctrl_data);
2136 atl1e_driver_name, mac_ctrl_data);
2137 2120
2138 AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data); 2121 AT_WRITE_REG(hw, REG_WOL_CTRL, wol_ctrl_data);
2139 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data); 2122 AT_WRITE_REG(hw, REG_MAC_CTRL, mac_ctrl_data);
@@ -2183,8 +2166,8 @@ static int atl1e_resume(struct pci_dev *pdev)
2183 2166
2184 err = pci_enable_device(pdev); 2167 err = pci_enable_device(pdev);
2185 if (err) { 2168 if (err) {
2186 dev_err(&pdev->dev, "ATL1e: Cannot enable PCI" 2169 netdev_err(adapter->netdev,
2187 " device from suspend\n"); 2170 "Cannot enable PCI device from suspend\n");
2188 return err; 2171 return err;
2189 } 2172 }
2190 2173
@@ -2315,7 +2298,7 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
2315 2298
2316 err = atl1e_init_netdev(netdev, pdev); 2299 err = atl1e_init_netdev(netdev, pdev);
2317 if (err) { 2300 if (err) {
2318 dev_err(&pdev->dev, "init netdevice failed\n"); 2301 netdev_err(netdev, "init netdevice failed\n");
2319 goto err_init_netdev; 2302 goto err_init_netdev;
2320 } 2303 }
2321 adapter = netdev_priv(netdev); 2304 adapter = netdev_priv(netdev);
@@ -2326,7 +2309,7 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
2326 adapter->hw.hw_addr = pci_iomap(pdev, BAR_0, 0); 2309 adapter->hw.hw_addr = pci_iomap(pdev, BAR_0, 0);
2327 if (!adapter->hw.hw_addr) { 2310 if (!adapter->hw.hw_addr) {
2328 err = -EIO; 2311 err = -EIO;
2329 dev_err(&pdev->dev, "cannot map device registers\n"); 2312 netdev_err(netdev, "cannot map device registers\n");
2330 goto err_ioremap; 2313 goto err_ioremap;
2331 } 2314 }
2332 netdev->base_addr = (unsigned long)adapter->hw.hw_addr; 2315 netdev->base_addr = (unsigned long)adapter->hw.hw_addr;
@@ -2356,7 +2339,7 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
2356 /* setup the private structure */ 2339 /* setup the private structure */
2357 err = atl1e_sw_init(adapter); 2340 err = atl1e_sw_init(adapter);
2358 if (err) { 2341 if (err) {
2359 dev_err(&pdev->dev, "net device private data init failed\n"); 2342 netdev_err(netdev, "net device private data init failed\n");
2360 goto err_sw_init; 2343 goto err_sw_init;
2361 } 2344 }
2362 2345
@@ -2372,19 +2355,19 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
2372 2355
2373 if (atl1e_read_mac_addr(&adapter->hw) != 0) { 2356 if (atl1e_read_mac_addr(&adapter->hw) != 0) {
2374 err = -EIO; 2357 err = -EIO;
2375 dev_err(&pdev->dev, "get mac address failed\n"); 2358 netdev_err(netdev, "get mac address failed\n");
2376 goto err_eeprom; 2359 goto err_eeprom;
2377 } 2360 }
2378 2361
2379 memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len); 2362 memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
2380 memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len); 2363 memcpy(netdev->perm_addr, adapter->hw.mac_addr, netdev->addr_len);
2381 dev_dbg(&pdev->dev, "mac address : %pM\n", adapter->hw.mac_addr); 2364 netdev_dbg(netdev, "mac address : %pM\n", adapter->hw.mac_addr);
2382 2365
2383 INIT_WORK(&adapter->reset_task, atl1e_reset_task); 2366 INIT_WORK(&adapter->reset_task, atl1e_reset_task);
2384 INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task); 2367 INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task);
2385 err = register_netdev(netdev); 2368 err = register_netdev(netdev);
2386 if (err) { 2369 if (err) {
2387 dev_err(&pdev->dev, "register netdevice failed\n"); 2370 netdev_err(netdev, "register netdevice failed\n");
2388 goto err_register; 2371 goto err_register;
2389 } 2372 }
2390 2373
@@ -2485,8 +2468,8 @@ static pci_ers_result_t atl1e_io_slot_reset(struct pci_dev *pdev)
2485 struct atl1e_adapter *adapter = netdev_priv(netdev); 2468 struct atl1e_adapter *adapter = netdev_priv(netdev);
2486 2469
2487 if (pci_enable_device(pdev)) { 2470 if (pci_enable_device(pdev)) {
2488 dev_err(&pdev->dev, 2471 netdev_err(adapter->netdev,
2489 "ATL1e: Cannot re-enable PCI device after reset.\n"); 2472 "Cannot re-enable PCI device after reset\n");
2490 return PCI_ERS_RESULT_DISCONNECT; 2473 return PCI_ERS_RESULT_DISCONNECT;
2491 } 2474 }
2492 pci_set_master(pdev); 2475 pci_set_master(pdev);
@@ -2514,8 +2497,8 @@ static void atl1e_io_resume(struct pci_dev *pdev)
2514 2497
2515 if (netif_running(netdev)) { 2498 if (netif_running(netdev)) {
2516 if (atl1e_up(adapter)) { 2499 if (atl1e_up(adapter)) {
2517 dev_err(&pdev->dev, 2500 netdev_err(adapter->netdev,
2518 "ATL1e: can't bring device back up after reset\n"); 2501 "can't bring device back up after reset\n");
2519 return; 2502 return;
2520 } 2503 }
2521 } 2504 }
diff --git a/drivers/net/atl1e/atl1e_param.c b/drivers/net/atl1e/atl1e_param.c
index b3be59fd3fb5..0ce60b6e7ef0 100644
--- a/drivers/net/atl1e/atl1e_param.c
+++ b/drivers/net/atl1e/atl1e_param.c
@@ -116,7 +116,7 @@ struct atl1e_option {
116 } arg; 116 } arg;
117}; 117};
118 118
119static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt, struct pci_dev *pdev) 119static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt, struct atl1e_adapter *adapter)
120{ 120{
121 if (*value == OPTION_UNSET) { 121 if (*value == OPTION_UNSET) {
122 *value = opt->def; 122 *value = opt->def;
@@ -127,16 +127,19 @@ static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt,
127 case enable_option: 127 case enable_option:
128 switch (*value) { 128 switch (*value) {
129 case OPTION_ENABLED: 129 case OPTION_ENABLED:
130 dev_info(&pdev->dev, "%s Enabled\n", opt->name); 130 netdev_info(adapter->netdev,
131 "%s Enabled\n", opt->name);
131 return 0; 132 return 0;
132 case OPTION_DISABLED: 133 case OPTION_DISABLED:
133 dev_info(&pdev->dev, "%s Disabled\n", opt->name); 134 netdev_info(adapter->netdev,
135 "%s Disabled\n", opt->name);
134 return 0; 136 return 0;
135 } 137 }
136 break; 138 break;
137 case range_option: 139 case range_option:
138 if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { 140 if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
139 dev_info(&pdev->dev, "%s set to %i\n", opt->name, *value); 141 netdev_info(adapter->netdev, "%s set to %i\n",
142 opt->name, *value);
140 return 0; 143 return 0;
141 } 144 }
142 break; 145 break;
@@ -148,8 +151,8 @@ static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt,
148 ent = &opt->arg.l.p[i]; 151 ent = &opt->arg.l.p[i];
149 if (*value == ent->i) { 152 if (*value == ent->i) {
150 if (ent->str[0] != '\0') 153 if (ent->str[0] != '\0')
151 dev_info(&pdev->dev, "%s\n", 154 netdev_info(adapter->netdev,
152 ent->str); 155 "%s\n", ent->str);
153 return 0; 156 return 0;
154 } 157 }
155 } 158 }
@@ -159,8 +162,8 @@ static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt,
159 BUG(); 162 BUG();
160 } 163 }
161 164
162 dev_info(&pdev->dev, "Invalid %s specified (%i) %s\n", 165 netdev_info(adapter->netdev, "Invalid %s specified (%i) %s\n",
163 opt->name, *value, opt->err); 166 opt->name, *value, opt->err);
164 *value = opt->def; 167 *value = opt->def;
165 return -1; 168 return -1;
166} 169}
@@ -176,11 +179,13 @@ static int __devinit atl1e_validate_option(int *value, struct atl1e_option *opt,
176 */ 179 */
177void __devinit atl1e_check_options(struct atl1e_adapter *adapter) 180void __devinit atl1e_check_options(struct atl1e_adapter *adapter)
178{ 181{
179 struct pci_dev *pdev = adapter->pdev;
180 int bd = adapter->bd_number; 182 int bd = adapter->bd_number;
183
181 if (bd >= ATL1E_MAX_NIC) { 184 if (bd >= ATL1E_MAX_NIC) {
182 dev_notice(&pdev->dev, "no configuration for board #%i\n", bd); 185 netdev_notice(adapter->netdev,
183 dev_notice(&pdev->dev, "Using defaults for all values\n"); 186 "no configuration for board #%i\n", bd);
187 netdev_notice(adapter->netdev,
188 "Using defaults for all values\n");
184 } 189 }
185 190
186 { /* Transmit Ring Size */ 191 { /* Transmit Ring Size */
@@ -196,7 +201,7 @@ void __devinit atl1e_check_options(struct atl1e_adapter *adapter)
196 int val; 201 int val;
197 if (num_tx_desc_cnt > bd) { 202 if (num_tx_desc_cnt > bd) {
198 val = tx_desc_cnt[bd]; 203 val = tx_desc_cnt[bd];
199 atl1e_validate_option(&val, &opt, pdev); 204 atl1e_validate_option(&val, &opt, adapter);
200 adapter->tx_ring.count = (u16) val & 0xFFFC; 205 adapter->tx_ring.count = (u16) val & 0xFFFC;
201 } else 206 } else
202 adapter->tx_ring.count = (u16)opt.def; 207 adapter->tx_ring.count = (u16)opt.def;
@@ -215,7 +220,7 @@ void __devinit atl1e_check_options(struct atl1e_adapter *adapter)
215 int val; 220 int val;
216 if (num_rx_mem_size > bd) { 221 if (num_rx_mem_size > bd) {
217 val = rx_mem_size[bd]; 222 val = rx_mem_size[bd];
218 atl1e_validate_option(&val, &opt, pdev); 223 atl1e_validate_option(&val, &opt, adapter);
219 adapter->rx_ring.page_size = (u32)val * 1024; 224 adapter->rx_ring.page_size = (u32)val * 1024;
220 } else { 225 } else {
221 adapter->rx_ring.page_size = (u32)opt.def * 1024; 226 adapter->rx_ring.page_size = (u32)opt.def * 1024;
@@ -235,7 +240,7 @@ void __devinit atl1e_check_options(struct atl1e_adapter *adapter)
235 int val; 240 int val;
236 if (num_int_mod_timer > bd) { 241 if (num_int_mod_timer > bd) {
237 val = int_mod_timer[bd]; 242 val = int_mod_timer[bd];
238 atl1e_validate_option(&val, &opt, pdev); 243 atl1e_validate_option(&val, &opt, adapter);
239 adapter->hw.imt = (u16) val; 244 adapter->hw.imt = (u16) val;
240 } else 245 } else
241 adapter->hw.imt = (u16)(opt.def); 246 adapter->hw.imt = (u16)(opt.def);
@@ -254,7 +259,7 @@ void __devinit atl1e_check_options(struct atl1e_adapter *adapter)
254 int val; 259 int val;
255 if (num_media_type > bd) { 260 if (num_media_type > bd) {
256 val = media_type[bd]; 261 val = media_type[bd];
257 atl1e_validate_option(&val, &opt, pdev); 262 atl1e_validate_option(&val, &opt, adapter);
258 adapter->hw.media_type = (u16) val; 263 adapter->hw.media_type = (u16) val;
259 } else 264 } else
260 adapter->hw.media_type = (u16)(opt.def); 265 adapter->hw.media_type = (u16)(opt.def);