hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/usb/musb/musb_host.c
....@@ -360,7 +360,7 @@
360360 qh = first_qh(head);
361361 break;
362362 }
363
- /* else: fall through */
363
+ fallthrough;
364364
365365 case USB_ENDPOINT_XFER_ISOC:
366366 case USB_ENDPOINT_XFER_INT:
....@@ -1019,7 +1019,7 @@
10191019 musb->ep0_stage = MUSB_EP0_OUT;
10201020 more = true;
10211021 }
1022
- /* FALLTHROUGH */
1022
+ fallthrough;
10231023 case MUSB_EP0_OUT:
10241024 fifo_count = min_t(size_t, qh->maxpacket,
10251025 urb->transfer_buffer_length -
....@@ -1257,7 +1257,7 @@
12571257 MUSB_TXCSR_H_WZC_BITS
12581258 | MUSB_TXCSR_TXPKTRDY);
12591259 }
1260
- return;
1260
+ return;
12611261 }
12621262
12631263 done:
....@@ -1774,9 +1774,15 @@
17741774 status = -EPIPE;
17751775
17761776 } else if (rx_csr & MUSB_RXCSR_H_ERROR) {
1777
- musb_dbg(musb, "end %d RX proto error", epnum);
1777
+ dev_err(musb->controller, "ep%d RX three-strikes error", epnum);
17781778
1779
- status = -EPROTO;
1779
+ /*
1780
+ * The three-strikes error could only happen when the USB
1781
+ * device is not accessible, for example detached or powered
1782
+ * off. So return the fatal error -ESHUTDOWN so hopefully the
1783
+ * USB device drivers won't immediately resubmit the same URB.
1784
+ */
1785
+ status = -ESHUTDOWN;
17801786 musb_writeb(epio, MUSB_RXINTERVAL, 0);
17811787
17821788 rx_csr &= ~MUSB_RXCSR_H_ERROR;
....@@ -2216,7 +2222,7 @@
22162222 interval = max_t(u8, epd->bInterval, 1);
22172223 break;
22182224 }
2219
- /* FALLTHROUGH */
2225
+ fallthrough;
22202226 case USB_ENDPOINT_XFER_ISOC:
22212227 /* ISO always uses logarithmic encoding */
22222228 interval = min_t(u8, epd->bInterval, 16);
....@@ -2543,7 +2549,7 @@
25432549 struct musb_temp_buffer {
25442550 void *kmalloc_ptr;
25452551 void *old_xfer_buffer;
2546
- u8 data[0];
2552
+ u8 data[];
25472553 };
25482554
25492555 static void musb_free_temp_buffer(struct urb *urb)
....@@ -2656,7 +2662,7 @@
26562662 .description = "musb-hcd",
26572663 .product_desc = "MUSB HDRC host driver",
26582664 .hcd_priv_size = sizeof(struct musb *),
2659
- .flags = HCD_USB2 | HCD_MEMORY,
2665
+ .flags = HCD_USB2 | HCD_DMA | HCD_MEMORY,
26602666
26612667 /* not using irq handler or reset hooks from usbcore, since
26622668 * those must be shared with peripheral code for OTG configs