diff options
author | Richard Röjfors <richard.rojfors@pelagicore.com> | 2010-07-04 09:26:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-05 21:50:56 -0400 |
commit | a99db196db1166a2159add4a3013e5df0ea126fa (patch) | |
tree | 8b968e75fb2f8169f6fab4a6a8827b66abf59167 /drivers/net/ks8842.c | |
parent | c31fd6c25c4619c0745b12cff842721a4bd4202c (diff) |
ks8842: Replace usage of dev_dbg with netdev_dbg
This patch replaces all usage of dev_dbg with netdev_dbg.
A side effect is that the pointer to the platform device in the adapter
struct can be removed.
Signed-off-by: Richard Röjfors <richard.rojfors@pelagicore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ks8842.c')
-rw-r--r-- | drivers/net/ks8842.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/drivers/net/ks8842.c b/drivers/net/ks8842.c index f852ab3ae9cf..d47bba9202e1 100644 --- a/drivers/net/ks8842.c +++ b/drivers/net/ks8842.c | |||
@@ -119,7 +119,6 @@ struct ks8842_adapter { | |||
119 | int irq; | 119 | int irq; |
120 | struct tasklet_struct tasklet; | 120 | struct tasklet_struct tasklet; |
121 | spinlock_t lock; /* spinlock to be interrupt safe */ | 121 | spinlock_t lock; /* spinlock to be interrupt safe */ |
122 | struct platform_device *pdev; | ||
123 | }; | 122 | }; |
124 | 123 | ||
125 | static inline void ks8842_select_bank(struct ks8842_adapter *adapter, u16 bank) | 124 | static inline void ks8842_select_bank(struct ks8842_adapter *adapter, u16 bank) |
@@ -331,8 +330,7 @@ static int ks8842_tx_frame(struct sk_buff *skb, struct net_device *netdev) | |||
331 | u32 *ptr = (u32 *)skb->data; | 330 | u32 *ptr = (u32 *)skb->data; |
332 | u32 ctrl; | 331 | u32 ctrl; |
333 | 332 | ||
334 | dev_dbg(&adapter->pdev->dev, | 333 | netdev_dbg(netdev, "%s: len %u head %p data %p tail %p end %p\n", |
335 | "%s: len %u head %p data %p tail %p end %p\n", | ||
336 | __func__, skb->len, skb->head, skb->data, | 334 | __func__, skb->len, skb->head, skb->data, |
337 | skb_tail_pointer(skb), skb_end_pointer(skb)); | 335 | skb_tail_pointer(skb), skb_end_pointer(skb)); |
338 | 336 | ||
@@ -369,15 +367,13 @@ static void ks8842_rx_frame(struct net_device *netdev, | |||
369 | 367 | ||
370 | status &= 0xffff; | 368 | status &= 0xffff; |
371 | 369 | ||
372 | dev_dbg(&adapter->pdev->dev, "%s - rx_data: status: %x\n", | 370 | netdev_dbg(netdev, "%s - rx_data: status: %x\n", __func__, status); |
373 | __func__, status); | ||
374 | 371 | ||
375 | /* check the status */ | 372 | /* check the status */ |
376 | if ((status & RXSR_VALID) && !(status & RXSR_ERROR)) { | 373 | if ((status & RXSR_VALID) && !(status & RXSR_ERROR)) { |
377 | struct sk_buff *skb = netdev_alloc_skb_ip_align(netdev, len); | 374 | struct sk_buff *skb = netdev_alloc_skb_ip_align(netdev, len); |
378 | 375 | ||
379 | dev_dbg(&adapter->pdev->dev, "%s, got package, len: %d\n", | 376 | netdev_dbg(netdev, "%s, got package, len: %d\n", __func__, len); |
380 | __func__, len); | ||
381 | if (skb) { | 377 | if (skb) { |
382 | u32 *data; | 378 | u32 *data; |
383 | 379 | ||
@@ -400,7 +396,7 @@ static void ks8842_rx_frame(struct net_device *netdev, | |||
400 | } else | 396 | } else |
401 | netdev->stats.rx_dropped++; | 397 | netdev->stats.rx_dropped++; |
402 | } else { | 398 | } else { |
403 | dev_dbg(&adapter->pdev->dev, "RX error, status: %x\n", status); | 399 | netdev_dbg(netdev, "RX error, status: %x\n", status); |
404 | netdev->stats.rx_errors++; | 400 | netdev->stats.rx_errors++; |
405 | if (status & RXSR_TOO_LONG) | 401 | if (status & RXSR_TOO_LONG) |
406 | netdev->stats.rx_length_errors++; | 402 | netdev->stats.rx_length_errors++; |
@@ -423,8 +419,7 @@ static void ks8842_rx_frame(struct net_device *netdev, | |||
423 | void ks8842_handle_rx(struct net_device *netdev, struct ks8842_adapter *adapter) | 419 | void ks8842_handle_rx(struct net_device *netdev, struct ks8842_adapter *adapter) |
424 | { | 420 | { |
425 | u16 rx_data = ks8842_read16(adapter, 16, REG_RXMIR) & 0x1fff; | 421 | u16 rx_data = ks8842_read16(adapter, 16, REG_RXMIR) & 0x1fff; |
426 | dev_dbg(&adapter->pdev->dev, "%s Entry - rx_data: %d\n", | 422 | netdev_dbg(netdev, "%s Entry - rx_data: %d\n", __func__, rx_data); |
427 | __func__, rx_data); | ||
428 | while (rx_data) { | 423 | while (rx_data) { |
429 | ks8842_rx_frame(netdev, adapter); | 424 | ks8842_rx_frame(netdev, adapter); |
430 | rx_data = ks8842_read16(adapter, 16, REG_RXMIR) & 0x1fff; | 425 | rx_data = ks8842_read16(adapter, 16, REG_RXMIR) & 0x1fff; |
@@ -434,7 +429,7 @@ void ks8842_handle_rx(struct net_device *netdev, struct ks8842_adapter *adapter) | |||
434 | void ks8842_handle_tx(struct net_device *netdev, struct ks8842_adapter *adapter) | 429 | void ks8842_handle_tx(struct net_device *netdev, struct ks8842_adapter *adapter) |
435 | { | 430 | { |
436 | u16 sr = ks8842_read16(adapter, 16, REG_TXSR); | 431 | u16 sr = ks8842_read16(adapter, 16, REG_TXSR); |
437 | dev_dbg(&adapter->pdev->dev, "%s - entry, sr: %x\n", __func__, sr); | 432 | netdev_dbg(netdev, "%s - entry, sr: %x\n", __func__, sr); |
438 | netdev->stats.tx_packets++; | 433 | netdev->stats.tx_packets++; |
439 | if (netif_queue_stopped(netdev)) | 434 | if (netif_queue_stopped(netdev)) |
440 | netif_wake_queue(netdev); | 435 | netif_wake_queue(netdev); |
@@ -443,7 +438,7 @@ void ks8842_handle_tx(struct net_device *netdev, struct ks8842_adapter *adapter) | |||
443 | void ks8842_handle_rx_overrun(struct net_device *netdev, | 438 | void ks8842_handle_rx_overrun(struct net_device *netdev, |
444 | struct ks8842_adapter *adapter) | 439 | struct ks8842_adapter *adapter) |
445 | { | 440 | { |
446 | dev_dbg(&adapter->pdev->dev, "%s: entry\n", __func__); | 441 | netdev_dbg(netdev, "%s: entry\n", __func__); |
447 | netdev->stats.rx_errors++; | 442 | netdev->stats.rx_errors++; |
448 | netdev->stats.rx_fifo_errors++; | 443 | netdev->stats.rx_fifo_errors++; |
449 | } | 444 | } |
@@ -462,7 +457,7 @@ void ks8842_tasklet(unsigned long arg) | |||
462 | spin_unlock_irqrestore(&adapter->lock, flags); | 457 | spin_unlock_irqrestore(&adapter->lock, flags); |
463 | 458 | ||
464 | isr = ks8842_read16(adapter, 18, REG_ISR); | 459 | isr = ks8842_read16(adapter, 18, REG_ISR); |
465 | dev_dbg(&adapter->pdev->dev, "%s - ISR: 0x%x\n", __func__, isr); | 460 | netdev_dbg(netdev, "%s - ISR: 0x%x\n", __func__, isr); |
466 | 461 | ||
467 | /* Ack */ | 462 | /* Ack */ |
468 | ks8842_write16(adapter, 18, isr, REG_ISR); | 463 | ks8842_write16(adapter, 18, isr, REG_ISR); |
@@ -501,13 +496,14 @@ void ks8842_tasklet(unsigned long arg) | |||
501 | 496 | ||
502 | static irqreturn_t ks8842_irq(int irq, void *devid) | 497 | static irqreturn_t ks8842_irq(int irq, void *devid) |
503 | { | 498 | { |
504 | struct ks8842_adapter *adapter = devid; | 499 | struct net_device *netdev = devid; |
500 | struct ks8842_adapter *adapter = netdev_priv(netdev); | ||
505 | u16 isr; | 501 | u16 isr; |
506 | u16 entry_bank = ioread16(adapter->hw_addr + REG_SELECT_BANK); | 502 | u16 entry_bank = ioread16(adapter->hw_addr + REG_SELECT_BANK); |
507 | irqreturn_t ret = IRQ_NONE; | 503 | irqreturn_t ret = IRQ_NONE; |
508 | 504 | ||
509 | isr = ks8842_read16(adapter, 18, REG_ISR); | 505 | isr = ks8842_read16(adapter, 18, REG_ISR); |
510 | dev_dbg(&adapter->pdev->dev, "%s - ISR: 0x%x\n", __func__, isr); | 506 | netdev_dbg(netdev, "%s - ISR: 0x%x\n", __func__, isr); |
511 | 507 | ||
512 | if (isr) { | 508 | if (isr) { |
513 | /* disable IRQ */ | 509 | /* disable IRQ */ |
@@ -532,7 +528,7 @@ static int ks8842_open(struct net_device *netdev) | |||
532 | struct ks8842_adapter *adapter = netdev_priv(netdev); | 528 | struct ks8842_adapter *adapter = netdev_priv(netdev); |
533 | int err; | 529 | int err; |
534 | 530 | ||
535 | dev_dbg(&adapter->pdev->dev, "%s - entry\n", __func__); | 531 | netdev_dbg(netdev, "%s - entry\n", __func__); |
536 | 532 | ||
537 | /* reset the HW */ | 533 | /* reset the HW */ |
538 | ks8842_reset_hw(adapter); | 534 | ks8842_reset_hw(adapter); |
@@ -542,7 +538,7 @@ static int ks8842_open(struct net_device *netdev) | |||
542 | ks8842_update_link_status(netdev, adapter); | 538 | ks8842_update_link_status(netdev, adapter); |
543 | 539 | ||
544 | err = request_irq(adapter->irq, ks8842_irq, IRQF_SHARED, DRV_NAME, | 540 | err = request_irq(adapter->irq, ks8842_irq, IRQF_SHARED, DRV_NAME, |
545 | adapter); | 541 | netdev); |
546 | if (err) { | 542 | if (err) { |
547 | pr_err("Failed to request IRQ: %d: %d\n", adapter->irq, err); | 543 | pr_err("Failed to request IRQ: %d: %d\n", adapter->irq, err); |
548 | return err; | 544 | return err; |
@@ -555,10 +551,10 @@ static int ks8842_close(struct net_device *netdev) | |||
555 | { | 551 | { |
556 | struct ks8842_adapter *adapter = netdev_priv(netdev); | 552 | struct ks8842_adapter *adapter = netdev_priv(netdev); |
557 | 553 | ||
558 | dev_dbg(&adapter->pdev->dev, "%s - entry\n", __func__); | 554 | netdev_dbg(netdev, "%s - entry\n", __func__); |
559 | 555 | ||
560 | /* free the irq */ | 556 | /* free the irq */ |
561 | free_irq(adapter->irq, adapter); | 557 | free_irq(adapter->irq, netdev); |
562 | 558 | ||
563 | /* disable the switch */ | 559 | /* disable the switch */ |
564 | ks8842_write16(adapter, 32, 0x0, REG_SW_ID_AND_ENABLE); | 560 | ks8842_write16(adapter, 32, 0x0, REG_SW_ID_AND_ENABLE); |
@@ -572,7 +568,7 @@ static netdev_tx_t ks8842_xmit_frame(struct sk_buff *skb, | |||
572 | int ret; | 568 | int ret; |
573 | struct ks8842_adapter *adapter = netdev_priv(netdev); | 569 | struct ks8842_adapter *adapter = netdev_priv(netdev); |
574 | 570 | ||
575 | dev_dbg(&adapter->pdev->dev, "%s: entry\n", __func__); | 571 | netdev_dbg(netdev, "%s: entry\n", __func__); |
576 | 572 | ||
577 | ret = ks8842_tx_frame(skb, netdev); | 573 | ret = ks8842_tx_frame(skb, netdev); |
578 | 574 | ||
@@ -588,7 +584,7 @@ static int ks8842_set_mac(struct net_device *netdev, void *p) | |||
588 | struct sockaddr *addr = p; | 584 | struct sockaddr *addr = p; |
589 | char *mac = (u8 *)addr->sa_data; | 585 | char *mac = (u8 *)addr->sa_data; |
590 | 586 | ||
591 | dev_dbg(&adapter->pdev->dev, "%s: entry\n", __func__); | 587 | netdev_dbg(netdev, "%s: entry\n", __func__); |
592 | 588 | ||
593 | if (!is_valid_ether_addr(addr->sa_data)) | 589 | if (!is_valid_ether_addr(addr->sa_data)) |
594 | return -EADDRNOTAVAIL; | 590 | return -EADDRNOTAVAIL; |
@@ -604,7 +600,7 @@ static void ks8842_tx_timeout(struct net_device *netdev) | |||
604 | struct ks8842_adapter *adapter = netdev_priv(netdev); | 600 | struct ks8842_adapter *adapter = netdev_priv(netdev); |
605 | unsigned long flags; | 601 | unsigned long flags; |
606 | 602 | ||
607 | dev_dbg(&adapter->pdev->dev, "%s: entry\n", __func__); | 603 | netdev_dbg(netdev, "%s: entry\n", __func__); |
608 | 604 | ||
609 | spin_lock_irqsave(&adapter->lock, flags); | 605 | spin_lock_irqsave(&adapter->lock, flags); |
610 | /* disable interrupts */ | 606 | /* disable interrupts */ |
@@ -663,8 +659,6 @@ static int __devinit ks8842_probe(struct platform_device *pdev) | |||
663 | goto err_get_irq; | 659 | goto err_get_irq; |
664 | } | 660 | } |
665 | 661 | ||
666 | adapter->pdev = pdev; | ||
667 | |||
668 | tasklet_init(&adapter->tasklet, ks8842_tasklet, (unsigned long)netdev); | 662 | tasklet_init(&adapter->tasklet, ks8842_tasklet, (unsigned long)netdev); |
669 | spin_lock_init(&adapter->lock); | 663 | spin_lock_init(&adapter->lock); |
670 | 664 | ||