diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-09-14 11:59:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-09-14 11:59:48 -0400 |
commit | 1abc088afd5b8b64582510dd9f801fd215a87feb (patch) | |
tree | e5b81cd827f028e5be4f9e3c49b865e23ae59a8c | |
parent | c284cf062191237abfda57dd526cd10afc8abb19 (diff) | |
parent | df3aa13c7bbb307e172c37f193f9a7aa058d4739 (diff) |
Merge tag 'usb-4.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH:
"Here are a number of small USB driver fixes for -rc4.
The usual suspects of gadget, xhci, and dwc2/3 are in here, along with
some reverts of reported problem changes, and a number of build
documentation warning fixes. Full details are in the shortlog.
All of these have been in linux-next with no reported issues"
* tag 'usb-4.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (28 commits)
Revert "cdc-acm: implement put_char() and flush_chars()"
usb: Change usb_of_get_companion_dev() place to usb/common
usb: xhci: fix interrupt transfer error happened on MTK platforms
usb: cdc-wdm: Fix a sleep-in-atomic-context bug in service_outstanding_interrupt()
usb: misc: uss720: Fix two sleep-in-atomic-context bugs
usb: host: u132-hcd: Fix a sleep-in-atomic-context bug in u132_get_frame()
usb: Avoid use-after-free by flushing endpoints early in usb_set_interface()
linux/mod_devicetable.h: fix kernel-doc missing notation for typec_device_id
usb/typec: fix kernel-doc notation warning for typec_match_altmode
usb: Don't die twice if PCI xhci host is not responding in resume
usb: mtu3: fix error of xhci port id when enable U3 dual role
usb: uas: add support for more quirk flags
USB: Add quirk to support DJI CineSSD
usb: typec: fix kernel-doc parameter warning
usb/dwc3/gadget: fix kernel-doc parameter warning
USB: yurex: Check for truncation in yurex_read()
USB: yurex: Fix buffer over-read in yurex_write()
usb: host: xhci-plat: Iterate over parent nodes for finding quirks
xhci: Fix use after free for URB cancellation on a reallocated endpoint
USB: add quirk for WORLDE Controller KS49 or Prodipe MIDI 49C USB controller
...
31 files changed, 189 insertions, 145 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 27346d69f393..f9b40a9dc4d3 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -780,20 +780,9 @@ static int acm_tty_write(struct tty_struct *tty, | |||
780 | } | 780 | } |
781 | 781 | ||
782 | if (acm->susp_count) { | 782 | if (acm->susp_count) { |
783 | if (acm->putbuffer) { | ||
784 | /* now to preserve order */ | ||
785 | usb_anchor_urb(acm->putbuffer->urb, &acm->delayed); | ||
786 | acm->putbuffer = NULL; | ||
787 | } | ||
788 | usb_anchor_urb(wb->urb, &acm->delayed); | 783 | usb_anchor_urb(wb->urb, &acm->delayed); |
789 | spin_unlock_irqrestore(&acm->write_lock, flags); | 784 | spin_unlock_irqrestore(&acm->write_lock, flags); |
790 | return count; | 785 | return count; |
791 | } else { | ||
792 | if (acm->putbuffer) { | ||
793 | /* at this point there is no good way to handle errors */ | ||
794 | acm_start_wb(acm, acm->putbuffer); | ||
795 | acm->putbuffer = NULL; | ||
796 | } | ||
797 | } | 786 | } |
798 | 787 | ||
799 | stat = acm_start_wb(acm, wb); | 788 | stat = acm_start_wb(acm, wb); |
@@ -804,66 +793,6 @@ static int acm_tty_write(struct tty_struct *tty, | |||
804 | return count; | 793 | return count; |
805 | } | 794 | } |
806 | 795 | ||
807 | static void acm_tty_flush_chars(struct tty_struct *tty) | ||
808 | { | ||
809 | struct acm *acm = tty->driver_data; | ||
810 | struct acm_wb *cur; | ||
811 | int err; | ||
812 | unsigned long flags; | ||
813 | |||
814 | spin_lock_irqsave(&acm->write_lock, flags); | ||
815 | |||
816 | cur = acm->putbuffer; | ||
817 | if (!cur) /* nothing to do */ | ||
818 | goto out; | ||
819 | |||
820 | acm->putbuffer = NULL; | ||
821 | err = usb_autopm_get_interface_async(acm->control); | ||
822 | if (err < 0) { | ||
823 | cur->use = 0; | ||
824 | acm->putbuffer = cur; | ||
825 | goto out; | ||
826 | } | ||
827 | |||
828 | if (acm->susp_count) | ||
829 | usb_anchor_urb(cur->urb, &acm->delayed); | ||
830 | else | ||
831 | acm_start_wb(acm, cur); | ||
832 | out: | ||
833 | spin_unlock_irqrestore(&acm->write_lock, flags); | ||
834 | return; | ||
835 | } | ||
836 | |||
837 | static int acm_tty_put_char(struct tty_struct *tty, unsigned char ch) | ||
838 | { | ||
839 | struct acm *acm = tty->driver_data; | ||
840 | struct acm_wb *cur; | ||
841 | int wbn; | ||
842 | unsigned long flags; | ||
843 | |||
844 | overflow: | ||
845 | cur = acm->putbuffer; | ||
846 | if (!cur) { | ||
847 | spin_lock_irqsave(&acm->write_lock, flags); | ||
848 | wbn = acm_wb_alloc(acm); | ||
849 | if (wbn >= 0) { | ||
850 | cur = &acm->wb[wbn]; | ||
851 | acm->putbuffer = cur; | ||
852 | } | ||
853 | spin_unlock_irqrestore(&acm->write_lock, flags); | ||
854 | if (!cur) | ||
855 | return 0; | ||
856 | } | ||
857 | |||
858 | if (cur->len == acm->writesize) { | ||
859 | acm_tty_flush_chars(tty); | ||
860 | goto overflow; | ||
861 | } | ||
862 | |||
863 | cur->buf[cur->len++] = ch; | ||
864 | return 1; | ||
865 | } | ||
866 | |||
867 | static int acm_tty_write_room(struct tty_struct *tty) | 796 | static int acm_tty_write_room(struct tty_struct *tty) |
868 | { | 797 | { |
869 | struct acm *acm = tty->driver_data; | 798 | struct acm *acm = tty->driver_data; |
@@ -1987,8 +1916,6 @@ static const struct tty_operations acm_ops = { | |||
1987 | .cleanup = acm_tty_cleanup, | 1916 | .cleanup = acm_tty_cleanup, |
1988 | .hangup = acm_tty_hangup, | 1917 | .hangup = acm_tty_hangup, |
1989 | .write = acm_tty_write, | 1918 | .write = acm_tty_write, |
1990 | .put_char = acm_tty_put_char, | ||
1991 | .flush_chars = acm_tty_flush_chars, | ||
1992 | .write_room = acm_tty_write_room, | 1919 | .write_room = acm_tty_write_room, |
1993 | .ioctl = acm_tty_ioctl, | 1920 | .ioctl = acm_tty_ioctl, |
1994 | .throttle = acm_tty_throttle, | 1921 | .throttle = acm_tty_throttle, |
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index eacc116e83da..ca06b20d7af9 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h | |||
@@ -96,7 +96,6 @@ struct acm { | |||
96 | unsigned long read_urbs_free; | 96 | unsigned long read_urbs_free; |
97 | struct urb *read_urbs[ACM_NR]; | 97 | struct urb *read_urbs[ACM_NR]; |
98 | struct acm_rb read_buffers[ACM_NR]; | 98 | struct acm_rb read_buffers[ACM_NR]; |
99 | struct acm_wb *putbuffer; /* for acm_tty_put_char() */ | ||
100 | int rx_buflimit; | 99 | int rx_buflimit; |
101 | spinlock_t read_lock; | 100 | spinlock_t read_lock; |
102 | u8 *notification_buffer; /* to reassemble fragmented notifications */ | 101 | u8 *notification_buffer; /* to reassemble fragmented notifications */ |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index bec581fb7c63..656d247819c9 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -460,7 +460,7 @@ static int service_outstanding_interrupt(struct wdm_device *desc) | |||
460 | 460 | ||
461 | set_bit(WDM_RESPONDING, &desc->flags); | 461 | set_bit(WDM_RESPONDING, &desc->flags); |
462 | spin_unlock_irq(&desc->iuspin); | 462 | spin_unlock_irq(&desc->iuspin); |
463 | rv = usb_submit_urb(desc->response, GFP_KERNEL); | 463 | rv = usb_submit_urb(desc->response, GFP_ATOMIC); |
464 | spin_lock_irq(&desc->iuspin); | 464 | spin_lock_irq(&desc->iuspin); |
465 | if (rv) { | 465 | if (rv) { |
466 | dev_err(&desc->intf->dev, | 466 | dev_err(&desc->intf->dev, |
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index 50a2362ed3ea..48277bbc15e4 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c | |||
@@ -246,6 +246,31 @@ int of_usb_update_otg_caps(struct device_node *np, | |||
246 | } | 246 | } |
247 | EXPORT_SYMBOL_GPL(of_usb_update_otg_caps); | 247 | EXPORT_SYMBOL_GPL(of_usb_update_otg_caps); |
248 | 248 | ||
249 | /** | ||
250 | * usb_of_get_companion_dev - Find the companion device | ||
251 | * @dev: the device pointer to find a companion | ||
252 | * | ||
253 | * Find the companion device from platform bus. | ||
254 | * | ||
255 | * Takes a reference to the returned struct device which needs to be dropped | ||
256 | * after use. | ||
257 | * | ||
258 | * Return: On success, a pointer to the companion device, %NULL on failure. | ||
259 | */ | ||
260 | struct device *usb_of_get_companion_dev(struct device *dev) | ||
261 | { | ||
262 | struct device_node *node; | ||
263 | struct platform_device *pdev = NULL; | ||
264 | |||
265 | node = of_parse_phandle(dev->of_node, "companion", 0); | ||
266 | if (node) | ||
267 | pdev = of_find_device_by_node(node); | ||
268 | |||
269 | of_node_put(node); | ||
270 | |||
271 | return pdev ? &pdev->dev : NULL; | ||
272 | } | ||
273 | EXPORT_SYMBOL_GPL(usb_of_get_companion_dev); | ||
249 | #endif | 274 | #endif |
250 | 275 | ||
251 | MODULE_LICENSE("GPL"); | 276 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 66fe1b78d952..03432467b05f 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -515,8 +515,6 @@ static int resume_common(struct device *dev, int event) | |||
515 | event == PM_EVENT_RESTORE); | 515 | event == PM_EVENT_RESTORE); |
516 | if (retval) { | 516 | if (retval) { |
517 | dev_err(dev, "PCI post-resume error %d!\n", retval); | 517 | dev_err(dev, "PCI post-resume error %d!\n", retval); |
518 | if (hcd->shared_hcd) | ||
519 | usb_hc_died(hcd->shared_hcd); | ||
520 | usb_hc_died(hcd); | 518 | usb_hc_died(hcd); |
521 | } | 519 | } |
522 | } | 520 | } |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 228672f2c4a1..bfa5eda0cc26 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1341,6 +1341,11 @@ void usb_enable_interface(struct usb_device *dev, | |||
1341 | * is submitted that needs that bandwidth. Some other operating systems | 1341 | * is submitted that needs that bandwidth. Some other operating systems |
1342 | * allocate bandwidth early, when a configuration is chosen. | 1342 | * allocate bandwidth early, when a configuration is chosen. |
1343 | * | 1343 | * |
1344 | * xHCI reserves bandwidth and configures the alternate setting in | ||
1345 | * usb_hcd_alloc_bandwidth(). If it fails the original interface altsetting | ||
1346 | * may be disabled. Drivers cannot rely on any particular alternate | ||
1347 | * setting being in effect after a failure. | ||
1348 | * | ||
1344 | * This call is synchronous, and may not be used in an interrupt context. | 1349 | * This call is synchronous, and may not be used in an interrupt context. |
1345 | * Also, drivers must not change altsettings while urbs are scheduled for | 1350 | * Also, drivers must not change altsettings while urbs are scheduled for |
1346 | * endpoints in that interface; all such urbs must first be completed | 1351 | * endpoints in that interface; all such urbs must first be completed |
@@ -1376,6 +1381,12 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1376 | alternate); | 1381 | alternate); |
1377 | return -EINVAL; | 1382 | return -EINVAL; |
1378 | } | 1383 | } |
1384 | /* | ||
1385 | * usb3 hosts configure the interface in usb_hcd_alloc_bandwidth, | ||
1386 | * including freeing dropped endpoint ring buffers. | ||
1387 | * Make sure the interface endpoints are flushed before that | ||
1388 | */ | ||
1389 | usb_disable_interface(dev, iface, false); | ||
1379 | 1390 | ||
1380 | /* Make sure we have enough bandwidth for this alternate interface. | 1391 | /* Make sure we have enough bandwidth for this alternate interface. |
1381 | * Remove the current alt setting and add the new alt setting. | 1392 | * Remove the current alt setting and add the new alt setting. |
diff --git a/drivers/usb/core/of.c b/drivers/usb/core/of.c index fd77442c2d12..651708d8c908 100644 --- a/drivers/usb/core/of.c +++ b/drivers/usb/core/of.c | |||
@@ -105,29 +105,3 @@ usb_of_get_interface_node(struct usb_device *udev, u8 config, u8 ifnum) | |||
105 | return NULL; | 105 | return NULL; |
106 | } | 106 | } |
107 | EXPORT_SYMBOL_GPL(usb_of_get_interface_node); | 107 | EXPORT_SYMBOL_GPL(usb_of_get_interface_node); |
108 | |||
109 | /** | ||
110 | * usb_of_get_companion_dev - Find the companion device | ||
111 | * @dev: the device pointer to find a companion | ||
112 | * | ||
113 | * Find the companion device from platform bus. | ||
114 | * | ||
115 | * Takes a reference to the returned struct device which needs to be dropped | ||
116 | * after use. | ||
117 | * | ||
118 | * Return: On success, a pointer to the companion device, %NULL on failure. | ||
119 | */ | ||
120 | struct device *usb_of_get_companion_dev(struct device *dev) | ||
121 | { | ||
122 | struct device_node *node; | ||
123 | struct platform_device *pdev = NULL; | ||
124 | |||
125 | node = of_parse_phandle(dev->of_node, "companion", 0); | ||
126 | if (node) | ||
127 | pdev = of_find_device_by_node(node); | ||
128 | |||
129 | of_node_put(node); | ||
130 | |||
131 | return pdev ? &pdev->dev : NULL; | ||
132 | } | ||
133 | EXPORT_SYMBOL_GPL(usb_of_get_companion_dev); | ||
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 097057d2eacf..e77dfe5ed5ec 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -178,6 +178,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
178 | /* CBM - Flash disk */ | 178 | /* CBM - Flash disk */ |
179 | { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME }, | 179 | { USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME }, |
180 | 180 | ||
181 | /* WORLDE Controller KS49 or Prodipe MIDI 49C USB controller */ | ||
182 | { USB_DEVICE(0x0218, 0x0201), .driver_info = | ||
183 | USB_QUIRK_CONFIG_INTF_STRINGS }, | ||
184 | |||
181 | /* WORLDE easy key (easykey.25) MIDI controller */ | 185 | /* WORLDE easy key (easykey.25) MIDI controller */ |
182 | { USB_DEVICE(0x0218, 0x0401), .driver_info = | 186 | { USB_DEVICE(0x0218, 0x0401), .driver_info = |
183 | USB_QUIRK_CONFIG_INTF_STRINGS }, | 187 | USB_QUIRK_CONFIG_INTF_STRINGS }, |
@@ -406,6 +410,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
406 | { USB_DEVICE(0x2040, 0x7200), .driver_info = | 410 | { USB_DEVICE(0x2040, 0x7200), .driver_info = |
407 | USB_QUIRK_CONFIG_INTF_STRINGS }, | 411 | USB_QUIRK_CONFIG_INTF_STRINGS }, |
408 | 412 | ||
413 | /* DJI CineSSD */ | ||
414 | { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, | ||
415 | |||
409 | /* INTEL VALUE SSD */ | 416 | /* INTEL VALUE SSD */ |
410 | { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, | 417 | { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, |
411 | 418 | ||
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 9a53a58e676e..577642895b57 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c | |||
@@ -412,8 +412,6 @@ static int dwc2_driver_probe(struct platform_device *dev) | |||
412 | dev_dbg(&dev->dev, "mapped PA %08lx to VA %p\n", | 412 | dev_dbg(&dev->dev, "mapped PA %08lx to VA %p\n", |
413 | (unsigned long)res->start, hsotg->regs); | 413 | (unsigned long)res->start, hsotg->regs); |
414 | 414 | ||
415 | hsotg->needs_byte_swap = dwc2_check_core_endianness(hsotg); | ||
416 | |||
417 | retval = dwc2_lowlevel_hw_init(hsotg); | 415 | retval = dwc2_lowlevel_hw_init(hsotg); |
418 | if (retval) | 416 | if (retval) |
419 | return retval; | 417 | return retval; |
@@ -438,6 +436,8 @@ static int dwc2_driver_probe(struct platform_device *dev) | |||
438 | if (retval) | 436 | if (retval) |
439 | return retval; | 437 | return retval; |
440 | 438 | ||
439 | hsotg->needs_byte_swap = dwc2_check_core_endianness(hsotg); | ||
440 | |||
441 | retval = dwc2_get_dr_mode(hsotg); | 441 | retval = dwc2_get_dr_mode(hsotg); |
442 | if (retval) | 442 | if (retval) |
443 | goto error; | 443 | goto error; |
diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c index 40bf9e0bbc59..4c2771c5e727 100644 --- a/drivers/usb/dwc3/dwc3-of-simple.c +++ b/drivers/usb/dwc3/dwc3-of-simple.c | |||
@@ -180,8 +180,7 @@ static int dwc3_of_simple_remove(struct platform_device *pdev) | |||
180 | return 0; | 180 | return 0; |
181 | } | 181 | } |
182 | 182 | ||
183 | #ifdef CONFIG_PM | 183 | static int __maybe_unused dwc3_of_simple_runtime_suspend(struct device *dev) |
184 | static int dwc3_of_simple_runtime_suspend(struct device *dev) | ||
185 | { | 184 | { |
186 | struct dwc3_of_simple *simple = dev_get_drvdata(dev); | 185 | struct dwc3_of_simple *simple = dev_get_drvdata(dev); |
187 | int i; | 186 | int i; |
@@ -192,7 +191,7 @@ static int dwc3_of_simple_runtime_suspend(struct device *dev) | |||
192 | return 0; | 191 | return 0; |
193 | } | 192 | } |
194 | 193 | ||
195 | static int dwc3_of_simple_runtime_resume(struct device *dev) | 194 | static int __maybe_unused dwc3_of_simple_runtime_resume(struct device *dev) |
196 | { | 195 | { |
197 | struct dwc3_of_simple *simple = dev_get_drvdata(dev); | 196 | struct dwc3_of_simple *simple = dev_get_drvdata(dev); |
198 | int ret; | 197 | int ret; |
@@ -210,7 +209,7 @@ static int dwc3_of_simple_runtime_resume(struct device *dev) | |||
210 | return 0; | 209 | return 0; |
211 | } | 210 | } |
212 | 211 | ||
213 | static int dwc3_of_simple_suspend(struct device *dev) | 212 | static int __maybe_unused dwc3_of_simple_suspend(struct device *dev) |
214 | { | 213 | { |
215 | struct dwc3_of_simple *simple = dev_get_drvdata(dev); | 214 | struct dwc3_of_simple *simple = dev_get_drvdata(dev); |
216 | 215 | ||
@@ -220,7 +219,7 @@ static int dwc3_of_simple_suspend(struct device *dev) | |||
220 | return 0; | 219 | return 0; |
221 | } | 220 | } |
222 | 221 | ||
223 | static int dwc3_of_simple_resume(struct device *dev) | 222 | static int __maybe_unused dwc3_of_simple_resume(struct device *dev) |
224 | { | 223 | { |
225 | struct dwc3_of_simple *simple = dev_get_drvdata(dev); | 224 | struct dwc3_of_simple *simple = dev_get_drvdata(dev); |
226 | 225 | ||
@@ -229,7 +228,6 @@ static int dwc3_of_simple_resume(struct device *dev) | |||
229 | 228 | ||
230 | return 0; | 229 | return 0; |
231 | } | 230 | } |
232 | #endif | ||
233 | 231 | ||
234 | static const struct dev_pm_ops dwc3_of_simple_dev_pm_ops = { | 232 | static const struct dev_pm_ops dwc3_of_simple_dev_pm_ops = { |
235 | SET_SYSTEM_SLEEP_PM_OPS(dwc3_of_simple_suspend, dwc3_of_simple_resume) | 233 | SET_SYSTEM_SLEEP_PM_OPS(dwc3_of_simple_suspend, dwc3_of_simple_resume) |
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 5edd79470368..1286076a8890 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -85,8 +85,8 @@ static int dwc3_byt_enable_ulpi_refclock(struct pci_dev *pci) | |||
85 | u32 value; | 85 | u32 value; |
86 | 86 | ||
87 | reg = pcim_iomap(pci, GP_RWBAR, 0); | 87 | reg = pcim_iomap(pci, GP_RWBAR, 0); |
88 | if (IS_ERR(reg)) | 88 | if (!reg) |
89 | return PTR_ERR(reg); | 89 | return -ENOMEM; |
90 | 90 | ||
91 | value = readl(reg + GP_RWREG1); | 91 | value = readl(reg + GP_RWREG1); |
92 | if (!(value & GP_RWREG1_ULPI_REFCLK_DISABLE)) | 92 | if (!(value & GP_RWREG1_ULPI_REFCLK_DISABLE)) |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 032ea7d709ba..2b53194081ba 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -473,7 +473,6 @@ static int dwc3_gadget_set_xfer_resource(struct dwc3_ep *dep) | |||
473 | 473 | ||
474 | /** | 474 | /** |
475 | * dwc3_gadget_start_config - configure ep resources | 475 | * dwc3_gadget_start_config - configure ep resources |
476 | * @dwc: pointer to our controller context structure | ||
477 | * @dep: endpoint that is being enabled | 476 | * @dep: endpoint that is being enabled |
478 | * | 477 | * |
479 | * Issue a %DWC3_DEPCMD_DEPSTARTCFG command to @dep. After the command's | 478 | * Issue a %DWC3_DEPCMD_DEPSTARTCFG command to @dep. After the command's |
diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c index 53a48f561458..587c5037ff07 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c | |||
@@ -1063,12 +1063,15 @@ static const struct usb_gadget_ops fotg210_gadget_ops = { | |||
1063 | static int fotg210_udc_remove(struct platform_device *pdev) | 1063 | static int fotg210_udc_remove(struct platform_device *pdev) |
1064 | { | 1064 | { |
1065 | struct fotg210_udc *fotg210 = platform_get_drvdata(pdev); | 1065 | struct fotg210_udc *fotg210 = platform_get_drvdata(pdev); |
1066 | int i; | ||
1066 | 1067 | ||
1067 | usb_del_gadget_udc(&fotg210->gadget); | 1068 | usb_del_gadget_udc(&fotg210->gadget); |
1068 | iounmap(fotg210->reg); | 1069 | iounmap(fotg210->reg); |
1069 | free_irq(platform_get_irq(pdev, 0), fotg210); | 1070 | free_irq(platform_get_irq(pdev, 0), fotg210); |
1070 | 1071 | ||
1071 | fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req); | 1072 | fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req); |
1073 | for (i = 0; i < FOTG210_MAX_NUM_EP; i++) | ||
1074 | kfree(fotg210->ep[i]); | ||
1072 | kfree(fotg210); | 1075 | kfree(fotg210); |
1073 | 1076 | ||
1074 | return 0; | 1077 | return 0; |
@@ -1099,7 +1102,7 @@ static int fotg210_udc_probe(struct platform_device *pdev) | |||
1099 | /* initialize udc */ | 1102 | /* initialize udc */ |
1100 | fotg210 = kzalloc(sizeof(struct fotg210_udc), GFP_KERNEL); | 1103 | fotg210 = kzalloc(sizeof(struct fotg210_udc), GFP_KERNEL); |
1101 | if (fotg210 == NULL) | 1104 | if (fotg210 == NULL) |
1102 | goto err_alloc; | 1105 | goto err; |
1103 | 1106 | ||
1104 | for (i = 0; i < FOTG210_MAX_NUM_EP; i++) { | 1107 | for (i = 0; i < FOTG210_MAX_NUM_EP; i++) { |
1105 | _ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL); | 1108 | _ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL); |
@@ -1111,7 +1114,7 @@ static int fotg210_udc_probe(struct platform_device *pdev) | |||
1111 | fotg210->reg = ioremap(res->start, resource_size(res)); | 1114 | fotg210->reg = ioremap(res->start, resource_size(res)); |
1112 | if (fotg210->reg == NULL) { | 1115 | if (fotg210->reg == NULL) { |
1113 | pr_err("ioremap error.\n"); | 1116 | pr_err("ioremap error.\n"); |
1114 | goto err_map; | 1117 | goto err_alloc; |
1115 | } | 1118 | } |
1116 | 1119 | ||
1117 | spin_lock_init(&fotg210->lock); | 1120 | spin_lock_init(&fotg210->lock); |
@@ -1159,7 +1162,7 @@ static int fotg210_udc_probe(struct platform_device *pdev) | |||
1159 | fotg210->ep0_req = fotg210_ep_alloc_request(&fotg210->ep[0]->ep, | 1162 | fotg210->ep0_req = fotg210_ep_alloc_request(&fotg210->ep[0]->ep, |
1160 | GFP_KERNEL); | 1163 | GFP_KERNEL); |
1161 | if (fotg210->ep0_req == NULL) | 1164 | if (fotg210->ep0_req == NULL) |
1162 | goto err_req; | 1165 | goto err_map; |
1163 | 1166 | ||
1164 | fotg210_init(fotg210); | 1167 | fotg210_init(fotg210); |
1165 | 1168 | ||
@@ -1187,12 +1190,14 @@ err_req: | |||
1187 | fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req); | 1190 | fotg210_ep_free_request(&fotg210->ep[0]->ep, fotg210->ep0_req); |
1188 | 1191 | ||
1189 | err_map: | 1192 | err_map: |
1190 | if (fotg210->reg) | 1193 | iounmap(fotg210->reg); |
1191 | iounmap(fotg210->reg); | ||
1192 | 1194 | ||
1193 | err_alloc: | 1195 | err_alloc: |
1196 | for (i = 0; i < FOTG210_MAX_NUM_EP; i++) | ||
1197 | kfree(fotg210->ep[i]); | ||
1194 | kfree(fotg210); | 1198 | kfree(fotg210); |
1195 | 1199 | ||
1200 | err: | ||
1196 | return ret; | 1201 | return ret; |
1197 | } | 1202 | } |
1198 | 1203 | ||
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index 318246d8b2e2..b02ab2a8d927 100644 --- a/drivers/usb/gadget/udc/net2280.c +++ b/drivers/usb/gadget/udc/net2280.c | |||
@@ -1545,11 +1545,14 @@ static int net2280_pullup(struct usb_gadget *_gadget, int is_on) | |||
1545 | writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl); | 1545 | writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl); |
1546 | } else { | 1546 | } else { |
1547 | writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl); | 1547 | writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl); |
1548 | stop_activity(dev, dev->driver); | 1548 | stop_activity(dev, NULL); |
1549 | } | 1549 | } |
1550 | 1550 | ||
1551 | spin_unlock_irqrestore(&dev->lock, flags); | 1551 | spin_unlock_irqrestore(&dev->lock, flags); |
1552 | 1552 | ||
1553 | if (!is_on && dev->driver) | ||
1554 | dev->driver->disconnect(&dev->gadget); | ||
1555 | |||
1553 | return 0; | 1556 | return 0; |
1554 | } | 1557 | } |
1555 | 1558 | ||
@@ -2466,8 +2469,11 @@ static void stop_activity(struct net2280 *dev, struct usb_gadget_driver *driver) | |||
2466 | nuke(&dev->ep[i]); | 2469 | nuke(&dev->ep[i]); |
2467 | 2470 | ||
2468 | /* report disconnect; the driver is already quiesced */ | 2471 | /* report disconnect; the driver is already quiesced */ |
2469 | if (driver) | 2472 | if (driver) { |
2473 | spin_unlock(&dev->lock); | ||
2470 | driver->disconnect(&dev->gadget); | 2474 | driver->disconnect(&dev->gadget); |
2475 | spin_lock(&dev->lock); | ||
2476 | } | ||
2471 | 2477 | ||
2472 | usb_reinit(dev); | 2478 | usb_reinit(dev); |
2473 | } | 2479 | } |
@@ -3341,6 +3347,8 @@ next_endpoints: | |||
3341 | BIT(PCI_RETRY_ABORT_INTERRUPT)) | 3347 | BIT(PCI_RETRY_ABORT_INTERRUPT)) |
3342 | 3348 | ||
3343 | static void handle_stat1_irqs(struct net2280 *dev, u32 stat) | 3349 | static void handle_stat1_irqs(struct net2280 *dev, u32 stat) |
3350 | __releases(dev->lock) | ||
3351 | __acquires(dev->lock) | ||
3344 | { | 3352 | { |
3345 | struct net2280_ep *ep; | 3353 | struct net2280_ep *ep; |
3346 | u32 tmp, num, mask, scratch; | 3354 | u32 tmp, num, mask, scratch; |
@@ -3381,12 +3389,14 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) | |||
3381 | if (disconnect || reset) { | 3389 | if (disconnect || reset) { |
3382 | stop_activity(dev, dev->driver); | 3390 | stop_activity(dev, dev->driver); |
3383 | ep0_start(dev); | 3391 | ep0_start(dev); |
3392 | spin_unlock(&dev->lock); | ||
3384 | if (reset) | 3393 | if (reset) |
3385 | usb_gadget_udc_reset | 3394 | usb_gadget_udc_reset |
3386 | (&dev->gadget, dev->driver); | 3395 | (&dev->gadget, dev->driver); |
3387 | else | 3396 | else |
3388 | (dev->driver->disconnect) | 3397 | (dev->driver->disconnect) |
3389 | (&dev->gadget); | 3398 | (&dev->gadget); |
3399 | spin_lock(&dev->lock); | ||
3390 | return; | 3400 | return; |
3391 | } | 3401 | } |
3392 | } | 3402 | } |
@@ -3405,6 +3415,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) | |||
3405 | tmp = BIT(SUSPEND_REQUEST_CHANGE_INTERRUPT); | 3415 | tmp = BIT(SUSPEND_REQUEST_CHANGE_INTERRUPT); |
3406 | if (stat & tmp) { | 3416 | if (stat & tmp) { |
3407 | writel(tmp, &dev->regs->irqstat1); | 3417 | writel(tmp, &dev->regs->irqstat1); |
3418 | spin_unlock(&dev->lock); | ||
3408 | if (stat & BIT(SUSPEND_REQUEST_INTERRUPT)) { | 3419 | if (stat & BIT(SUSPEND_REQUEST_INTERRUPT)) { |
3409 | if (dev->driver->suspend) | 3420 | if (dev->driver->suspend) |
3410 | dev->driver->suspend(&dev->gadget); | 3421 | dev->driver->suspend(&dev->gadget); |
@@ -3415,6 +3426,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) | |||
3415 | dev->driver->resume(&dev->gadget); | 3426 | dev->driver->resume(&dev->gadget); |
3416 | /* at high speed, note erratum 0133 */ | 3427 | /* at high speed, note erratum 0133 */ |
3417 | } | 3428 | } |
3429 | spin_lock(&dev->lock); | ||
3418 | stat &= ~tmp; | 3430 | stat &= ~tmp; |
3419 | } | 3431 | } |
3420 | 3432 | ||
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c index 1f879b3f2c96..e1656f361e08 100644 --- a/drivers/usb/gadget/udc/renesas_usb3.c +++ b/drivers/usb/gadget/udc/renesas_usb3.c | |||
@@ -812,12 +812,15 @@ static void usb3_irq_epc_int_1_speed(struct renesas_usb3 *usb3) | |||
812 | switch (speed) { | 812 | switch (speed) { |
813 | case USB_STA_SPEED_SS: | 813 | case USB_STA_SPEED_SS: |
814 | usb3->gadget.speed = USB_SPEED_SUPER; | 814 | usb3->gadget.speed = USB_SPEED_SUPER; |
815 | usb3->gadget.ep0->maxpacket = USB3_EP0_SS_MAX_PACKET_SIZE; | ||
815 | break; | 816 | break; |
816 | case USB_STA_SPEED_HS: | 817 | case USB_STA_SPEED_HS: |
817 | usb3->gadget.speed = USB_SPEED_HIGH; | 818 | usb3->gadget.speed = USB_SPEED_HIGH; |
819 | usb3->gadget.ep0->maxpacket = USB3_EP0_HSFS_MAX_PACKET_SIZE; | ||
818 | break; | 820 | break; |
819 | case USB_STA_SPEED_FS: | 821 | case USB_STA_SPEED_FS: |
820 | usb3->gadget.speed = USB_SPEED_FULL; | 822 | usb3->gadget.speed = USB_SPEED_FULL; |
823 | usb3->gadget.ep0->maxpacket = USB3_EP0_HSFS_MAX_PACKET_SIZE; | ||
821 | break; | 824 | break; |
822 | default: | 825 | default: |
823 | usb3->gadget.speed = USB_SPEED_UNKNOWN; | 826 | usb3->gadget.speed = USB_SPEED_UNKNOWN; |
@@ -2513,7 +2516,7 @@ static int renesas_usb3_init_ep(struct renesas_usb3 *usb3, struct device *dev, | |||
2513 | /* for control pipe */ | 2516 | /* for control pipe */ |
2514 | usb3->gadget.ep0 = &usb3_ep->ep; | 2517 | usb3->gadget.ep0 = &usb3_ep->ep; |
2515 | usb_ep_set_maxpacket_limit(&usb3_ep->ep, | 2518 | usb_ep_set_maxpacket_limit(&usb3_ep->ep, |
2516 | USB3_EP0_HSFS_MAX_PACKET_SIZE); | 2519 | USB3_EP0_SS_MAX_PACKET_SIZE); |
2517 | usb3_ep->ep.caps.type_control = true; | 2520 | usb3_ep->ep.caps.type_control = true; |
2518 | usb3_ep->ep.caps.dir_in = true; | 2521 | usb3_ep->ep.caps.dir_in = true; |
2519 | usb3_ep->ep.caps.dir_out = true; | 2522 | usb3_ep->ep.caps.dir_out = true; |
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index 072bd5d5738e..5b8a3d9530c4 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c | |||
@@ -2555,7 +2555,7 @@ static int u132_get_frame(struct usb_hcd *hcd) | |||
2555 | } else { | 2555 | } else { |
2556 | int frame = 0; | 2556 | int frame = 0; |
2557 | dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n"); | 2557 | dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n"); |
2558 | msleep(100); | 2558 | mdelay(100); |
2559 | return frame; | 2559 | return frame; |
2560 | } | 2560 | } |
2561 | } | 2561 | } |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index ef350c33dc4a..b1f27aa38b10 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1613,6 +1613,10 @@ void xhci_endpoint_copy(struct xhci_hcd *xhci, | |||
1613 | in_ep_ctx->ep_info2 = out_ep_ctx->ep_info2; | 1613 | in_ep_ctx->ep_info2 = out_ep_ctx->ep_info2; |
1614 | in_ep_ctx->deq = out_ep_ctx->deq; | 1614 | in_ep_ctx->deq = out_ep_ctx->deq; |
1615 | in_ep_ctx->tx_info = out_ep_ctx->tx_info; | 1615 | in_ep_ctx->tx_info = out_ep_ctx->tx_info; |
1616 | if (xhci->quirks & XHCI_MTK_HOST) { | ||
1617 | in_ep_ctx->reserved[0] = out_ep_ctx->reserved[0]; | ||
1618 | in_ep_ctx->reserved[1] = out_ep_ctx->reserved[1]; | ||
1619 | } | ||
1616 | } | 1620 | } |
1617 | 1621 | ||
1618 | /* Copy output xhci_slot_ctx to the input xhci_slot_ctx. | 1622 | /* Copy output xhci_slot_ctx to the input xhci_slot_ctx. |
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 8dc77e34a859..94e939249b2b 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
@@ -153,7 +153,7 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
153 | { | 153 | { |
154 | const struct xhci_plat_priv *priv_match; | 154 | const struct xhci_plat_priv *priv_match; |
155 | const struct hc_driver *driver; | 155 | const struct hc_driver *driver; |
156 | struct device *sysdev; | 156 | struct device *sysdev, *tmpdev; |
157 | struct xhci_hcd *xhci; | 157 | struct xhci_hcd *xhci; |
158 | struct resource *res; | 158 | struct resource *res; |
159 | struct usb_hcd *hcd; | 159 | struct usb_hcd *hcd; |
@@ -273,19 +273,24 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
273 | goto disable_clk; | 273 | goto disable_clk; |
274 | } | 274 | } |
275 | 275 | ||
276 | if (device_property_read_bool(sysdev, "usb2-lpm-disable")) | 276 | /* imod_interval is the interrupt moderation value in nanoseconds. */ |
277 | xhci->quirks |= XHCI_HW_LPM_DISABLE; | 277 | xhci->imod_interval = 40000; |
278 | 278 | ||
279 | if (device_property_read_bool(sysdev, "usb3-lpm-capable")) | 279 | /* Iterate over all parent nodes for finding quirks */ |
280 | xhci->quirks |= XHCI_LPM_SUPPORT; | 280 | for (tmpdev = &pdev->dev; tmpdev; tmpdev = tmpdev->parent) { |
281 | 281 | ||
282 | if (device_property_read_bool(&pdev->dev, "quirk-broken-port-ped")) | 282 | if (device_property_read_bool(tmpdev, "usb2-lpm-disable")) |
283 | xhci->quirks |= XHCI_BROKEN_PORT_PED; | 283 | xhci->quirks |= XHCI_HW_LPM_DISABLE; |
284 | 284 | ||
285 | /* imod_interval is the interrupt moderation value in nanoseconds. */ | 285 | if (device_property_read_bool(tmpdev, "usb3-lpm-capable")) |
286 | xhci->imod_interval = 40000; | 286 | xhci->quirks |= XHCI_LPM_SUPPORT; |
287 | device_property_read_u32(sysdev, "imod-interval-ns", | 287 | |
288 | &xhci->imod_interval); | 288 | if (device_property_read_bool(tmpdev, "quirk-broken-port-ped")) |
289 | xhci->quirks |= XHCI_BROKEN_PORT_PED; | ||
290 | |||
291 | device_property_read_u32(tmpdev, "imod-interval-ns", | ||
292 | &xhci->imod_interval); | ||
293 | } | ||
289 | 294 | ||
290 | hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0); | 295 | hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0); |
291 | if (IS_ERR(hcd->usb_phy)) { | 296 | if (IS_ERR(hcd->usb_phy)) { |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 61f48b17e57b..0420eefa647a 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -37,6 +37,21 @@ static unsigned long long quirks; | |||
37 | module_param(quirks, ullong, S_IRUGO); | 37 | module_param(quirks, ullong, S_IRUGO); |
38 | MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default"); | 38 | MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default"); |
39 | 39 | ||
40 | static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring) | ||
41 | { | ||
42 | struct xhci_segment *seg = ring->first_seg; | ||
43 | |||
44 | if (!td || !td->start_seg) | ||
45 | return false; | ||
46 | do { | ||
47 | if (seg == td->start_seg) | ||
48 | return true; | ||
49 | seg = seg->next; | ||
50 | } while (seg && seg != ring->first_seg); | ||
51 | |||
52 | return false; | ||
53 | } | ||
54 | |||
40 | /* TODO: copied from ehci-hcd.c - can this be refactored? */ | 55 | /* TODO: copied from ehci-hcd.c - can this be refactored? */ |
41 | /* | 56 | /* |
42 | * xhci_handshake - spin reading hc until handshake completes or fails | 57 | * xhci_handshake - spin reading hc until handshake completes or fails |
@@ -1571,6 +1586,21 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
1571 | goto done; | 1586 | goto done; |
1572 | } | 1587 | } |
1573 | 1588 | ||
1589 | /* | ||
1590 | * check ring is not re-allocated since URB was enqueued. If it is, then | ||
1591 | * make sure none of the ring related pointers in this URB private data | ||
1592 | * are touched, such as td_list, otherwise we overwrite freed data | ||
1593 | */ | ||
1594 | if (!td_on_ring(&urb_priv->td[0], ep_ring)) { | ||
1595 | xhci_err(xhci, "Canceled URB td not found on endpoint ring"); | ||
1596 | for (i = urb_priv->num_tds_done; i < urb_priv->num_tds; i++) { | ||
1597 | td = &urb_priv->td[i]; | ||
1598 | if (!list_empty(&td->cancelled_td_list)) | ||
1599 | list_del_init(&td->cancelled_td_list); | ||
1600 | } | ||
1601 | goto err_giveback; | ||
1602 | } | ||
1603 | |||
1574 | if (xhci->xhc_state & XHCI_STATE_HALTED) { | 1604 | if (xhci->xhc_state & XHCI_STATE_HALTED) { |
1575 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 1605 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
1576 | "HC halted, freeing TD manually."); | 1606 | "HC halted, freeing TD manually."); |
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 82f220631bd7..b5d661644263 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c | |||
@@ -369,7 +369,7 @@ static unsigned char parport_uss720_frob_control(struct parport *pp, unsigned ch | |||
369 | mask &= 0x0f; | 369 | mask &= 0x0f; |
370 | val &= 0x0f; | 370 | val &= 0x0f; |
371 | d = (priv->reg[1] & (~mask)) ^ val; | 371 | d = (priv->reg[1] & (~mask)) ^ val; |
372 | if (set_1284_register(pp, 2, d, GFP_KERNEL)) | 372 | if (set_1284_register(pp, 2, d, GFP_ATOMIC)) |
373 | return 0; | 373 | return 0; |
374 | priv->reg[1] = d; | 374 | priv->reg[1] = d; |
375 | return d & 0xf; | 375 | return d & 0xf; |
@@ -379,7 +379,7 @@ static unsigned char parport_uss720_read_status(struct parport *pp) | |||
379 | { | 379 | { |
380 | unsigned char ret; | 380 | unsigned char ret; |
381 | 381 | ||
382 | if (get_1284_register(pp, 1, &ret, GFP_KERNEL)) | 382 | if (get_1284_register(pp, 1, &ret, GFP_ATOMIC)) |
383 | return 0; | 383 | return 0; |
384 | return ret & 0xf8; | 384 | return ret & 0xf8; |
385 | } | 385 | } |
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 3be40eaa1ac9..6d9fd5f64903 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c | |||
@@ -413,6 +413,9 @@ static ssize_t yurex_read(struct file *file, char __user *buffer, size_t count, | |||
413 | spin_unlock_irqrestore(&dev->lock, flags); | 413 | spin_unlock_irqrestore(&dev->lock, flags); |
414 | mutex_unlock(&dev->io_mutex); | 414 | mutex_unlock(&dev->io_mutex); |
415 | 415 | ||
416 | if (WARN_ON_ONCE(len >= sizeof(in_buffer))) | ||
417 | return -EIO; | ||
418 | |||
416 | return simple_read_from_buffer(buffer, count, ppos, in_buffer, len); | 419 | return simple_read_from_buffer(buffer, count, ppos, in_buffer, len); |
417 | } | 420 | } |
418 | 421 | ||
@@ -421,13 +424,13 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer, | |||
421 | { | 424 | { |
422 | struct usb_yurex *dev; | 425 | struct usb_yurex *dev; |
423 | int i, set = 0, retval = 0; | 426 | int i, set = 0, retval = 0; |
424 | char buffer[16]; | 427 | char buffer[16 + 1]; |
425 | char *data = buffer; | 428 | char *data = buffer; |
426 | unsigned long long c, c2 = 0; | 429 | unsigned long long c, c2 = 0; |
427 | signed long timeout = 0; | 430 | signed long timeout = 0; |
428 | DEFINE_WAIT(wait); | 431 | DEFINE_WAIT(wait); |
429 | 432 | ||
430 | count = min(sizeof(buffer), count); | 433 | count = min(sizeof(buffer) - 1, count); |
431 | dev = file->private_data; | 434 | dev = file->private_data; |
432 | 435 | ||
433 | /* verify that we actually have some data to write */ | 436 | /* verify that we actually have some data to write */ |
@@ -446,6 +449,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer, | |||
446 | retval = -EFAULT; | 449 | retval = -EFAULT; |
447 | goto error; | 450 | goto error; |
448 | } | 451 | } |
452 | buffer[count] = 0; | ||
449 | memset(dev->cntl_buffer, CMD_PADDING, YUREX_BUF_SIZE); | 453 | memset(dev->cntl_buffer, CMD_PADDING, YUREX_BUF_SIZE); |
450 | 454 | ||
451 | switch (buffer[0]) { | 455 | switch (buffer[0]) { |
diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c index eecfd0671362..d045d8458f81 100644 --- a/drivers/usb/mtu3/mtu3_core.c +++ b/drivers/usb/mtu3/mtu3_core.c | |||
@@ -107,8 +107,12 @@ static int mtu3_device_enable(struct mtu3 *mtu) | |||
107 | (SSUSB_U2_PORT_DIS | SSUSB_U2_PORT_PDN | | 107 | (SSUSB_U2_PORT_DIS | SSUSB_U2_PORT_PDN | |
108 | SSUSB_U2_PORT_HOST_SEL)); | 108 | SSUSB_U2_PORT_HOST_SEL)); |
109 | 109 | ||
110 | if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) | 110 | if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) { |
111 | mtu3_setbits(ibase, SSUSB_U2_CTRL(0), SSUSB_U2_PORT_OTG_SEL); | 111 | mtu3_setbits(ibase, SSUSB_U2_CTRL(0), SSUSB_U2_PORT_OTG_SEL); |
112 | if (mtu->is_u3_ip) | ||
113 | mtu3_setbits(ibase, SSUSB_U3_CTRL(0), | ||
114 | SSUSB_U3_PORT_DUAL_MODE); | ||
115 | } | ||
112 | 116 | ||
113 | return ssusb_check_clocks(mtu->ssusb, check_clk); | 117 | return ssusb_check_clocks(mtu->ssusb, check_clk); |
114 | } | 118 | } |
diff --git a/drivers/usb/mtu3/mtu3_hw_regs.h b/drivers/usb/mtu3/mtu3_hw_regs.h index 6ee371478d89..a45bb253939f 100644 --- a/drivers/usb/mtu3/mtu3_hw_regs.h +++ b/drivers/usb/mtu3/mtu3_hw_regs.h | |||
@@ -459,6 +459,7 @@ | |||
459 | 459 | ||
460 | /* U3D_SSUSB_U3_CTRL_0P */ | 460 | /* U3D_SSUSB_U3_CTRL_0P */ |
461 | #define SSUSB_U3_PORT_SSP_SPEED BIT(9) | 461 | #define SSUSB_U3_PORT_SSP_SPEED BIT(9) |
462 | #define SSUSB_U3_PORT_DUAL_MODE BIT(7) | ||
462 | #define SSUSB_U3_PORT_HOST_SEL BIT(2) | 463 | #define SSUSB_U3_PORT_HOST_SEL BIT(2) |
463 | #define SSUSB_U3_PORT_PDN BIT(1) | 464 | #define SSUSB_U3_PORT_PDN BIT(1) |
464 | #define SSUSB_U3_PORT_DIS BIT(0) | 465 | #define SSUSB_U3_PORT_DIS BIT(0) |
diff --git a/drivers/usb/serial/io_ti.h b/drivers/usb/serial/io_ti.h index e53c68261017..9bbcee37524e 100644 --- a/drivers/usb/serial/io_ti.h +++ b/drivers/usb/serial/io_ti.h | |||
@@ -173,7 +173,7 @@ struct ump_interrupt { | |||
173 | } __attribute__((packed)); | 173 | } __attribute__((packed)); |
174 | 174 | ||
175 | 175 | ||
176 | #define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3) | 176 | #define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 6) & 0x01) |
177 | #define TIUMP_GET_FUNC_FROM_CODE(c) ((c) & 0x0f) | 177 | #define TIUMP_GET_FUNC_FROM_CODE(c) ((c) & 0x0f) |
178 | #define TIUMP_INTERRUPT_CODE_LSR 0x03 | 178 | #define TIUMP_INTERRUPT_CODE_LSR 0x03 |
179 | #define TIUMP_INTERRUPT_CODE_MSR 0x04 | 179 | #define TIUMP_INTERRUPT_CODE_MSR 0x04 |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 3010878f7f8e..e3c5832337e0 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -1119,7 +1119,7 @@ static void ti_break(struct tty_struct *tty, int break_state) | |||
1119 | 1119 | ||
1120 | static int ti_get_port_from_code(unsigned char code) | 1120 | static int ti_get_port_from_code(unsigned char code) |
1121 | { | 1121 | { |
1122 | return (code >> 4) - 3; | 1122 | return (code >> 6) & 0x01; |
1123 | } | 1123 | } |
1124 | 1124 | ||
1125 | static int ti_get_func_from_code(unsigned char code) | 1125 | static int ti_get_func_from_code(unsigned char code) |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index c267f2812a04..e227bb5b794f 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -376,6 +376,15 @@ static int queuecommand_lck(struct scsi_cmnd *srb, | |||
376 | return 0; | 376 | return 0; |
377 | } | 377 | } |
378 | 378 | ||
379 | if ((us->fflags & US_FL_NO_ATA_1X) && | ||
380 | (srb->cmnd[0] == ATA_12 || srb->cmnd[0] == ATA_16)) { | ||
381 | memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB, | ||
382 | sizeof(usb_stor_sense_invalidCDB)); | ||
383 | srb->result = SAM_STAT_CHECK_CONDITION; | ||
384 | done(srb); | ||
385 | return 0; | ||
386 | } | ||
387 | |||
379 | /* enqueue the command and wake up the control thread */ | 388 | /* enqueue the command and wake up the control thread */ |
380 | srb->scsi_done = done; | 389 | srb->scsi_done = done; |
381 | us->srb = srb; | 390 | us->srb = srb; |
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 9e9de5452860..1f7b401c4d04 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
@@ -842,6 +842,27 @@ static int uas_slave_configure(struct scsi_device *sdev) | |||
842 | sdev->skip_ms_page_8 = 1; | 842 | sdev->skip_ms_page_8 = 1; |
843 | sdev->wce_default_on = 1; | 843 | sdev->wce_default_on = 1; |
844 | } | 844 | } |
845 | |||
846 | /* | ||
847 | * Some disks return the total number of blocks in response | ||
848 | * to READ CAPACITY rather than the highest block number. | ||
849 | * If this device makes that mistake, tell the sd driver. | ||
850 | */ | ||
851 | if (devinfo->flags & US_FL_FIX_CAPACITY) | ||
852 | sdev->fix_capacity = 1; | ||
853 | |||
854 | /* | ||
855 | * Some devices don't like MODE SENSE with page=0x3f, | ||
856 | * which is the command used for checking if a device | ||
857 | * is write-protected. Now that we tell the sd driver | ||
858 | * to do a 192-byte transfer with this command the | ||
859 | * majority of devices work fine, but a few still can't | ||
860 | * handle it. The sd driver will simply assume those | ||
861 | * devices are write-enabled. | ||
862 | */ | ||
863 | if (devinfo->flags & US_FL_NO_WP_DETECT) | ||
864 | sdev->skip_ms_page_3f = 1; | ||
865 | |||
845 | scsi_change_queue_depth(sdev, devinfo->qdepth - 2); | 866 | scsi_change_queue_depth(sdev, devinfo->qdepth - 2); |
846 | return 0; | 867 | return 0; |
847 | } | 868 | } |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 22fcfccf453a..f7f83b21dc74 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -2288,6 +2288,13 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, | |||
2288 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 2288 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
2289 | US_FL_GO_SLOW ), | 2289 | US_FL_GO_SLOW ), |
2290 | 2290 | ||
2291 | /* Reported-by: Tim Anderson <tsa@biglakesoftware.com> */ | ||
2292 | UNUSUAL_DEV( 0x2ca3, 0x0031, 0x0000, 0x9999, | ||
2293 | "DJI", | ||
2294 | "CineSSD", | ||
2295 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
2296 | US_FL_NO_ATA_1X), | ||
2297 | |||
2291 | /* | 2298 | /* |
2292 | * Reported by Frederic Marchal <frederic.marchal@wowcompany.com> | 2299 | * Reported by Frederic Marchal <frederic.marchal@wowcompany.com> |
2293 | * Mio Moov 330 | 2300 | * Mio Moov 330 |
diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c index 95a2b10127db..76299b6ff06d 100644 --- a/drivers/usb/typec/bus.c +++ b/drivers/usb/typec/bus.c | |||
@@ -255,12 +255,13 @@ EXPORT_SYMBOL_GPL(typec_altmode_unregister_driver); | |||
255 | /* API for the port drivers */ | 255 | /* API for the port drivers */ |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * typec_match_altmode - Match SVID to an array of alternate modes | 258 | * typec_match_altmode - Match SVID and mode to an array of alternate modes |
259 | * @altmodes: Array of alternate modes | 259 | * @altmodes: Array of alternate modes |
260 | * @n: Number of elements in the array, or -1 for NULL termiated arrays | 260 | * @n: Number of elements in the array, or -1 for NULL terminated arrays |
261 | * @svid: Standard or Vendor ID to match with | 261 | * @svid: Standard or Vendor ID to match with |
262 | * @mode: Mode to match with | ||
262 | * | 263 | * |
263 | * Return pointer to an alternate mode with SVID mathing @svid, or NULL when no | 264 | * Return pointer to an alternate mode with SVID matching @svid, or NULL when no |
264 | * match is found. | 265 | * match is found. |
265 | */ | 266 | */ |
266 | struct typec_altmode *typec_match_altmode(struct typec_altmode **altmodes, | 267 | struct typec_altmode *typec_match_altmode(struct typec_altmode **altmodes, |
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index c202975f8097..e61dffb27a0c 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c | |||
@@ -1484,7 +1484,6 @@ EXPORT_SYMBOL_GPL(typec_set_mode); | |||
1484 | * typec_port_register_altmode - Register USB Type-C Port Alternate Mode | 1484 | * typec_port_register_altmode - Register USB Type-C Port Alternate Mode |
1485 | * @port: USB Type-C Port that supports the alternate mode | 1485 | * @port: USB Type-C Port that supports the alternate mode |
1486 | * @desc: Description of the alternate mode | 1486 | * @desc: Description of the alternate mode |
1487 | * @drvdata: Private pointer to driver specific info | ||
1488 | * | 1487 | * |
1489 | * This routine is used to register an alternate mode that @port is capable of | 1488 | * This routine is used to register an alternate mode that @port is capable of |
1490 | * supporting. | 1489 | * supporting. |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 1298a7daa57d..01797cb4587e 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -754,6 +754,7 @@ struct tb_service_id { | |||
754 | * struct typec_device_id - USB Type-C alternate mode identifiers | 754 | * struct typec_device_id - USB Type-C alternate mode identifiers |
755 | * @svid: Standard or Vendor ID | 755 | * @svid: Standard or Vendor ID |
756 | * @mode: Mode index | 756 | * @mode: Mode index |
757 | * @driver_data: Driver specific data | ||
757 | */ | 758 | */ |
758 | struct typec_device_id { | 759 | struct typec_device_id { |
759 | __u16 svid; | 760 | __u16 svid; |