From: Gerhard Uttenthaler <uttenthaler@ems-wuensche.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Cc: Sebastian Haas <haas@ems-wuensche.com>,
Sebastian Haas <dev@sebastianhaas.info>
Subject: Re: ems_usb: endianess warning
Date: Tue, 24 Mar 2015 19:02:29 +0100 [thread overview]
Message-ID: <5511A6B5.2010507@ems-wuensche.com> (raw)
In-Reply-To: <55044620.60903@pengutronix.de>
Hi Marc,
this took some time, sorry.
Regards
Gerhard
The device expects the id in le format.
Signed-off-by: Gerhard Uttenthaler <uttenthaler@ems-wuensche.com>
---
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 9376f5e..481f539 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");
* CPC_MSG_TYPE_EXT_CAN_FRAME or CPC_MSG_TYPE_EXT_RTR_FRAME.
*/
struct cpc_can_msg {
- u32 id;
+ __le32 id;
u8 length;
u8 msg[8];
};
@@ -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->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;
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
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];
--
Am 14.03.2015 um 15:30 schrieb Marc Kleine-Budde:
> Hello,
>
> when compiling with sparse (make C=2), the ems driver throws the
> following warning, can someone, preferred the driver author :), take
> care of fixing them?
>
>> drivers/net/can/usb/ems_usb.c:312:22: warning: cast to restricted __le32
>> drivers/net/can/usb/ems_usb.c:787:29: warning: incorrect type in assignment (different base types)
>> drivers/net/can/usb/ems_usb.c:787:29: expected unsigned int [unsigned] [usertype] id
>> drivers/net/can/usb/ems_usb.c:787:29: got restricted __le32 [usertype] <noident>
>
> regards,
> Marc
>
--
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
next prev parent reply other threads:[~2015-03-24 18:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-14 14:30 ems_usb: endianess warning Marc Kleine-Budde
2015-03-24 18:02 ` Gerhard Uttenthaler [this message]
2015-03-25 8:34 ` Marc Kleine-Budde
2015-03-25 8:44 ` Marc Kleine-Budde
2015-03-25 9:32 ` Gerhard Uttenthaler
2015-03-25 9:38 ` Marc Kleine-Budde
2015-03-25 10:17 ` Gerhard Uttenthaler
2015-03-25 11:12 ` Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5511A6B5.2010507@ems-wuensche.com \
--to=uttenthaler@ems-wuensche.com \
--cc=dev@sebastianhaas.info \
--cc=haas@ems-wuensche.com \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.