Commit 8a4b5b0f authored by Gerhard Uttenthaler's avatar Gerhard Uttenthaler Committed by Marc Kleine-Budde

can: ems_usb: fix endianess of CAN ID

The device expects the CAN ID in little endian format.
Signed-off-by: default avatarGerhard Uttenthaler <uttenthaler@ems-wuensche.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 9911674f
...@@ -123,7 +123,7 @@ MODULE_LICENSE("GPL v2"); ...@@ -123,7 +123,7 @@ MODULE_LICENSE("GPL v2");
* CPC_MSG_TYPE_EXT_CAN_FRAME or CPC_MSG_TYPE_EXT_RTR_FRAME. * CPC_MSG_TYPE_EXT_CAN_FRAME or CPC_MSG_TYPE_EXT_RTR_FRAME.
*/ */
struct cpc_can_msg { struct cpc_can_msg {
u32 id; __le32 id;
u8 length; u8 length;
u8 msg[8]; u8 msg[8];
}; };
...@@ -765,7 +765,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne ...@@ -765,7 +765,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
msg = (struct ems_cpc_msg *)&buf[CPC_HEADER_SIZE]; msg = (struct ems_cpc_msg *)&buf[CPC_HEADER_SIZE];
msg->msg.can_msg.id = cf->can_id & CAN_ERR_MASK; msg->msg.can_msg.id = cpu_to_le32(cf->can_id & CAN_ERR_MASK);
msg->msg.can_msg.length = cf->can_dlc; msg->msg.can_msg.length = cf->can_dlc;
if (cf->can_id & CAN_RTR_FLAG) { if (cf->can_id & CAN_RTR_FLAG) {
...@@ -783,9 +783,6 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne ...@@ -783,9 +783,6 @@ 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; 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++) { for (i = 0; i < MAX_TX_URBS; i++) {
if (dev->tx_contexts[i].echo_index == MAX_TX_URBS) { if (dev->tx_contexts[i].echo_index == MAX_TX_URBS) {
context = &dev->tx_contexts[i]; context = &dev->tx_contexts[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment