aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/skge.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-02-02 11:22:52 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-06 19:07:44 -0500
commit1479d13cb5304c452e6d7398c7771974c1014846 (patch)
tree3f853a3f913f4612cb7e2af66f755d5b75248742 /drivers/net/skge.c
parentfae87592280039837fdd72c5ecdac2af2eb97f63 (diff)
skge: use dev_printk
Use dev_printk related macros for PCI related errors and warnings Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/skge.c')
-rw-r--r--drivers/net/skge.c69
1 files changed, 31 insertions, 38 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index ce25b6f505c4..9135602e157d 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -2395,7 +2395,7 @@ static int skge_up(struct net_device *dev)
2395 BUG_ON(skge->dma & 7); 2395 BUG_ON(skge->dma & 7);
2396 2396
2397 if ((u64)skge->dma >> 32 != ((u64) skge->dma + skge->mem_size) >> 32) { 2397 if ((u64)skge->dma >> 32 != ((u64) skge->dma + skge->mem_size) >> 32) {
2398 printk(KERN_ERR PFX "pci_alloc_consistent region crosses 4G boundary\n"); 2398 dev_err(&hw->pdev->dev, "pci_alloc_consistent region crosses 4G boundary\n");
2399 err = -EINVAL; 2399 err = -EINVAL;
2400 goto free_pci_mem; 2400 goto free_pci_mem;
2401 } 2401 }
@@ -3004,6 +3004,7 @@ static void skge_mac_intr(struct skge_hw *hw, int port)
3004/* Handle device specific framing and timeout interrupts */ 3004/* Handle device specific framing and timeout interrupts */
3005static void skge_error_irq(struct skge_hw *hw) 3005static void skge_error_irq(struct skge_hw *hw)
3006{ 3006{
3007 struct pci_dev *pdev = hw->pdev;
3007 u32 hwstatus = skge_read32(hw, B0_HWE_ISRC); 3008 u32 hwstatus = skge_read32(hw, B0_HWE_ISRC);
3008 3009
3009 if (hw->chip_id == CHIP_ID_GENESIS) { 3010 if (hw->chip_id == CHIP_ID_GENESIS) {
@@ -3019,12 +3020,12 @@ static void skge_error_irq(struct skge_hw *hw)
3019 } 3020 }
3020 3021
3021 if (hwstatus & IS_RAM_RD_PAR) { 3022 if (hwstatus & IS_RAM_RD_PAR) {
3022 printk(KERN_ERR PFX "Ram read data parity error\n"); 3023 dev_err(&pdev->dev, "Ram read data parity error\n");
3023 skge_write16(hw, B3_RI_CTRL, RI_CLR_RD_PERR); 3024 skge_write16(hw, B3_RI_CTRL, RI_CLR_RD_PERR);
3024 } 3025 }
3025 3026
3026 if (hwstatus & IS_RAM_WR_PAR) { 3027 if (hwstatus & IS_RAM_WR_PAR) {
3027 printk(KERN_ERR PFX "Ram write data parity error\n"); 3028 dev_err(&pdev->dev, "Ram write data parity error\n");
3028 skge_write16(hw, B3_RI_CTRL, RI_CLR_WR_PERR); 3029 skge_write16(hw, B3_RI_CTRL, RI_CLR_WR_PERR);
3029 } 3030 }
3030 3031
@@ -3035,38 +3036,38 @@ static void skge_error_irq(struct skge_hw *hw)
3035 skge_mac_parity(hw, 1); 3036 skge_mac_parity(hw, 1);
3036 3037
3037 if (hwstatus & IS_R1_PAR_ERR) { 3038 if (hwstatus & IS_R1_PAR_ERR) {
3038 printk(KERN_ERR PFX "%s: receive queue parity error\n", 3039 dev_err(&pdev->dev, "%s: receive queue parity error\n",
3039 hw->dev[0]->name); 3040 hw->dev[0]->name);
3040 skge_write32(hw, B0_R1_CSR, CSR_IRQ_CL_P); 3041 skge_write32(hw, B0_R1_CSR, CSR_IRQ_CL_P);
3041 } 3042 }
3042 3043
3043 if (hwstatus & IS_R2_PAR_ERR) { 3044 if (hwstatus & IS_R2_PAR_ERR) {
3044 printk(KERN_ERR PFX "%s: receive queue parity error\n", 3045 dev_err(&pdev->dev, "%s: receive queue parity error\n",
3045 hw->dev[1]->name); 3046 hw->dev[1]->name);
3046 skge_write32(hw, B0_R2_CSR, CSR_IRQ_CL_P); 3047 skge_write32(hw, B0_R2_CSR, CSR_IRQ_CL_P);
3047 } 3048 }
3048 3049
3049 if (hwstatus & (IS_IRQ_MST_ERR|IS_IRQ_STAT)) { 3050 if (hwstatus & (IS_IRQ_MST_ERR|IS_IRQ_STAT)) {
3050 u16 pci_status, pci_cmd; 3051 u16 pci_status, pci_cmd;
3051 3052
3052 pci_read_config_word(hw->pdev, PCI_COMMAND, &pci_cmd); 3053 pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd);
3053 pci_read_config_word(hw->pdev, PCI_STATUS, &pci_status); 3054 pci_read_config_word(pdev, PCI_STATUS, &pci_status);
3054 3055
3055 printk(KERN_ERR PFX "%s: PCI error cmd=%#x status=%#x\n", 3056 dev_err(&pdev->dev, "PCI error cmd=%#x status=%#x\n",
3056 pci_name(hw->pdev), pci_cmd, pci_status); 3057 pci_cmd, pci_status);
3057 3058
3058 /* Write the error bits back to clear them. */ 3059 /* Write the error bits back to clear them. */
3059 pci_status &= PCI_STATUS_ERROR_BITS; 3060 pci_status &= PCI_STATUS_ERROR_BITS;
3060 skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON); 3061 skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
3061 pci_write_config_word(hw->pdev, PCI_COMMAND, 3062 pci_write_config_word(pdev, PCI_COMMAND,
3062 pci_cmd | PCI_COMMAND_SERR | PCI_COMMAND_PARITY); 3063 pci_cmd | PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
3063 pci_write_config_word(hw->pdev, PCI_STATUS, pci_status); 3064 pci_write_config_word(pdev, PCI_STATUS, pci_status);
3064 skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); 3065 skge_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
3065 3066
3066 /* if error still set then just ignore it */ 3067 /* if error still set then just ignore it */
3067 hwstatus = skge_read32(hw, B0_HWE_ISRC); 3068 hwstatus = skge_read32(hw, B0_HWE_ISRC);
3068 if (hwstatus & IS_IRQ_STAT) { 3069 if (hwstatus & IS_IRQ_STAT) {
3069 printk(KERN_INFO PFX "unable to clear error (so ignoring them)\n"); 3070 dev_warn(&hw->pdev->dev, "unable to clear error (so ignoring them)\n");
3070 hw->intr_mask &= ~IS_HW_ERR; 3071 hw->intr_mask &= ~IS_HW_ERR;
3071 } 3072 }
3072 } 3073 }
@@ -3280,8 +3281,8 @@ static int skge_reset(struct skge_hw *hw)
3280 hw->phy_addr = PHY_ADDR_BCOM; 3281 hw->phy_addr = PHY_ADDR_BCOM;
3281 break; 3282 break;
3282 default: 3283 default:
3283 printk(KERN_ERR PFX "%s: unsupported phy type 0x%x\n", 3284 dev_err(&hw->pdev->dev, "unsupported phy type 0x%x\n",
3284 pci_name(hw->pdev), hw->phy_type); 3285 hw->phy_type);
3285 return -EOPNOTSUPP; 3286 return -EOPNOTSUPP;
3286 } 3287 }
3287 break; 3288 break;
@@ -3296,8 +3297,8 @@ static int skge_reset(struct skge_hw *hw)
3296 break; 3297 break;
3297 3298
3298 default: 3299 default:
3299 printk(KERN_ERR PFX "%s: unsupported chip type 0x%x\n", 3300 dev_err(&hw->pdev->dev, "unsupported chip type 0x%x\n",
3300 pci_name(hw->pdev), hw->chip_id); 3301 hw->chip_id);
3301 return -EOPNOTSUPP; 3302 return -EOPNOTSUPP;
3302 } 3303 }
3303 3304
@@ -3337,7 +3338,7 @@ static int skge_reset(struct skge_hw *hw)
3337 /* avoid boards with stuck Hardware error bits */ 3338 /* avoid boards with stuck Hardware error bits */
3338 if ((skge_read32(hw, B0_ISRC) & IS_HW_ERR) && 3339 if ((skge_read32(hw, B0_ISRC) & IS_HW_ERR) &&
3339 (skge_read32(hw, B0_HWE_ISRC) & IS_IRQ_SENSOR)) { 3340 (skge_read32(hw, B0_HWE_ISRC) & IS_IRQ_SENSOR)) {
3340 printk(KERN_WARNING PFX "stuck hardware sensor bit\n"); 3341 dev_warn(&hw->pdev->dev, "stuck hardware sensor bit\n");
3341 hw->intr_mask &= ~IS_HW_ERR; 3342 hw->intr_mask &= ~IS_HW_ERR;
3342 } 3343 }
3343 3344
@@ -3411,7 +3412,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
3411 struct net_device *dev = alloc_etherdev(sizeof(*skge)); 3412 struct net_device *dev = alloc_etherdev(sizeof(*skge));
3412 3413
3413 if (!dev) { 3414 if (!dev) {
3414 printk(KERN_ERR "skge etherdev alloc failed"); 3415 dev_err(&hw->pdev->dev, "etherdev alloc failed\n");
3415 return NULL; 3416 return NULL;
3416 } 3417 }
3417 3418
@@ -3499,15 +3500,13 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3499 3500
3500 err = pci_enable_device(pdev); 3501 err = pci_enable_device(pdev);
3501 if (err) { 3502 if (err) {
3502 printk(KERN_ERR PFX "%s cannot enable PCI device\n", 3503 dev_err(&pdev->dev, "cannot enable PCI device\n");
3503 pci_name(pdev));
3504 goto err_out; 3504 goto err_out;
3505 } 3505 }
3506 3506
3507 err = pci_request_regions(pdev, DRV_NAME); 3507 err = pci_request_regions(pdev, DRV_NAME);
3508 if (err) { 3508 if (err) {
3509 printk(KERN_ERR PFX "%s cannot obtain PCI resources\n", 3509 dev_err(&pdev->dev, "cannot obtain PCI resources\n");
3510 pci_name(pdev));
3511 goto err_out_disable_pdev; 3510 goto err_out_disable_pdev;
3512 } 3511 }
3513 3512
@@ -3522,8 +3521,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3522 } 3521 }
3523 3522
3524 if (err) { 3523 if (err) {
3525 printk(KERN_ERR PFX "%s no usable DMA configuration\n", 3524 dev_err(&pdev->dev, "no usable DMA configuration\n");
3526 pci_name(pdev));
3527 goto err_out_free_regions; 3525 goto err_out_free_regions;
3528 } 3526 }
3529 3527
@@ -3541,8 +3539,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3541 err = -ENOMEM; 3539 err = -ENOMEM;
3542 hw = kzalloc(sizeof(*hw), GFP_KERNEL); 3540 hw = kzalloc(sizeof(*hw), GFP_KERNEL);
3543 if (!hw) { 3541 if (!hw) {
3544 printk(KERN_ERR PFX "%s: cannot allocate hardware struct\n", 3542 dev_err(&pdev->dev, "cannot allocate hardware struct\n");
3545 pci_name(pdev));
3546 goto err_out_free_regions; 3543 goto err_out_free_regions;
3547 } 3544 }
3548 3545
@@ -3553,8 +3550,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3553 3550
3554 hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000); 3551 hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000);
3555 if (!hw->regs) { 3552 if (!hw->regs) {
3556 printk(KERN_ERR PFX "%s: cannot map device registers\n", 3553 dev_err(&pdev->dev, "cannot map device registers\n");
3557 pci_name(pdev));
3558 goto err_out_free_hw; 3554 goto err_out_free_hw;
3559 } 3555 }
3560 3556
@@ -3571,21 +3567,18 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3571 goto err_out_led_off; 3567 goto err_out_led_off;
3572 3568
3573 /* Some motherboards are broken and has zero in ROM. */ 3569 /* Some motherboards are broken and has zero in ROM. */
3574 if (!is_valid_ether_addr(dev->dev_addr)) { 3570 if (!is_valid_ether_addr(dev->dev_addr))
3575 printk(KERN_WARNING PFX "%s: bad (zero?) ethernet address in rom\n", 3571 dev_warn(&pdev->dev, "bad (zero?) ethernet address in rom\n");
3576 pci_name(pdev));
3577 }
3578 3572
3579 err = register_netdev(dev); 3573 err = register_netdev(dev);
3580 if (err) { 3574 if (err) {
3581 printk(KERN_ERR PFX "%s: cannot register net device\n", 3575 dev_err(&pdev->dev, "cannot register net device\n");
3582 pci_name(pdev));
3583 goto err_out_free_netdev; 3576 goto err_out_free_netdev;
3584 } 3577 }
3585 3578
3586 err = request_irq(pdev->irq, skge_intr, IRQF_SHARED, dev->name, hw); 3579 err = request_irq(pdev->irq, skge_intr, IRQF_SHARED, dev->name, hw);
3587 if (err) { 3580 if (err) {
3588 printk(KERN_ERR PFX "%s: cannot assign irq %d\n", 3581 dev_err(&pdev->dev, "%s: cannot assign irq %d\n",
3589 dev->name, pdev->irq); 3582 dev->name, pdev->irq);
3590 goto err_out_unregister; 3583 goto err_out_unregister;
3591 } 3584 }
@@ -3596,7 +3589,7 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3596 skge_show_addr(dev1); 3589 skge_show_addr(dev1);
3597 else { 3590 else {
3598 /* Failure to register second port need not be fatal */ 3591 /* Failure to register second port need not be fatal */
3599 printk(KERN_WARNING PFX "register of second port failed\n"); 3592 dev_warn(&pdev->dev, "register of second port failed\n");
3600 hw->dev[1] = NULL; 3593 hw->dev[1] = NULL;
3601 free_netdev(dev1); 3594 free_netdev(dev1);
3602 } 3595 }