summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi/usb.c
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2011-11-17 12:14:44 -0600
committerJohn W. Linville <linville@tuxdriver.com>2011-11-21 16:20:46 -0500
commitabfabc9b48f6943dbb707fcfc2ef2a04c329e3e8 (patch)
tree608f73989a2fe7d5f5967cd6ab76701ed2f6d173 /drivers/net/wireless/rtlwifi/usb.c
parentff6ff96b5ba5b39f7ab3d8ea0cf9ec414452ac92 (diff)
downloadblackbird-op-linux-abfabc9b48f6943dbb707fcfc2ef2a04c329e3e8.tar.gz
blackbird-op-linux-abfabc9b48f6943dbb707fcfc2ef2a04c329e3e8.zip
rtlwifi: rtl8192cu: Fix endianian issues
Driver rtlwifi fails on a big-endian host. These changes have been tested on a Mac PowerBook G4, which has a PPC processor. Although this patch touches some of the code that will affect endian issues on PCI hardware through drivers rtl8192ce, rtl8192se, and rtl8192de, these have not been tested due to lack of suitable hardware. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi/usb.c')
-rw-r--r--drivers/net/wireless/rtlwifi/usb.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index a461822c05b3..79889b83287e 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -82,6 +82,7 @@ static int _usbctrl_vendorreq_async_write(struct usb_device *udev, u8 request,
dr->wValue = cpu_to_le16(value);
dr->wIndex = cpu_to_le16(index);
dr->wLength = cpu_to_le16(len);
+ /* data are already in little-endian order */
memcpy(buf, pdata, len);
usb_fill_control_urb(urb, udev, pipe,
(unsigned char *)dr, buf, len,
@@ -101,6 +102,7 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request,
int status;
u8 reqtype;
int vendorreq_times = 0;
+ static int count;
pipe = usb_rcvctrlpipe(udev, 0); /* read_in */
reqtype = REALTEK_USB_VENQT_READ;
@@ -117,9 +119,9 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request,
break;
}
}
- if (status < 0)
+ if (status < 0 && count++ < 4)
pr_err("reg 0x%x, usbctrl_vendorreq TimeOut! status:0x%x value=0x%x\n",
- value, status, *(u32 *)pdata);
+ value, status, le32_to_cpu(*(u32 *)pdata));
return status;
}
@@ -139,7 +141,7 @@ static u32 _usb_read_sync(struct usb_device *udev, u32 addr, u16 len)
wvalue = (u16)addr;
_usbctrl_vendorreq_sync_read(udev, request, wvalue, index, data, len);
- ret = *data;
+ ret = le32_to_cpu(*data);
kfree(data);
return ret;
}
@@ -171,12 +173,12 @@ static void _usb_write_async(struct usb_device *udev, u32 addr, u32 val,
u8 request;
u16 wvalue;
u16 index;
- u32 data;
+ __le32 data;
request = REALTEK_USB_VENQT_CMD_REQ;
index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */
wvalue = (u16)(addr&0x0000ffff);
- data = val;
+ data = cpu_to_le32(val);
_usbctrl_vendorreq_async_write(udev, request, wvalue, index, &data,
len);
}
OpenPOWER on IntegriCloud