aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)AuthorFilesLines
2019-01-28usb: gadget: aspeed: fix typoMatteo Croce1-1/+1
Fix spelling mistake: "lenght" -> "length" Signed-off-by: Matteo Croce <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-28usb: dwc3: keystone: Add support for ti,am654-dwc3Roger Quadros2-4/+13
The AM654 SoC contains a DWC3 controller with TI specific wrapper. Add support for that. Unlike the Keystone 2 case, for AM654 We don't need to process any IRQs for basic USB operation. Signed-off-by: Roger Quadros <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-28usb: dwc3: gadget: Fix OTG events when gadget driver isn't loadedRoger Quadros1-0/+2
On v3.10a in dual-role mode, if port is in device mode and gadget driver isn't loaded, the OTG event interrupts don't come through. It seems that if the core is configured to be OTG2.0 only, then we can't leave the DCFG.DEVSPD at Super-speed (default) if we expect OTG to work properly. It must be set to High-speed. Fix this issue by configuring DCFG.DEVSPD to the supported maximum speed at gadget init. Device tree still needs to provide correct supported maximum speed for this to work. This issue wasn't present on v2.40a but is seen on v3.10a. It doesn't cause any side effects on v2.40a. Signed-off-by: Roger Quadros <[email protected]> Signed-off-by: Sekhar Nori <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-28usb: renesas_usbhs: replace udelay() with usleep_range()Yoshihiro Shimoda2-2/+2
According to Documentation/timers/timers-howto.txt, a driver should use usleep_range() instead of udelay() on NON-ATOMIC CONTEXT if "SLEEPING FOR ~USECS OR SMALL MSECS ( 10us - 20ms)". Since the .hardware_init() and .power_ctrl() will run on NON-ATOMIC CONTEXT, this patch replaces udelay() with usleep_range(). Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-28usb: dwc3: qcom: Add support for MSM8998Jeffrey Hugo1-0/+1
Add a MSM8998 specific DT compatible so that we can properly bind to the device and enable the USB controller. Reviewed-by: Andy Gross <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Signed-off-by: Jeffrey Hugo <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-28usb: gadget: Remove dead branch codeYueHaibing1-8/+0
'num' is a u8 variable, it never greater than 255, So the if branch is dead code and can be removed. Signed-off-by: YueHaibing <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-28Merge 5.0-rc4 into usb-nextGreg Kroah-Hartman16-19/+43
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-25USB: serial: cp210x: support all gpios on CP2102N QFN28 packageMans Rullgard1-6/+13
The QFN28 package version of the CP2102N has three additional gpio pins. Add support for these. Signed-off-by: Mans Rullgard <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2019-01-25usb: ftdi-elan: Fix if == else warnings in ftdi_elan_respond_engineYueHaibing1-24/+0
Fixes the following coccinelle warning: ./drivers/usb/misc/ftdi-elan.c:972:10-12: WARNING: possible condition with no effect (if == else) ./drivers/usb/misc/ftdi-elan.c:983:9-11: WARNING: possible condition with no effect (if == else) ./drivers/usb/misc/ftdi-elan.c:2052:11-13: WARNING: possible condition with no effect (if == else) All these else/if branches just do the same thing actually as the last else branch, So it can be merged into the last branch. Signed-off-by: YueHaibing <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-25usb: typec: tpcm: improve error handling of tcpm_register_portJun Li1-3/+5
Remove debugfs if tcpm register port fails. Signed-off-by: Li Jun <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-25usb: misc: usb3503: Add system sleep support in non-I2C modeMarek Szyprowski1-8/+30
USB3503 chip can be used without any I2C connection, what is handled by a simple platform device driver. Add support for resetting the chip (via GPIO lines) during system suspend/resume cycle by adding calls to existing suspend/resume functions used for E2C device. Signed-off-by: Marek Szyprowski <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-25usbip: Fix vhci_urb_enqueue() URB null transfer buffer error pathShuah Khan1-2/+4
Fix vhci_urb_enqueue() to print debug msg and return error instead of failing with BUG_ON. Signed-off-by: Shuah Khan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-25usb: sisusb: remove useless macros and compact the codeJiri Slaby1-33/+15
Remove macros which are only wrappers around standard operations. When we expand them into code, we see that sisusbcon_memsetw can simply use memset16 and sisusbcon_putcs can just call memcpy. So make the code compact. Signed-off-by: Jiri Slaby <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-25usb: sisusb: let files build only when neededJiri Slaby3-13/+2
After the previous patch we see, that whole files are ifdeffed depending on CONFIG options. So do not build the files at all if the CONFIG is not enabled. (I.e. move the check from .c to Makefile.) Signed-off-by: Jiri Slaby <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-25usb: sisusb_con, cleanup configsJiri Slaby4-33/+20
There are two macros defined: 1) ifdef CONFIG_COMPAT => define SISUSB_NEW_CONFIG_COMPAT 2) ifdef CONFIG_USB_SISUSBVGA_CON => define INCL_SISUSB_CON Remove the latter and make use only of the former. This removes one layer of obfuscation. Signed-off-by: Jiri Slaby <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-25usb: sisusb_con, convert addr macros to functionsJiri Slaby1-39/+39
Convert SISUSB_VADDR and SISUSB_HADDR to inline functions. Now, there are no more hidden accesses to local variables (vc_data and sisusb_usb_data). sisusb_haddr returns unsigned long from now on, not u16 *, as ulong is what every caller expects -- we can remove some casts. Call sites were aligned to be readable too. Use sisusb_haddr on 4 more places in sisusbcon_blank and sisusbcon_scroll. It was open coded there with [x, y] being [0, 0]. Signed-off-by: Jiri Slaby <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-25usb: ftdi-elan: remove a unnecessary variable 'empty_packets'YueHaibing1-2/+0
The variable 'empty_packets' does not used in any other places except for self increment, so it can be removed. Signed-off-by: YueHaibing <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-25usb: assign ACPI companions for embedded USB devicesDmitry Torokhov1-9/+35
USB devices permanently connected to USB ports may be described in ACPI tables and share ACPI devices with ports they are connected to. See [1] for details. This will allow us to describe sideband resources for devices, such as, for example, hard reset line for BT USB controllers. [1] https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/other-acpi-namespace-objects#acpi-namespace-hierarchy-and-adr-for-embedded-usb-devices Signed-off-by: Dmitry Torokhov <[email protected]> Signed-off-by: Rajat Jain <[email protected]> (changed how we get the usb_port) Acked-by: Greg Kroah-Hartman <[email protected]> Tested-by: Sukumar Ghorai <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2019-01-25usb: split code locating ACPI companion into port and deviceDmitry Torokhov1-61/+72
In preparation for handling embedded USB devices let's split usb_acpi_find_companion() into usb_acpi_find_companion_for_device() and usb_acpi_find_companion_for_port(). Signed-off-by: Dmitry Torokhov <[email protected]> Signed-off-by: Rajat Jain <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Tested-by: Sukumar Ghorai <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
2019-01-22USB: host: whci: rename Kbuild fileGreg Kroah-Hartman1-0/+2
We have been using Makefile for well over a decade now, use that name instead of Kbuild. Also, while moving the file, add the proper SPDX identifier at the top of it. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-22USB: remove README fileGreg Kroah-Hartman1-54/+0
This file is really really old, and doesn't make any sense to keep around anymore, so just drop it. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-22USB: add missing SPDX lines to Kconfig and MakefilesGreg Kroah-Hartman32-0/+45
There are a few remaining drivers/usb/ files that do not have SPDX identifiers in them, all of these are either Kconfig or Makefiles. Add the correct GPL-2.0 identifier to them to make scanning tools happy. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-22USB: storage: karma: add whitespace after declarationsBharath Vedartham1-0/+2
fixed the checkpatch.pl warning: WARNING: Missing a blank line after declarations Added space after declarations to conform to coding style. Signed-off-by: Bharath Vedartham <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18Merge tag 'usb-serial-5.0-rc3' of ↵Greg Kroah-Hartman9-2/+24
https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus Johan writes: USB-serial fixes for 5.0-rc3 Here's a fix for the new ftdi gpio support, which failed to take autosuspend into account, and a patch adding missing SPDX identifiers to the keyspan headers. Included are also some new device ids. All but the SPDX patch have been in linux-next with no reported issues. Signed-off-by: Johan Hovold <[email protected]> * tag 'usb-serial-5.0-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial: USB: serial: keyspan_usa: add proper SPDX lines for .h files USB: serial: pl2303: add new PID to support PL2303TB USB: serial: ftdi_sio: fix GPIO not working in autosuspend USB: serial: simple: add Motorola Tetra TPG2200 device id
2019-01-18USB: serial: keyspan_usa: add proper SPDX lines for .h filesGreg Kroah-Hartman5-0/+5
The keyspan_usa??msg.h files are under a BSD-3 style license, so properly label them as such with a SPDX line at the top of the file. Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2019-01-18USB: EHCI: ehci-mv: add MODULE_DEVICE_TABLELubomir Rintel1-0/+1
This fixes autoloading the module by the OF compatible string. Fixes: 813e18b18a87 ("USB: EHCI: ehci-mv: add DT support") Cc: [email protected] Signed-off-by: Lubomir Rintel <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18USB: Consolidate LPM checks to avoid enabling LPM twiceKai-Heng Feng3-13/+13
USB Bluetooth controller QCA ROME (0cf3:e007) sometimes stops working after S3: [ 165.110742] Bluetooth: hci0: using NVM file: qca/nvm_usb_00000302.bin [ 168.432065] Bluetooth: hci0: Failed to send body at 4 of 1953 (-110) After some experiments, I found that disabling LPM can workaround the issue. On some platforms, the USB power is cut during S3, so the driver uses reset-resume to resume the device. During port resume, LPM gets enabled twice, by usb_reset_and_verify_device() and usb_port_resume(). Consolidate all checks into new LPM helpers to make sure LPM only gets enabled once. Fixes: de68bab4fa96 ("usb: Don't enable USB 2.0 Link PM by default.”) Signed-off-by: Kai-Heng Feng <[email protected]> Cc: stable <[email protected]> # after much soaking Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18USB: Add new USB LPM helpersKai-Heng Feng5-11/+30
Use new helpers to make LPM enabling/disabling more clear. This is a preparation to subsequent patch. Signed-off-by: Kai-Heng Feng <[email protected]> Cc: stable <[email protected]> # after much soaking Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18drivers: usb :fsl: Remove USB Errata checking codeRan Wang2-6/+7
Remove USB errata checking code from driver. Applicability of erratum is retrieved by reading corresponding property in device tree. This property is written during device tree fixup. Besides, replace spaces with tabs to make code aligned. Signed-off-by: Ramneek Mehresh <[email protected]> Signed-off-by: Nikhil Badola <[email protected]> Signed-off-by: Yinbo Zhu <[email protected]> Signed-off-by: Ran Wang <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18usb: kconfig: remove dependency FSL_SOC for ehci fsl driverRan Wang1-2/+1
CONFIG_USB_EHCI_FSL is not dependent on FSL_SOC, it can be built on non-PPC platforms. Signed-off-by: Rajesh Bhagat <[email protected]> Signed-off-by: Ran Wang <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18usb: ehci: fsl: Update register accessing for arm/arm64 platformsRan Wang1-21/+41
arm/arm64's io.h doesn't define clrbits32() and clrsetbits_be32(), which causing compile failure on some Layerscape Platforms (such as LS1021A and LS2012A which also integrates FSL EHCI controller). So use ioread32be()/iowrite32be() instead to make it workable on both powerpc and arm. Signed-off-by: Ran Wang <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18usb: usb251xb: add usb data lane port swap featureMarco Felsch1-2/+13
The HW can swap the USB differential-pair (D+/D-) for each port separately. So the USB signals can be re-aligned with a misplaced USB connector on the PCB. Signed-off-by: Marco Felsch <[email protected]> Reviewed-by: Richard Leitner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18usb: renesas_usbhs: replace udelay() with usleep_range()Yoshihiro Shimoda2-2/+2
According to Documentation/timers/timers-howto.txt, a driver should use usleep_range() instead of udelay() on NON-ATOMIC CONTEXT if "SLEEPING FOR ~USECS OR SMALL MSECS ( 10us - 20ms)". Since the .hardware_init() and .power_ctrl() will run on NON-ATOMIC CONTEXT, this patch replaces udelay() with usleep_range(). Signed-off-by: Yoshihiro Shimoda <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18USB: host: ohci-at91: add sam9x60-sfr definition for ohciNicolas Ferre1-2/+5
Add this SFR compatible definition for the sam9x60 SoC and manage its use in ohci-at91.c driver. Signed-off-by: Nicolas Ferre <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18xhci: Use struct_size() in kzalloc()Gustavo A. R. Silva1-2/+1
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; void *entry[]; }; instance = kzalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL); This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18usb: hub: add retry routine after intr URB submit errorNicolas Saenz Julienne2-6/+39
The hub sends hot-plug events to the host trough it's interrupt URB. The driver takes care of completing the URB and re-submitting it. Completion errors are handled in the hub_event() work, yet submission errors are ignored, rendering the device unresponsive. All further events are lost. It is fairly hard to find this issue in the wild, since you have to time the USB hot-plug event with the URB submission failure. For instance it could be the system running out of memory or some malfunction in the USB controller driver. Nevertheless, it's pretty reasonable to think it'll happen sometime. One can trigger this issue using eBPF's function override feature (see BCC's inject.py script). This patch adds a retry routine to the event of a submission error. The HUB driver will try to re-submit the URB once every second until it's successful or the HUB is disconnected. As some USB subsystems already take care of this issue, the implementation was inspired from usbhid/hid_core.c's. Signed-off-by: Nicolas Saenz Julienne <[email protected]> Reviewed-by: Oliver Neukum <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18USB: leds: fix regression in usbport led triggerChristian Lamparter1-7/+10
The patch "usb: simplify usbport trigger" together with "leds: triggers: add device attribute support" caused an regression for the usbport trigger. it will no longer enumerate any active usb hub ports under the "ports" directory in the sysfs class directory, if the usb host drivers are fully initialized before the usbport trigger was loaded. The reason is that the usbport driver tries to register the sysfs entries during the activate() callback. And this will fail with -2 / ENOENT because the patch "leds: triggers: add device attribute support" made it so that the sysfs "ports" group was only being added after the activate() callback succeeded. This version of the patch reverts parts of the "usb: simplify usbport trigger" patch and restores usbport trigger's functionality. Fixes: 6f7b0bad8839 ("usb: simplify usbport trigger") Signed-off-by: Christian Lamparter <[email protected]> Cc: stable <[email protected]> Acked-by: Jacek Anaszewski <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18usb: chipidea: fix static checker warning for NULL pointerPeter Chen1-1/+2
During the static checker, "data->usbmisc_data" may be NULL. Fix it by adding this pointer judgement before using. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Peter Chen <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-18USB: usbip: delete README fileGreg Kroah-Hartman1-7/+0
The README file ni the drivers/usb/usbip/ directory is not needed anymore, so just delete it. Cc: Valentina Manea <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Acked-by: Shuah Khan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-17USB: serial: pl2303: add new PID to support PL2303TBCharles Yeh2-0/+3
Add new PID to support PL2303TB (TYPE_HX) Signed-off-by: Charles Yeh <[email protected]> Cc: stable <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
2019-01-17usb: dwc2: gadget: Fix Remote Wakeup interrupt bit clearingMinas Harutyunyan1-1/+1
To clear GINTSTS2_WKUP_ALERT_INT bit in GINTSTS2 register require to write 1. This bit is implemented as "Write to clear". Fixes: 187c5298a122 ("usb: dwc2: gadget: Add handler for WkupAlert interrupt") Signed-off-by: Minas Harutyunyan <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-15Merge 5.0-rc2 into usb-nextGreg Kroah-Hartman8-20/+46
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-14USB: serial: ftdi_sio: fix GPIO not working in autosuspendKaroly Pados1-1/+14
There is a bug in the current GPIO code for ftdi_sio: it failed to take USB autosuspend into account. If the device is in autosuspend, calls to usb_control_msg() fail with -EHOSTUNREACH. Because the standard value for autosuspend timeout is usually 2-5 seconds, this made it almost impossible to use the GPIOs on machines that have USB autosuspend enabled. This patch fixes the issue by acquiring a PM lock on the device for the duration of the USB transfers. Tested on an FT231X device. Signed-off-by: Karoly Pados <[email protected]> [ johan: simplify code somewhat ] Fixes: ba93cc7da896 ("USB: serial: ftdi_sio: implement GPIO support for FT-X devices") Cc: stable <[email protected]> # 4.20 Signed-off-by: Johan Hovold <[email protected]>
2019-01-14usb: gadget: Potential NULL dereference on allocation errorDan Carpenter1-1/+1
The source_sink_alloc_func() function is supposed to return error pointers on error. The function is called from usb_get_function() which doesn't check for NULL returns so it would result in an Oops. Of course, in the current kernel, small allocations always succeed so this doesn't affect runtime. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-14usb: dwc3: gadget: Fix the uninitialized link_state when udc startsZeng Tao1-0/+1
Currently the link_state is uninitialized and the default value is 0(U0) before the first time we start the udc, and after we start the udc then stop the udc, the link_state will be undefined. We may have the following warnings if we start the udc again with an undefined link_state: WARNING: CPU: 0 PID: 327 at drivers/usb/dwc3/gadget.c:294 dwc3_send_gadget_ep_cmd+0x304/0x308 dwc3 100e0000.hidwc3_0: wakeup failed --> -22 [...] Call Trace: [<c010f270>] (unwind_backtrace) from [<c010b3d8>] (show_stack+0x10/0x14) [<c010b3d8>] (show_stack) from [<c034a4dc>] (dump_stack+0x84/0x98) [<c034a4dc>] (dump_stack) from [<c0118000>] (__warn+0xe8/0x100) [<c0118000>] (__warn) from [<c0118050>](warn_slowpath_fmt+0x38/0x48) [<c0118050>] (warn_slowpath_fmt) from [<c0442ec0>](dwc3_send_gadget_ep_cmd+0x304/0x308) [<c0442ec0>] (dwc3_send_gadget_ep_cmd) from [<c0445e68>](dwc3_ep0_start_trans+0x48/0xf4) [<c0445e68>] (dwc3_ep0_start_trans) from [<c0446750>](dwc3_ep0_out_start+0x64/0x80) [<c0446750>] (dwc3_ep0_out_start) from [<c04451c0>](__dwc3_gadget_start+0x1e0/0x278) [<c04451c0>] (__dwc3_gadget_start) from [<c04452e0>](dwc3_gadget_start+0x88/0x10c) [<c04452e0>] (dwc3_gadget_start) from [<c045ee54>](udc_bind_to_driver+0x88/0xbc) [<c045ee54>] (udc_bind_to_driver) from [<c045f29c>](usb_gadget_probe_driver+0xf8/0x140) [<c045f29c>] (usb_gadget_probe_driver) from [<bf005424>](gadget_dev_desc_UDC_store+0xac/0xc4 [libcomposite]) [<bf005424>] (gadget_dev_desc_UDC_store [libcomposite]) from[<c023d8e0>] (configfs_write_file+0xd4/0x160) [<c023d8e0>] (configfs_write_file) from [<c01d51e8>] (__vfs_write+0x1c/0x114) [<c01d51e8>] (__vfs_write) from [<c01d5ff4>] (vfs_write+0xa4/0x168) [<c01d5ff4>] (vfs_write) from [<c01d6d40>] (SyS_write+0x3c/0x90) [<c01d6d40>] (SyS_write) from [<c0107400>] (ret_fast_syscall+0x0/0x3c) Signed-off-by: Zeng Tao <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-14usb: dwc3: gadget: Clear req->needs_extra_trb flag on cleanupJack Pham1-0/+1
OUT endpoint requests may somtimes have this flag set when preparing to be submitted to HW indicating that there is an additional TRB chained to the request for alignment purposes. If that request is removed before the controller can execute the transfer (e.g. ep_dequeue/ep_disable), the request will not go through the dwc3_gadget_ep_cleanup_completed_request() handler and will not have its needs_extra_trb flag cleared when dwc3_gadget_giveback() is called. This same request could be later requeued for a new transfer that does not require an extra TRB and if it is successfully completed, the cleanup and TRB reclamation will incorrectly process the additional TRB which belongs to the next request, and incorrectly advances the TRB dequeue pointer, thereby messing up calculation of the next requeust's actual/remaining count when it completes. The right thing to do here is to ensure that the flag is cleared before it is given back to the function driver. A good place to do that is in dwc3_gadget_del_and_unmap_request(). Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize") Cc: [email protected] Signed-off-by: Jack Pham <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-14usb: dwc3: gadget: synchronize_irq dwc irq in suspendBo He1-0/+2
We see dwc3 endpoint stopped by unwanted irq during suspend resume test, which is caused dwc3 ep can't be started with error "No Resource". Here, add synchronize_irq before suspend to sync the pending IRQ handlers complete. Signed-off-by: Bo He <[email protected]> Signed-off-by: Yu Wang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2019-01-14Merge tag 'usb-5.0-rc2' of ↵Linus Torvalds5-6/+33
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb Pull USB fixes from Greg KH: "Here are some small USB driver fixes and quirk updates for 5.0-rc2. The majority here are some quirks for some storage devices to get them to work properly. There's also a fix here to resolve the reported issues with some audio devices that say they are UAC3 compliant, but really are not. And a fix up for the MAINTAINERS file to remove a dead url. All have been in linux-next with no reported issues" * tag 'usb-5.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: usb: storage: Remove outdated URL from MAINTAINERS USB: Add USB_QUIRK_DELAY_CTRL_MSG quirk for Corsair K70 RGB usbcore: Select only first configuration for non-UAC3 compliant devices USB: storage: add quirk for SMI SM3350 USB: storage: don't insert sane sense for SPC3+ when bad sense specified usb: cdc-acm: send ZLP for Telit 3G Intel based modems
2019-01-08USB: core: urb: Use struct_size() in kmalloc()Gustavo A. R. Silva1-3/+2
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; void *entry[]; }; instance = kmalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = kmalloc(struct_size(instance, entry, count), GFP_KERNEL); This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-08cross-tree: phase out dma_zalloc_coherent()Luis Chamberlain3-14/+13
We already need to zero out memory for dma_alloc_coherent(), as such using dma_zalloc_coherent() is superflous. Phase it out. This change was generated with the following Coccinelle SmPL patch: @ replace_dma_zalloc_coherent @ expression dev, size, data, handle, flags; @@ -dma_zalloc_coherent(dev, size, handle, flags) +dma_alloc_coherent(dev, size, handle, flags) Suggested-by: Christoph Hellwig <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]> [hch: re-ran the script on the latest tree] Signed-off-by: Christoph Hellwig <[email protected]>