From: Jan Dumon <j.dumon@option.com>
To: linux-usb@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH 2/6] hso: Fix for endian issues on big endian machines
Date: Tue, 5 Jan 2010 15:51:02 +0100 [thread overview]
Message-ID: <20100105145102.GB19825@raptor> (raw)
From: Jan Dumon <j.dumon@option.com>
Some fields are always little endian and have to be converted on big endian
machines.
Signed-off-by: Jan Dumon <j.dumon@option.com>
--- linux-2.6.orig/drivers/net/usb/hso.c
+++ linux-2.6/drivers/net/usb/hso.c
@@ -1028,7 +1028,8 @@ static void read_bulk_callback(struct ur
if (odev->parent->port_spec & HSO_INFO_CRC_BUG) {
u32 rest;
u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
- rest = urb->actual_length % odev->in_endp->wMaxPacketSize;
+ rest = urb->actual_length %
+ le16_to_cpu(odev->in_endp->wMaxPacketSize);
if (((rest == 5) || (rest == 6)) &&
!memcmp(((u8 *) urb->transfer_buffer) +
urb->actual_length - 4, crc_check, 4)) {
@@ -1234,7 +1235,7 @@ static void hso_std_serial_read_bulk_cal
u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
rest =
urb->actual_length %
- serial->in_endp->wMaxPacketSize;
+ le16_to_cpu(serial->in_endp->wMaxPacketSize);
if (((rest == 5) || (rest == 6)) &&
!memcmp(((u8 *) urb->transfer_buffer) +
urb->actual_length - 4, crc_check, 4)) {
@@ -2843,8 +2844,9 @@ struct hso_shared_int *hso_create_shared
dev_err(&interface->dev, "Could not allocate intr urb?");
goto exit;
}
- mux->shared_intr_buf = kzalloc(mux->intr_endp->wMaxPacketSize,
- GFP_KERNEL);
+ mux->shared_intr_buf =
+ kzalloc(le16_to_cpu(mux->intr_endp->wMaxPacketSize),
+ GFP_KERNEL);
if (!mux->shared_intr_buf) {
dev_err(&interface->dev, "Could not allocate intr buf?");
goto exit;
@@ -3241,7 +3243,7 @@ static int hso_mux_submit_intr_urb(struc
usb_rcvintpipe(usb,
shared_int->intr_endp->bEndpointAddress & 0x7F),
shared_int->shared_intr_buf,
- shared_int->intr_endp->wMaxPacketSize,
+ 1,
intr_callback, shared_int,
shared_int->intr_endp->bInterval);
next reply other threads:[~2010-01-05 15:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-05 14:51 Jan Dumon [this message]
2010-01-07 8:44 ` [PATCH 2/6] hso: Fix for endian issues on big endian machines David Miller
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=20100105145102.GB19825@raptor \
--to=j.dumon@option.com \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox