Commit 490b3f4e authored by Rajkumar Manoharan's avatar Rajkumar Manoharan Committed by John W. Linville

ath9k_htc: Fix probe failure if CONFIG_USB_DEBUG enabled

Since the endpoint descriptors (EP3 & EP4) were changed from Interrupt
to Bulk type by firmware, the urb submission done on Bulk pipes.
And the recent commit "check the endpoint type against the pipe type"
added aditional error checking against pipe types under CONFIG_USB_DEBUG.

So bmAttribute has to be updated for both EP3 & EP4 before submitting
urbs on that pipe. This patch resolves the following failure.

[ 2215.710936] usb 1-1: usb_probe_device
[ 2215.710945] usb 1-1: configuration #1 chosen from 1 choice
[ 2215.711152] usb 1-1: adding 1-1:1.0 (config #1, interface 0)
[ 2215.711252] ath9k_hif_usb 1-1:1.0: usb_probe_interface
[ 2215.711255] ath9k_hif_usb 1-1:1.0: usb_probe_interface - got id
[ 2215.712780] usb 1-1: BOGUS urb xfer, pipe 3 != type 1
[ 2215.713782] usb 1-1: ath9k_htc: Unable to allocate URBs
[ 2215.713801] ath9k_hif_usb: probe of 1-1:1.0 failed with error -22
Reported-by: default avatarMing Lei <tom.leiming@gmail.com>
Signed-off-by: default avatarRajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ac618d70
...@@ -541,11 +541,11 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb) ...@@ -541,11 +541,11 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
return; return;
} }
usb_fill_int_urb(urb, hif_dev->udev, usb_fill_bulk_urb(urb, hif_dev->udev,
usb_rcvbulkpipe(hif_dev->udev, usb_rcvbulkpipe(hif_dev->udev,
USB_REG_IN_PIPE), USB_REG_IN_PIPE),
nskb->data, MAX_REG_IN_BUF_SIZE, nskb->data, MAX_REG_IN_BUF_SIZE,
ath9k_hif_usb_reg_in_cb, nskb, 1); ath9k_hif_usb_reg_in_cb, nskb);
ret = usb_submit_urb(urb, GFP_ATOMIC); ret = usb_submit_urb(urb, GFP_ATOMIC);
if (ret) { if (ret) {
...@@ -721,11 +721,11 @@ static int ath9k_hif_usb_alloc_reg_in_urb(struct hif_device_usb *hif_dev) ...@@ -721,11 +721,11 @@ static int ath9k_hif_usb_alloc_reg_in_urb(struct hif_device_usb *hif_dev)
if (!skb) if (!skb)
goto err; goto err;
usb_fill_int_urb(hif_dev->reg_in_urb, hif_dev->udev, usb_fill_bulk_urb(hif_dev->reg_in_urb, hif_dev->udev,
usb_rcvbulkpipe(hif_dev->udev, usb_rcvbulkpipe(hif_dev->udev,
USB_REG_IN_PIPE), USB_REG_IN_PIPE),
skb->data, MAX_REG_IN_BUF_SIZE, skb->data, MAX_REG_IN_BUF_SIZE,
ath9k_hif_usb_reg_in_cb, skb, 1); ath9k_hif_usb_reg_in_cb, skb);
if (usb_submit_urb(hif_dev->reg_in_urb, GFP_KERNEL) != 0) if (usb_submit_urb(hif_dev->reg_in_urb, GFP_KERNEL) != 0)
goto err; goto err;
...@@ -844,14 +844,6 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev) ...@@ -844,14 +844,6 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
goto err_fw_req; goto err_fw_req;
} }
/* Alloc URBs */
ret = ath9k_hif_usb_alloc_urbs(hif_dev);
if (ret) {
dev_err(&hif_dev->udev->dev,
"ath9k_htc: Unable to allocate URBs\n");
goto err_urb;
}
/* Download firmware */ /* Download firmware */
ret = ath9k_hif_usb_download_fw(hif_dev); ret = ath9k_hif_usb_download_fw(hif_dev);
if (ret) { if (ret) {
...@@ -867,16 +859,22 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev) ...@@ -867,16 +859,22 @@ static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
*/ */
for (idx = 0; idx < alt->desc.bNumEndpoints; idx++) { for (idx = 0; idx < alt->desc.bNumEndpoints; idx++) {
endp = &alt->endpoint[idx].desc; endp = &alt->endpoint[idx].desc;
if (((endp->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK) if ((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
== 0x04) && == USB_ENDPOINT_XFER_INT) {
((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
== USB_ENDPOINT_XFER_INT)) {
endp->bmAttributes &= ~USB_ENDPOINT_XFERTYPE_MASK; endp->bmAttributes &= ~USB_ENDPOINT_XFERTYPE_MASK;
endp->bmAttributes |= USB_ENDPOINT_XFER_BULK; endp->bmAttributes |= USB_ENDPOINT_XFER_BULK;
endp->bInterval = 0; endp->bInterval = 0;
} }
} }
/* Alloc URBs */
ret = ath9k_hif_usb_alloc_urbs(hif_dev);
if (ret) {
dev_err(&hif_dev->udev->dev,
"ath9k_htc: Unable to allocate URBs\n");
goto err_urb;
}
return 0; return 0;
err_fw_download: err_fw_download:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment