mirror of
https://github.com/Mange/rtl8192eu-linux-driver
synced 2024-11-22 13:35:00 +00:00
set pipe only once
Set the pipe for reading or writing in usbctrl_vendorreq only once. There's no need to set it again for every retry. This patch is an adaptation of commit 889ed8b5e374 ("staging: rtl8188eu: set pipe only once") for the new r8188eu driver. Link: https://lore.kernel.org/r/20210821164859.4351-10-martin@kaiser.cx
This commit is contained in:
parent
972b1c23e2
commit
cd6cb41e0f
@ -94,14 +94,17 @@ int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, u16 index, void *pda
|
||||
goto release_mutex;
|
||||
}
|
||||
|
||||
while (++vendorreq_times <= MAX_USBCTRL_VENDORREQ_TIMES) {
|
||||
memset(pIo_buf, 0, len);
|
||||
|
||||
if (requesttype == 0x01) {
|
||||
if (requesttype == VENDOR_READ)
|
||||
pipe = usb_rcvctrlpipe(udev, 0);/* read_in */
|
||||
else
|
||||
pipe = usb_sndctrlpipe(udev, 0);/* write_out */
|
||||
|
||||
while (++vendorreq_times <= MAX_USBCTRL_VENDORREQ_TIMES) {
|
||||
|
||||
if (requesttype == VENDOR_READ) {
|
||||
memset(pIo_buf, 0, len);
|
||||
reqtype = REALTEK_USB_VENQT_READ;
|
||||
} else {
|
||||
pipe = usb_sndctrlpipe(udev, 0);/* write_out */
|
||||
reqtype = REALTEK_USB_VENQT_WRITE;
|
||||
_rtw_memcpy(pIo_buf, pdata, len);
|
||||
}
|
||||
@ -110,13 +113,13 @@ int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, u16 index, void *pda
|
||||
|
||||
if (status == len) { /* Success this control transfer. */
|
||||
rtw_reset_continual_io_error(pdvobjpriv);
|
||||
if (requesttype == 0x01) {
|
||||
if (requesttype == VENDOR_READ) {
|
||||
/* For Control read transfer, we have to copy the read data from pIo_buf to pdata. */
|
||||
_rtw_memcpy(pdata, pIo_buf, len);
|
||||
}
|
||||
} else { /* error cases */
|
||||
RTW_INFO("reg 0x%x, usb %s %u fail, status:%d value=0x%x, vendorreq_times:%d\n"
|
||||
, value, (requesttype == 0x01) ? "read" : "write" , len, status, *(u32 *)pdata, vendorreq_times);
|
||||
, value, (requesttype == VENDOR_READ) ? "read" : "write" , len, status, *(u32 *)pdata, vendorreq_times);
|
||||
|
||||
if (status < 0) {
|
||||
if (status == (-ESHUTDOWN) || status == -ENODEV)
|
||||
|
Loading…
Reference in New Issue
Block a user