aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerhard Uttenthaler <uttenthaler@ems-wuensche.com>2015-03-24 14:02:29 -0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2015-04-01 05:08:55 -0400
commit8a4b5b0fb765947ff8d254e6078ca64ac0439a66 (patch)
tree8e42db2fbea7b47ccf6318a20d37ceb3cf70fc64
parent9911674fcf1f239ff3c87e56177c4826e33dfd95 (diff)
can: ems_usb: fix endianess of CAN ID
The device expects the CAN ID in little endian format. Signed-off-by: Gerhard Uttenthaler <uttenthaler@ems-wuensche.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r--drivers/net/can/usb/ems_usb.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 9376f5e5b94e..481f5392970a 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -123,7 +123,7 @@ MODULE_LICENSE("GPL v2");
123 * CPC_MSG_TYPE_EXT_CAN_FRAME or CPC_MSG_TYPE_EXT_RTR_FRAME. 123 * CPC_MSG_TYPE_EXT_CAN_FRAME or CPC_MSG_TYPE_EXT_RTR_FRAME.
124 */ 124 */
125struct cpc_can_msg { 125struct cpc_can_msg {
126 u32 id; 126 __le32 id;
127 u8 length; 127 u8 length;
128 u8 msg[8]; 128 u8 msg[8];
129}; 129};
@@ -765,7 +765,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
765 765
766 msg = (struct ems_cpc_msg *)&buf[CPC_HEADER_SIZE]; 766 msg = (struct ems_cpc_msg *)&buf[CPC_HEADER_SIZE];
767 767
768 msg->msg.can_msg.id = cf->can_id & CAN_ERR_MASK; 768 msg->msg.can_msg.id = cpu_to_le32(cf->can_id & CAN_ERR_MASK);
769 msg->msg.can_msg.length = cf->can_dlc; 769 msg->msg.can_msg.length = cf->can_dlc;
770 770
771 if (cf->can_id & CAN_RTR_FLAG) { 771 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 msg->length = CPC_CAN_MSG_MIN_SIZE + cf->can_dlc; 783 msg->length = CPC_CAN_MSG_MIN_SIZE + cf->can_dlc;
784 } 784 }
785 785
786 /* Respect byte order */
787 msg->msg.can_msg.id = cpu_to_le32(msg->msg.can_msg.id);
788
789 for (i = 0; i < MAX_TX_URBS; i++) { 786 for (i = 0; i < MAX_TX_URBS; i++) {
790 if (dev->tx_contexts[i].echo_index == MAX_TX_URBS) { 787 if (dev->tx_contexts[i].echo_index == MAX_TX_URBS) {
791 context = &dev->tx_contexts[i]; 788 context = &dev->tx_contexts[i];