aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dm9000.c
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-02-04 19:02:02 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-11 11:05:23 -0500
commita76836f95d285edcbdcddde5dfaca56e2030f2f5 (patch)
tree23f9ea118a49aae7c82aa0a4e63f30fb48d779b3 /drivers/net/dm9000.c
parent33ba509191dd6c6735cc96d2ba411fa311f9a6be (diff)
DM9000 use dev_xxx() instead of printk for output.
Move to using dev_dbg() and friends for the output of information to the user. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/dm9000.c')
-rw-r--r--drivers/net/dm9000.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index b5e47dfa5529..95563982d19f 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -143,6 +143,8 @@ typedef struct board_info {
143 void (*outblk)(void __iomem *port, void *data, int length); 143 void (*outblk)(void __iomem *port, void *data, int length);
144 void (*dumpblk)(void __iomem *port, int length); 144 void (*dumpblk)(void __iomem *port, int length);
145 145
146 struct device *dev; /* parent device */
147
146 struct resource *addr_res; /* resources found */ 148 struct resource *addr_res; /* resources found */
147 struct resource *data_res; 149 struct resource *data_res;
148 struct resource *addr_req; /* resources requested */ 150 struct resource *addr_req; /* resources requested */
@@ -185,7 +187,8 @@ static void program_eeprom(board_info_t * db);
185static void 187static void
186dm9000_reset(board_info_t * db) 188dm9000_reset(board_info_t * db)
187{ 189{
188 PRINTK1("dm9000x: resetting\n"); 190 dev_dbg(db->dev, "resetting device\n");
191
189 /* RESET device */ 192 /* RESET device */
190 writeb(DM9000_NCR, db->io_addr); 193 writeb(DM9000_NCR, db->io_addr);
191 udelay(200); 194 udelay(200);
@@ -301,14 +304,10 @@ static void dm9000_set_io(struct board_info *db, int byte_width)
301 db->inblk = dm9000_inblk_8bit; 304 db->inblk = dm9000_inblk_8bit;
302 break; 305 break;
303 306
304 case 2:
305 db->dumpblk = dm9000_dumpblk_16bit;
306 db->outblk = dm9000_outblk_16bit;
307 db->inblk = dm9000_inblk_16bit;
308 break;
309 307
310 case 3: 308 case 3:
311 printk(KERN_ERR PFX ": 3 byte IO, falling back to 16bit\n"); 309 dev_dbg(db->dev, ": 3 byte IO, falling back to 16bit\n");
310 case 2:
312 db->dumpblk = dm9000_dumpblk_16bit; 311 db->dumpblk = dm9000_dumpblk_16bit;
313 db->outblk = dm9000_outblk_16bit; 312 db->outblk = dm9000_outblk_16bit;
314 db->inblk = dm9000_inblk_16bit; 313 db->inblk = dm9000_inblk_16bit;
@@ -411,18 +410,20 @@ dm9000_probe(struct platform_device *pdev)
411 /* Init network device */ 410 /* Init network device */
412 ndev = alloc_etherdev(sizeof (struct board_info)); 411 ndev = alloc_etherdev(sizeof (struct board_info));
413 if (!ndev) { 412 if (!ndev) {
414 printk("%s: could not allocate device.\n", CARDNAME); 413 dev_err(&pdev->dev, "could not allocate device.\n");
415 return -ENOMEM; 414 return -ENOMEM;
416 } 415 }
417 416
418 SET_NETDEV_DEV(ndev, &pdev->dev); 417 SET_NETDEV_DEV(ndev, &pdev->dev);
419 418
420 PRINTK2("dm9000_probe()"); 419 dev_dbg(&pdev->dev, "dm9000_probe()");
421 420
422 /* setup board info structure */ 421 /* setup board info structure */
423 db = (struct board_info *) ndev->priv; 422 db = (struct board_info *) ndev->priv;
424 memset(db, 0, sizeof (*db)); 423 memset(db, 0, sizeof (*db));
425 424
425 db->dev = &pdev->dev;
426
426 spin_lock_init(&db->lock); 427 spin_lock_init(&db->lock);
427 428
428 if (pdev->num_resources < 2) { 429 if (pdev->num_resources < 2) {
@@ -451,7 +452,7 @@ dm9000_probe(struct platform_device *pdev)
451 452
452 if (db->addr_res == NULL || db->data_res == NULL || 453 if (db->addr_res == NULL || db->data_res == NULL ||
453 db->irq_res == NULL) { 454 db->irq_res == NULL) {
454 printk(KERN_ERR PFX "insufficient resources\n"); 455 dev_err(db->dev, "insufficient resources\n");
455 ret = -ENOENT; 456 ret = -ENOENT;
456 goto out; 457 goto out;
457 } 458 }
@@ -461,7 +462,7 @@ dm9000_probe(struct platform_device *pdev)
461 pdev->name); 462 pdev->name);
462 463
463 if (db->addr_req == NULL) { 464 if (db->addr_req == NULL) {
464 printk(KERN_ERR PFX "cannot claim address reg area\n"); 465 dev_err(db->dev, "cannot claim address reg area\n");
465 ret = -EIO; 466 ret = -EIO;
466 goto out; 467 goto out;
467 } 468 }
@@ -469,7 +470,7 @@ dm9000_probe(struct platform_device *pdev)
469 db->io_addr = ioremap(db->addr_res->start, i); 470 db->io_addr = ioremap(db->addr_res->start, i);
470 471
471 if (db->io_addr == NULL) { 472 if (db->io_addr == NULL) {
472 printk(KERN_ERR "failed to ioremap address reg\n"); 473 dev_err(db->dev, "failed to ioremap address reg\n");
473 ret = -EINVAL; 474 ret = -EINVAL;
474 goto out; 475 goto out;
475 } 476 }
@@ -479,7 +480,7 @@ dm9000_probe(struct platform_device *pdev)
479 pdev->name); 480 pdev->name);
480 481
481 if (db->data_req == NULL) { 482 if (db->data_req == NULL) {
482 printk(KERN_ERR PFX "cannot claim data reg area\n"); 483 dev_err(db->dev, "cannot claim data reg area\n");
483 ret = -EIO; 484 ret = -EIO;
484 goto out; 485 goto out;
485 } 486 }
@@ -487,7 +488,7 @@ dm9000_probe(struct platform_device *pdev)
487 db->io_data = ioremap(db->data_res->start, iosize); 488 db->io_data = ioremap(db->data_res->start, iosize);
488 489
489 if (db->io_data == NULL) { 490 if (db->io_data == NULL) {
490 printk(KERN_ERR "failed to ioremap data reg\n"); 491 dev_err(db->dev,"failed to ioremap data reg\n");
491 ret = -EINVAL; 492 ret = -EINVAL;
492 goto out; 493 goto out;
493 } 494 }
@@ -541,11 +542,11 @@ dm9000_probe(struct platform_device *pdev)
541 542
542 if (id_val == DM9000_ID) 543 if (id_val == DM9000_ID)
543 break; 544 break;
544 printk("%s: read wrong id 0x%08x\n", CARDNAME, id_val); 545 dev_err(db->dev, "read wrong id 0x%08x\n", id_val);
545 } 546 }
546 547
547 if (id_val != DM9000_ID) { 548 if (id_val != DM9000_ID) {
548 printk("%s: wrong id: 0x%08x\n", CARDNAME, id_val); 549 dev_err(db->dev, "wrong id: 0x%08x\n", id_val);
549 ret = -ENODEV; 550 ret = -ENODEV;
550 goto out; 551 goto out;
551 } 552 }
@@ -593,8 +594,8 @@ dm9000_probe(struct platform_device *pdev)
593 } 594 }
594 595
595 if (!is_valid_ether_addr(ndev->dev_addr)) 596 if (!is_valid_ether_addr(ndev->dev_addr))
596 printk("%s: Invalid ethernet MAC address. Please " 597 dev_warn(db->dev, "%s: Invalid ethernet MAC address. Please "
597 "set using ifconfig\n", ndev->name); 598 "set using ifconfig\n", ndev->name);
598 599
599 platform_set_drvdata(pdev, ndev); 600 platform_set_drvdata(pdev, ndev);
600 ret = register_netdev(ndev); 601 ret = register_netdev(ndev);
@@ -608,7 +609,7 @@ dm9000_probe(struct platform_device *pdev)
608 return 0; 609 return 0;
609 610
610out: 611out:
611 printk("%s: not found (%d).\n", CARDNAME, ret); 612 dev_err(db->dev, "not found (%d).\n", ret);
612 613
613 dm9000_release_board(pdev, db); 614 dm9000_release_board(pdev, db);
614 free_netdev(ndev); 615 free_netdev(ndev);
@@ -625,7 +626,7 @@ dm9000_open(struct net_device *dev)
625{ 626{
626 board_info_t *db = (board_info_t *) dev->priv; 627 board_info_t *db = (board_info_t *) dev->priv;
627 628
628 PRINTK2("entering dm9000_open\n"); 629 dev_dbg(db->dev, "entering %s\n", __func__);
629 630
630 if (request_irq(dev->irq, &dm9000_interrupt, DM9000_IRQ_FLAGS, dev->name, dev)) 631 if (request_irq(dev->irq, &dm9000_interrupt, DM9000_IRQ_FLAGS, dev->name, dev))
631 return -EAGAIN; 632 return -EAGAIN;
@@ -900,7 +901,7 @@ dm9000_rx(struct net_device *dev)
900 901
901 /* Status check: this byte must be 0 or 1 */ 902 /* Status check: this byte must be 0 or 1 */
902 if (rxbyte > DM9000_PKT_RDY) { 903 if (rxbyte > DM9000_PKT_RDY) {
903 printk("status check failed: %d\n", rxbyte); 904 dev_warn(db->dev, "status check fail: %d\n", rxbyte);
904 iow(db, DM9000_RCR, 0x00); /* Stop Device */ 905 iow(db, DM9000_RCR, 0x00); /* Stop Device */
905 iow(db, DM9000_ISR, IMR_PAR); /* Stop INT request */ 906 iow(db, DM9000_ISR, IMR_PAR); /* Stop INT request */
906 return; 907 return;
@@ -920,25 +921,25 @@ dm9000_rx(struct net_device *dev)
920 /* Packet Status check */ 921 /* Packet Status check */
921 if (RxLen < 0x40) { 922 if (RxLen < 0x40) {
922 GoodPacket = false; 923 GoodPacket = false;
923 PRINTK1("Bad Packet received (runt)\n"); 924 dev_dbg(db->dev, "Bad Packet received (runt)\n");
924 } 925 }
925 926
926 if (RxLen > DM9000_PKT_MAX) { 927 if (RxLen > DM9000_PKT_MAX) {
927 PRINTK1("RST: RX Len:%x\n", RxLen); 928 dev_dbg(db->dev, "RST: RX Len:%x\n", RxLen);
928 } 929 }
929 930
930 if (rxhdr.RxStatus & 0xbf) { 931 if (rxhdr.RxStatus & 0xbf) {
931 GoodPacket = false; 932 GoodPacket = false;
932 if (rxhdr.RxStatus & 0x01) { 933 if (rxhdr.RxStatus & 0x01) {
933 PRINTK1("fifo error\n"); 934 dev_dbg(db->dev, "fifo error\n");
934 dev->stats.rx_fifo_errors++; 935 dev->stats.rx_fifo_errors++;
935 } 936 }
936 if (rxhdr.RxStatus & 0x02) { 937 if (rxhdr.RxStatus & 0x02) {
937 PRINTK1("crc error\n"); 938 dev_dbg(db->dev, "crc error\n");
938 dev->stats.rx_crc_errors++; 939 dev->stats.rx_crc_errors++;
939 } 940 }
940 if (rxhdr.RxStatus & 0x80) { 941 if (rxhdr.RxStatus & 0x80) {
941 PRINTK1("length error\n"); 942 dev_dbg(db->dev, "length error\n");
942 dev->stats.rx_length_errors++; 943 dev->stats.rx_length_errors++;
943 } 944 }
944 } 945 }
@@ -1187,8 +1188,7 @@ dm9000_drv_remove(struct platform_device *pdev)
1187 dm9000_release_board(pdev, (board_info_t *) ndev->priv); 1188 dm9000_release_board(pdev, (board_info_t *) ndev->priv);
1188 free_netdev(ndev); /* free device structure */ 1189 free_netdev(ndev); /* free device structure */
1189 1190
1190 PRINTK1("clean_module() exit\n"); 1191 dev_dbg(&pdev->dev, "released and freed device\n");
1191
1192 return 0; 1192 return 0;
1193} 1193}
1194 1194