aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/ti_hecc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/can/ti_hecc.c')
-rw-r--r--drivers/net/can/ti_hecc.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
index 23a7128e4eb7..07e8016b17ec 100644
--- a/drivers/net/can/ti_hecc.c
+++ b/drivers/net/can/ti_hecc.c
@@ -535,18 +535,15 @@ static int ti_hecc_rx_pkt(struct ti_hecc_priv *priv, int mbxno)
535 u32 data, mbx_mask; 535 u32 data, mbx_mask;
536 unsigned long flags; 536 unsigned long flags;
537 537
538 skb = netdev_alloc_skb(priv->ndev, sizeof(struct can_frame)); 538 skb = alloc_can_skb(priv->ndev, &cf);
539 if (!skb) { 539 if (!skb) {
540 if (printk_ratelimit()) 540 if (printk_ratelimit())
541 dev_err(priv->ndev->dev.parent, 541 dev_err(priv->ndev->dev.parent,
542 "ti_hecc_rx_pkt: netdev_alloc_skb() failed\n"); 542 "ti_hecc_rx_pkt: alloc_can_skb() failed\n");
543 return -ENOMEM; 543 return -ENOMEM;
544 } 544 }
545 skb->protocol = __constant_htons(ETH_P_CAN);
546 skb->ip_summed = CHECKSUM_UNNECESSARY;
547 545
548 mbx_mask = BIT(mbxno); 546 mbx_mask = BIT(mbxno);
549 cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
550 data = hecc_read_mbx(priv, mbxno, HECC_CANMID); 547 data = hecc_read_mbx(priv, mbxno, HECC_CANMID);
551 if (data & HECC_CANMID_IDE) 548 if (data & HECC_CANMID_IDE)
552 cf->can_id = (data & CAN_EFF_MASK) | CAN_EFF_FLAG; 549 cf->can_id = (data & CAN_EFF_MASK) | CAN_EFF_FLAG;
@@ -656,19 +653,13 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
656 struct sk_buff *skb; 653 struct sk_buff *skb;
657 654
658 /* propogate the error condition to the can stack */ 655 /* propogate the error condition to the can stack */
659 skb = netdev_alloc_skb(ndev, sizeof(struct can_frame)); 656 skb = alloc_can_err_skb(ndev, &cf);
660 if (!skb) { 657 if (!skb) {
661 if (printk_ratelimit()) 658 if (printk_ratelimit())
662 dev_err(priv->ndev->dev.parent, 659 dev_err(priv->ndev->dev.parent,
663 "ti_hecc_error: netdev_alloc_skb() failed\n"); 660 "ti_hecc_error: alloc_can_err_skb() failed\n");
664 return -ENOMEM; 661 return -ENOMEM;
665 } 662 }
666 skb->protocol = __constant_htons(ETH_P_CAN);
667 skb->ip_summed = CHECKSUM_UNNECESSARY;
668 cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
669 memset(cf, 0, sizeof(struct can_frame));
670 cf->can_id = CAN_ERR_FLAG;
671 cf->can_dlc = CAN_ERR_DLC;
672 663
673 if (int_status & HECC_CANGIF_WLIF) { /* warning level int */ 664 if (int_status & HECC_CANGIF_WLIF) { /* warning level int */
674 if ((int_status & HECC_CANGIF_BOIF) == 0) { 665 if ((int_status & HECC_CANGIF_BOIF) == 0) {