aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/at91_can.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 12bd6157efdd..7149a8645eef 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -268,7 +268,7 @@ static int at91_set_bittiming(struct net_device *dev)
268 ((bt->prop_seg - 1) << 8) | ((bt->phase_seg1 - 1) << 4) | 268 ((bt->prop_seg - 1) << 8) | ((bt->phase_seg1 - 1) << 4) |
269 ((bt->phase_seg2 - 1) << 0); 269 ((bt->phase_seg2 - 1) << 0);
270 270
271 dev_info(dev->dev.parent, "writing AT91_BR: 0x%08x\n", reg_br); 271 netdev_info(dev, "writing AT91_BR: 0x%08x\n", reg_br);
272 272
273 at91_write(priv, AT91_BR, reg_br); 273 at91_write(priv, AT91_BR, reg_br);
274 274
@@ -369,8 +369,7 @@ static netdev_tx_t at91_start_xmit(struct sk_buff *skb, struct net_device *dev)
369 if (unlikely(!(at91_read(priv, AT91_MSR(mb)) & AT91_MSR_MRDY))) { 369 if (unlikely(!(at91_read(priv, AT91_MSR(mb)) & AT91_MSR_MRDY))) {
370 netif_stop_queue(dev); 370 netif_stop_queue(dev);
371 371
372 dev_err(dev->dev.parent, 372 netdev_err(dev, "BUG! TX buffer full when queue awake!\n");
373 "BUG! TX buffer full when queue awake!\n");
374 return NETDEV_TX_BUSY; 373 return NETDEV_TX_BUSY;
375 } 374 }
376 375
@@ -454,7 +453,7 @@ static void at91_rx_overflow_err(struct net_device *dev)
454 struct sk_buff *skb; 453 struct sk_buff *skb;
455 struct can_frame *cf; 454 struct can_frame *cf;
456 455
457 dev_dbg(dev->dev.parent, "RX buffer overflow\n"); 456 netdev_dbg(dev, "RX buffer overflow\n");
458 stats->rx_over_errors++; 457 stats->rx_over_errors++;
459 stats->rx_errors++; 458 stats->rx_errors++;
460 459
@@ -587,8 +586,8 @@ static int at91_poll_rx(struct net_device *dev, int quota)
587 586
588 if (priv->rx_next > AT91_MB_RX_LOW_LAST && 587 if (priv->rx_next > AT91_MB_RX_LOW_LAST &&
589 reg_sr & AT91_MB_RX_LOW_MASK) 588 reg_sr & AT91_MB_RX_LOW_MASK)
590 dev_info(dev->dev.parent, 589 netdev_info(dev,
591 "order of incoming frames cannot be guaranteed\n"); 590 "order of incoming frames cannot be guaranteed\n");
592 591
593 again: 592 again:
594 for (mb = find_next_bit(addr, AT91_MB_RX_NUM, priv->rx_next); 593 for (mb = find_next_bit(addr, AT91_MB_RX_NUM, priv->rx_next);
@@ -626,7 +625,7 @@ static void at91_poll_err_frame(struct net_device *dev,
626 625
627 /* CRC error */ 626 /* CRC error */
628 if (reg_sr & AT91_IRQ_CERR) { 627 if (reg_sr & AT91_IRQ_CERR) {
629 dev_dbg(dev->dev.parent, "CERR irq\n"); 628 netdev_dbg(dev, "CERR irq\n");
630 dev->stats.rx_errors++; 629 dev->stats.rx_errors++;
631 priv->can.can_stats.bus_error++; 630 priv->can.can_stats.bus_error++;
632 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; 631 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
@@ -634,7 +633,7 @@ static void at91_poll_err_frame(struct net_device *dev,
634 633
635 /* Stuffing Error */ 634 /* Stuffing Error */
636 if (reg_sr & AT91_IRQ_SERR) { 635 if (reg_sr & AT91_IRQ_SERR) {
637 dev_dbg(dev->dev.parent, "SERR irq\n"); 636 netdev_dbg(dev, "SERR irq\n");
638 dev->stats.rx_errors++; 637 dev->stats.rx_errors++;
639 priv->can.can_stats.bus_error++; 638 priv->can.can_stats.bus_error++;
640 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; 639 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
@@ -643,14 +642,14 @@ static void at91_poll_err_frame(struct net_device *dev,
643 642
644 /* Acknowledgement Error */ 643 /* Acknowledgement Error */
645 if (reg_sr & AT91_IRQ_AERR) { 644 if (reg_sr & AT91_IRQ_AERR) {
646 dev_dbg(dev->dev.parent, "AERR irq\n"); 645 netdev_dbg(dev, "AERR irq\n");
647 dev->stats.tx_errors++; 646 dev->stats.tx_errors++;
648 cf->can_id |= CAN_ERR_ACK; 647 cf->can_id |= CAN_ERR_ACK;
649 } 648 }
650 649
651 /* Form error */ 650 /* Form error */
652 if (reg_sr & AT91_IRQ_FERR) { 651 if (reg_sr & AT91_IRQ_FERR) {
653 dev_dbg(dev->dev.parent, "FERR irq\n"); 652 netdev_dbg(dev, "FERR irq\n");
654 dev->stats.rx_errors++; 653 dev->stats.rx_errors++;
655 priv->can.can_stats.bus_error++; 654 priv->can.can_stats.bus_error++;
656 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; 655 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
@@ -659,7 +658,7 @@ static void at91_poll_err_frame(struct net_device *dev,
659 658
660 /* Bit Error */ 659 /* Bit Error */
661 if (reg_sr & AT91_IRQ_BERR) { 660 if (reg_sr & AT91_IRQ_BERR) {
662 dev_dbg(dev->dev.parent, "BERR irq\n"); 661 netdev_dbg(dev, "BERR irq\n");
663 dev->stats.tx_errors++; 662 dev->stats.tx_errors++;
664 priv->can.can_stats.bus_error++; 663 priv->can.can_stats.bus_error++;
665 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; 664 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
@@ -791,7 +790,7 @@ static void at91_irq_err_state(struct net_device *dev,
791 */ 790 */
792 if (new_state >= CAN_STATE_ERROR_WARNING && 791 if (new_state >= CAN_STATE_ERROR_WARNING &&
793 new_state <= CAN_STATE_BUS_OFF) { 792 new_state <= CAN_STATE_BUS_OFF) {
794 dev_dbg(dev->dev.parent, "Error Warning IRQ\n"); 793 netdev_dbg(dev, "Error Warning IRQ\n");
795 priv->can.can_stats.error_warning++; 794 priv->can.can_stats.error_warning++;
796 795
797 cf->can_id |= CAN_ERR_CRTL; 796 cf->can_id |= CAN_ERR_CRTL;
@@ -807,7 +806,7 @@ static void at91_irq_err_state(struct net_device *dev,
807 */ 806 */
808 if (new_state >= CAN_STATE_ERROR_PASSIVE && 807 if (new_state >= CAN_STATE_ERROR_PASSIVE &&
809 new_state <= CAN_STATE_BUS_OFF) { 808 new_state <= CAN_STATE_BUS_OFF) {
810 dev_dbg(dev->dev.parent, "Error Passive IRQ\n"); 809 netdev_dbg(dev, "Error Passive IRQ\n");
811 priv->can.can_stats.error_passive++; 810 priv->can.can_stats.error_passive++;
812 811
813 cf->can_id |= CAN_ERR_CRTL; 812 cf->can_id |= CAN_ERR_CRTL;
@@ -824,7 +823,7 @@ static void at91_irq_err_state(struct net_device *dev,
824 if (new_state <= CAN_STATE_ERROR_PASSIVE) { 823 if (new_state <= CAN_STATE_ERROR_PASSIVE) {
825 cf->can_id |= CAN_ERR_RESTARTED; 824 cf->can_id |= CAN_ERR_RESTARTED;
826 825
827 dev_dbg(dev->dev.parent, "restarted\n"); 826 netdev_dbg(dev, "restarted\n");
828 priv->can.can_stats.restarts++; 827 priv->can.can_stats.restarts++;
829 828
830 netif_carrier_on(dev); 829 netif_carrier_on(dev);
@@ -845,7 +844,7 @@ static void at91_irq_err_state(struct net_device *dev,
845 * circumstances. so just enable AT91_IRQ_ERRP, thus 844 * circumstances. so just enable AT91_IRQ_ERRP, thus
846 * the "fallthrough" 845 * the "fallthrough"
847 */ 846 */
848 dev_dbg(dev->dev.parent, "Error Active\n"); 847 netdev_dbg(dev, "Error Active\n");
849 cf->can_id |= CAN_ERR_PROT; 848 cf->can_id |= CAN_ERR_PROT;
850 cf->data[2] = CAN_ERR_PROT_ACTIVE; 849 cf->data[2] = CAN_ERR_PROT_ACTIVE;
851 case CAN_STATE_ERROR_WARNING: /* fallthrough */ 850 case CAN_STATE_ERROR_WARNING: /* fallthrough */
@@ -863,7 +862,7 @@ static void at91_irq_err_state(struct net_device *dev,
863 862
864 cf->can_id |= CAN_ERR_BUSOFF; 863 cf->can_id |= CAN_ERR_BUSOFF;
865 864
866 dev_dbg(dev->dev.parent, "bus-off\n"); 865 netdev_dbg(dev, "bus-off\n");
867 netif_carrier_off(dev); 866 netif_carrier_off(dev);
868 priv->can.can_stats.bus_off++; 867 priv->can.can_stats.bus_off++;
869 868
@@ -901,7 +900,7 @@ static void at91_irq_err(struct net_device *dev)
901 else if (likely(reg_sr & AT91_IRQ_ERRA)) 900 else if (likely(reg_sr & AT91_IRQ_ERRA))
902 new_state = CAN_STATE_ERROR_ACTIVE; 901 new_state = CAN_STATE_ERROR_ACTIVE;
903 else { 902 else {
904 dev_err(dev->dev.parent, "BUG! hardware in undefined state\n"); 903 netdev_err(dev, "BUG! hardware in undefined state\n");
905 return; 904 return;
906 } 905 }
907 906
@@ -1156,14 +1155,12 @@ static struct platform_driver at91_can_driver = {
1156 1155
1157static int __init at91_can_module_init(void) 1156static int __init at91_can_module_init(void)
1158{ 1157{
1159 printk(KERN_INFO "%s netdevice driver\n", DRV_NAME);
1160 return platform_driver_register(&at91_can_driver); 1158 return platform_driver_register(&at91_can_driver);
1161} 1159}
1162 1160
1163static void __exit at91_can_module_exit(void) 1161static void __exit at91_can_module_exit(void)
1164{ 1162{
1165 platform_driver_unregister(&at91_can_driver); 1163 platform_driver_unregister(&at91_can_driver);
1166 printk(KERN_INFO "%s: driver removed\n", DRV_NAME);
1167} 1164}
1168 1165
1169module_init(at91_can_module_init); 1166module_init(at91_can_module_init);