aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2014-01-11 13:11:24 -0500
committerMarc Kleine-Budde <mkl@pengutronix.de>2014-01-11 13:43:26 -0500
commitea79c1c18520c3a60a2fc8193e2fb58710812d4e (patch)
treea2e02271068a70e9ed463b38ea51ca9ec15dc4da /drivers/net/can
parent40d451181a7fa57e32bca4632ae7b22f80861a73 (diff)
can: ti_hecc: fix endianness related sparse warning
This patch fixes the following sparse warning, which occurs in casts when accessing the data in the CAN frames (struct can_frame) in the RX and TX routines: drivers/net/can/ti_hecc.c:521:17: warning: cast to restricted __be32 drivers/net/can/ti_hecc.c:521:17: warning: cast to restricted __be32 drivers/net/can/ti_hecc.c:521:17: warning: cast to restricted __be32 drivers/net/can/ti_hecc.c:521:17: warning: cast to restricted __be32 drivers/net/can/ti_hecc.c:521:17: warning: cast to restricted __be32 drivers/net/can/ti_hecc.c:521:17: warning: cast to restricted __be32 drivers/net/can/ti_hecc.c:524:25: warning: cast to restricted __be32 drivers/net/can/ti_hecc.c:524:25: warning: cast to restricted __be32 drivers/net/can/ti_hecc.c:524:25: warning: cast to restricted __be32 drivers/net/can/ti_hecc.c:524:25: warning: cast to restricted __be32 drivers/net/can/ti_hecc.c:524:25: warning: cast to restricted __be32 drivers/net/can/ti_hecc.c:524:25: warning: cast to restricted __be32 drivers/net/can/ti_hecc.c:572:28: warning: incorrect type in assignment (different base types) drivers/net/can/ti_hecc.c:572:28: expected unsigned int [unsigned] [usertype] <noident> drivers/net/can/ti_hecc.c:572:28: got restricted __be32 [usertype] <noident> drivers/net/can/ti_hecc.c:575:40: warning: incorrect type in assignment (different base types) drivers/net/can/ti_hecc.c:575:40: expected unsigned int [unsigned] [usertype] <noident> drivers/net/can/ti_hecc.c:575:40: got restricted __be32 [usertype] <noident> As the data is indeed big endian, use "__be32" instead of "u32", when casting it. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/ti_hecc.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
index 60d95b44d0f7..3e2bd9d635ab 100644
--- a/drivers/net/can/ti_hecc.c
+++ b/drivers/net/can/ti_hecc.c
@@ -518,10 +518,10 @@ static netdev_tx_t ti_hecc_xmit(struct sk_buff *skb, struct net_device *ndev)
518 data = (cf->can_id & CAN_SFF_MASK) << 18; 518 data = (cf->can_id & CAN_SFF_MASK) << 18;
519 hecc_write_mbx(priv, mbxno, HECC_CANMID, data); 519 hecc_write_mbx(priv, mbxno, HECC_CANMID, data);
520 hecc_write_mbx(priv, mbxno, HECC_CANMDL, 520 hecc_write_mbx(priv, mbxno, HECC_CANMDL,
521 be32_to_cpu(*(u32 *)(cf->data))); 521 be32_to_cpu(*(__be32 *)(cf->data)));
522 if (cf->can_dlc > 4) 522 if (cf->can_dlc > 4)
523 hecc_write_mbx(priv, mbxno, HECC_CANMDH, 523 hecc_write_mbx(priv, mbxno, HECC_CANMDH,
524 be32_to_cpu(*(u32 *)(cf->data + 4))); 524 be32_to_cpu(*(__be32 *)(cf->data + 4)));
525 else 525 else
526 *(u32 *)(cf->data + 4) = 0; 526 *(u32 *)(cf->data + 4) = 0;
527 can_put_echo_skb(skb, ndev, mbxno); 527 can_put_echo_skb(skb, ndev, mbxno);
@@ -569,12 +569,10 @@ static int ti_hecc_rx_pkt(struct ti_hecc_priv *priv, int mbxno)
569 cf->can_id |= CAN_RTR_FLAG; 569 cf->can_id |= CAN_RTR_FLAG;
570 cf->can_dlc = get_can_dlc(data & 0xF); 570 cf->can_dlc = get_can_dlc(data & 0xF);
571 data = hecc_read_mbx(priv, mbxno, HECC_CANMDL); 571 data = hecc_read_mbx(priv, mbxno, HECC_CANMDL);
572 *(u32 *)(cf->data) = cpu_to_be32(data); 572 *(__be32 *)(cf->data) = cpu_to_be32(data);
573 if (cf->can_dlc > 4) { 573 if (cf->can_dlc > 4) {
574 data = hecc_read_mbx(priv, mbxno, HECC_CANMDH); 574 data = hecc_read_mbx(priv, mbxno, HECC_CANMDH);
575 *(u32 *)(cf->data + 4) = cpu_to_be32(data); 575 *(__be32 *)(cf->data + 4) = cpu_to_be32(data);
576 } else {
577 *(u32 *)(cf->data + 4) = 0;
578 } 576 }
579 spin_lock_irqsave(&priv->mbx_lock, flags); 577 spin_lock_irqsave(&priv->mbx_lock, flags);
580 hecc_clear_bit(priv, HECC_CANME, mbx_mask); 578 hecc_clear_bit(priv, HECC_CANME, mbx_mask);