ems_usb: Fix byte order issues on big endian machines
Subsystems (3)
PATCH 1/1 ems_usb: Fix byte order issues on big endian machines
CPC-USB is using a ARM7 core with little endian byte order. The "id" field in can_msg needs byte order conversion from/to CPU byte order.
Signed-off-by Sebastian Haas <[email protected]>
---
drivers/net/can/usb/ems_usb.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/can/usb/ems_usb.c +4 -1
@@ -319,7 +319,7 @@ static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg) cf = (struct can_frame *)skb_put (skb,sizeof (struct can_frame )); - cf->can_id = msg->msg.can_msg.id; + cf->can_id =le32_to_cpu (msg->msg.can_msg.id); cf->can_dlc =min_t (u8, msg->msg.can_msg.length,8 ); if (msg->type == CPC_MSG_TYPE_EXT_CAN_FRAME
@@ -813,6 +813,9 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne msg->length =CPC_CAN_MSG_MIN_SIZE + cf->can_dlc; } +/* Respect byte order */ + msg->msg.can_msg.id =cpu_to_le32 (msg->msg.can_msg.id); +for (i =0 ; i <MAX_TX_URBS ; i++) {if (dev->tx_contexts[i].echo_index ==MAX_TX_URBS ) { context = &dev->tx_contexts[i];
Signature · 7 lines
EMS Dr. Thomas Wuensche e.K. Sonnenhang 3 85304 Ilmmuenster HRA Neuburg a.d. Donau, HR-Nr. 70.106 Phone: +49-8441-490260 Fax : +49-8441-81860 http://www.ems-wuensche.com
A message that is not in the archive (sent off-list or not yet received): 20091104154824.18199.15573.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]
Quoted 4 lines · Sebastian Haas
CPC-USB is using a ARM7 core with little endian byte order. The "id" field in
can_msgneeds byte order conversion from/to CPU byte order.Signed-off-by Sebastian Haas <[email protected]>
Signed-off-by Wolfgang Grandegger <[email protected]>
Thanks.
Wolfgang.
From: Sebastian Haas <[email protected]>
Date: Wed, 04 Nov 2009 16:48:24 +0100
Quoted 4 lines
CPC-USB is using a ARM7 core with little endian byte order. The "id" field in
can_msgneeds byte order conversion from/to CPU byte order.Signed-off-by Sebastian Haas <[email protected]>
Applied to net-2.6