summaryrefslogtreecommitdiff
path: root/drivers/usb
AgeCommit message (Collapse)AuthorFilesLines
2019-06-26usb: renesas_usbhs: move macros from mod.c to the mod.hYoshihiro Shimoda2-9/+9
In the future, since other source code of this driver will use these macros, this patch moves it to the header file. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-26usb: renesas_usbhs: remove notify_hotplug callbackYoshihiro Shimoda4-14/+10
The notify_hotplug callback was supported in v3.10, but the last user (armadillo800eva) was removed by the commit 1fa59bda21c7 ("ARM: shmobile: Remove legacy board code for Armadillo-800 EVA"). So, this patch removes it. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-26usb: renesas_usbhs: revise the irq_vbus commentsYoshihiro Shimoda1-5/+5
Since the irq_vbus comments doesn't match with the current implementation, this patch revises it. This patch also changes new lines to reduce the source code lines. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-26USB: core: Fix compiler warnings in devio.cAlan Stern1-6/+6
In the current kernel, devio.c generates a number of compiler warnings about taking the address of a member of a packed structure. The warnings all look like this one: drivers/usb/core/devio.c: In function ‘proc_do_submiturb’: drivers/usb/core/devio.c:1489:43: warning: taking address of packed member of ‘struct usb_ctrlrequest’ may result in an unaligned pointer value [-Waddress-of-packed-member] 1489 | if (uurb->buffer_length < (le16_to_cpup(&dr->wLength) + 8)) { | ^~~~~~~~~~~~ These warnings can easily be eliminated by changing various le16_to_cpup() calls to use le16_to_cpu() instead. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-26USB: core: Remove usbfs_mutexAlan Stern3-13/+0
Commit 4a2a8a2cce86 ("usbfs: private mutex for open, release, and remove") is now obsolete. The commit was created back when we had to handle both usbfs device nodes and the old usbdevfs filesystem (/proc/bus/usb/), but usbdevfs no longer exists. This means there's no longer any need to hold a mutex during two separate removal operations (and thus during an entire notifier chain call). Furthermore, the one remaining remove/release pair doesn't race with open thanks to the synchronization provided by the device model core in bus_find_device(). Remove and release don't race with each other because they both run with the device lock held. The upshot is that usbfs_mutex isn't needed any more. This patch removes it entirely. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-23Merge 5.2-rc6 into usb-nextGreg Kroah-Hartman6-15/+72
We need the USB fixes in here too. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-21usb: clean up some of the computations in adu_readDaniel M German1-9/+7
Replace ?: with min to calculate the number of bytes in the secondary buffer, including changing the data type of data_in_secondary to size_t to be type-consistent. data_in_secondary can never be negative. Remove some spurious calculations (copy_to_user returns zero on success), making one variable redundant (i) This change does not alter the functionality of the code. Signed-off-by: Daniel M German <dmg@turingmachine.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-20docs: usb: rename files to .rst and add them to drivers-apiMauro Carvalho Chehab24-32/+32
While there are a mix of things here, most of the stuff were written from Kernel developer's PoV. So, add them to the driver-api book. A follow up for this patch would be to move documents from there that are specific to sysadmins, adding them to the admin-guide. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Johan Hovold <johan@kernel.org> Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-20usb: renesas_usbhs: Use struct assignment instead of memcpy()Yoshihiro Shimoda1-9/+4
To avoid the error-proneness of calls to sizeof() in the memcpy, this patch uses struct assignment instead of memcpy. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au>--- This patch is based on Greg's linux-usb.git / usb-next branch. Note that mod_host.c also has memcpy but we cannot use struct assignment for it because the type of urb->setup_patcket is just "unsigned char *". drivers/usb/renesas_usbhs/common.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-20USB: core: correct a spelling mistake in the commentHarry Pan1-1/+1
Fix a spelling typo in the function comment. Signed-off-by: Harry Pan <harry.pan@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-20Merge tag 'fixes-for-v5.2-rc5' of ↵Greg Kroah-Hartman2-9/+9
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus Felipe writes: usb: fixes for v5.2-rc5 A single fix to take into account the PHY width during initialization of dwc2 driver. This change allows deviceTree to pass PHY width if necessary. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> * tag 'fixes-for-v5.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: usb: dwc2: Use generic PHY width in params setup
2019-06-18xhci: detect USB 3.2 capable host controllers correctlyMathias Nyman1-5/+15
USB 3.2 capability in a host can be detected from the xHCI Supported Protocol Capability major and minor revision fields. If major is 0x3 and minor 0x20 then the host is USB 3.2 capable. For USB 3.2 capable hosts set the root hub lane count to 2. The Major Revision and Minor Revision fields contain a BCD version number. The value of the Major Revision field is JJh and the value of the Minor Revision field is MNh for version JJ.M.N, where JJ = major revision number, M - minor version number, N = sub-minor version number, e.g. version 3.1 is represented with a value of 0310h. Also fix the extra whitespace printed out when announcing regular SuperSpeed hosts. Cc: <stable@vger.kernel.org> # v4.18+ Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-18usb: xhci: Don't try to recover an endpoint if port is in error state.Mathias Nyman3-1/+28
A USB3 device needs to be reset and re-enumarated if the port it connects to goes to a error state, with link state inactive. There is no use in trying to recover failed transactions by resetting endpoints at this stage. Tests show that in rare cases, after multiple endpoint resets of a roothub port the whole host controller might stop completely. Several retries to recover from transaction error can happen as it can take a long time before the hub thread discovers the USB3 port error and inactive link. We can't reliably detect the port error from slot or endpoint context due to a limitation in xhci, see xhci specs section 4.8.3: "There are several cases where the EP State field in the Output Endpoint Context may not reflect the current state of an endpoint" and "Software should maintain an accurate value for EP State, by tracking it with an internal variable that is driven by Events and Doorbell accesses" Same appears to be true for slot state. set a flag to the corresponding slot if a USB3 roothub port link goes inactive to prevent both queueing new URBs and resetting endpoints. Reported-by: Rapolu Chiranjeevi <chiranjeevi.rapolu@intel.com> Tested-by: Rapolu Chiranjeevi <chiranjeevi.rapolu@intel.com> Cc: <stable@vger.kernel.org> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-18usb: dwc2: Use generic PHY width in params setupJules Maselbas2-9/+9
Setting params.phy_utmi_width in dwc2_lowlevel_hw_init() is pointless since it's value will be overwritten by dwc2_init_params(). This change make sure to take in account the generic PHY width information during paraminitialisation, done in dwc2_set_param_phy_utmi_width(). By doing so, the phy_utmi_width params can still be overrided by devicetree specific params and will also be checked against hardware capabilities. Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with phy_utmi_width") Acked-by: Minas Harutyunyan <hminas@synopsys.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-18usb: host: fotg2: add device tree probingHans Ulli Kroll1-0/+10
Add device tree probing to the fotg2 driver. Signed-off-by: Hans Ulli Kroll <ulli.kroll@googlemail.com> [Drop DMA mask coercion, drivers/of/platform.c does the job] Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-18wusb: switch to cbcmac transformArd Biesheuvel2-130/+47
The wusb code takes a very peculiar approach at implementing CBC-MAC, by using plain CBC into a scratch buffer, and taking the output IV as the MAC. We can clean up this code substantially by switching to the cbcmac shash, as exposed by the CCM template. To ensure that the module is loaded on demand, add the cbcmac template name as a module alias. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-18usb: isp1362: Spelling s/eclusive/exclusive/Geert Uytterhoeven1-1/+1
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-18USB: add usbfs ioctl to retrieve the connection parametersDmitry Torokhov1-1/+41
Recently usfbs gained availability to retrieve device speed, but there is sill no way to determine the bus number or list of ports the device is connected to when using usbfs. While this information can be obtained from sysfs, not all environments allow sysfs access. In a jailed environment a program might be simply given an opened file descriptor to usbfs device, and it is really important that all data can be gathered from said file descriptor. This patch introduces a new ioctl, USBDEVFS_CONNINFO_EX, which return extended connection information for the device, including the bus number, address, port list and speed. The API allows kernel to extend amount of data returned by the ioctl and userspace has an option of adjusting the amount of data it is willing to consume. A new capability, USBDEVFS_CAP_CONNINFO_EX, is introduced to help userspace in determining whether the kernel supports this new ioctl. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-18usb: host: xhci-tegra: Fix Wunused-const-variableNathan Huckleberry1-23/+0
Clang produces the following warning drivers/usb/host/xhci-tegra.c:357:27: warning: unused variable 'mbox_cmd_name' [-Wunused-const-variable] static const char * const mbox_cmd_name[] = { Looks like it was intended for logging or debugging, but was never implemented. Removing mbox_cmd_name. Cc: clang-built-linux@googlegroups.com Link: https://github.com/ClangBuiltLinux/linux/issues/533 Signed-off-by: Nathan Huckleberry <nhuck@google.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-17usb: chipidea: udc: workaround for endpoint conflict issuePeter Chen1-0/+20
An endpoint conflict occurs when the USB is working in device mode during an isochronous communication. When the endpointA IN direction is an isochronous IN endpoint, and the host sends an IN token to endpointA on another device, then the OUT transaction may be missed regardless the OUT endpoint number. Generally, this occurs when the device is connected to the host through a hub and other devices are connected to the same hub. The affected OUT endpoint can be either control, bulk, isochronous, or an interrupt endpoint. After the OUT endpoint is primed, if an IN token to the same endpoint number on another device is received, then the OUT endpoint may be unprimed (cannot be detected by software), which causes this endpoint to no longer respond to the host OUT token, and thus, no corresponding interrupt occurs. There is no good workaround for this issue, the only thing the software could do is numbering isochronous IN from the highest endpoint since we have observed most of device number endpoint from the lowest. Cc: <stable@vger.kernel.org> #v3.14+ Cc: Fabio Estevam <festevam@gmail.com> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Cc: Jun Li <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-17Merge 5.2-rc5 into usb-nextGreg Kroah-Hartman15-45/+105
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-12usb: typec: Make sure an alt mode exist before getting its partnerHeikki Krogerus1-1/+1
Adding check to typec_altmode_get_partner() to prevent potential NULL pointer dereference. Reported-by: Vladimir Yerilov <openmindead@gmail.com> Fixes: ad74b8649bea ("usb: typec: ucsi: Preliminary support for alternate modes") Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-10Revert "usb: mtu3: fix up undefined reference to usb_debug_root"Chunfeng Yun1-1/+2
It's not needed after [1] is applied, because usb_debug_root is created by usb common core but not usbcore now. [1] 812086d362a1 ("USB: move usb debugfs directory creation to the usb common core") Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-10USB: sisusbvga: Remove unneeded variableHariprasad Kelam1-6/+4
Remove unneeded variable ret in function sisusb_set_default_mode. Change return type of sisusb_set_default_mode from int to void as it never fails. Issue identified by coccicheck Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com> ----- changes in v2: Change return type of sisusb_set_default_mode from int to void as it never fails changes in v3: Update changelog ---- Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-10Merge tag 'usb-serial-5.2-rc5' of ↵Greg Kroah-Hartman3-0/+10
https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus Johan writes: USB-serial fixes for 5.2-rc5 Here are some new device ids for option and pl2303. All have been in linux-next with no reported issues. Signed-off-by: Johan Hovold <johan@kernel.org> * tag 'usb-serial-5.2-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial: USB: serial: option: add Telit 0x1260 and 0x1261 compositions USB: serial: pl2303: add Allied Telesis VT-Kit3 USB: serial: option: add support for Simcom SIM7500/SIM7600 RNDIS mode
2019-06-08usb: typec: tcpm: fusb302: simplify getting the adapter of a clientWolfram Sang1-2/+1
We have a dedicated pointer for that, so use it. Much easier to read and less computation involved. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-08Merge tag 'fixes-for-v5.2-rc4' of ↵Greg Kroah-Hartman8-42/+82
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus Felipe writes: USB: fixes for v5.2-rc4 DWC2 gets a fix for zlp handling which allows DWC2 to pass USBCV MSC tests. A memory leak in fusb300 was plugged. DWC2 also got a fix for wMaxPacketSize handling while acting as host which fixes a regression with USB Cameras. Apart from these, the usual set of minor fixes. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> * tag 'fixes-for-v5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: usb: gadget: udc: lpc32xx: fix return value check in lpc32xx_udc_probe() usb: gadget: dwc2: fix zlp handling usb: dwc2: Set actual frame number for completed ISOC transfer for none DDMA usb: gadget: udc: lpc32xx: allocate descriptor with GFP_ATOMIC usb: gadget: fusb300_udc: Fix memory leak of fusb300->ep[i] usb: phy: mxs: Disable external charger detect in mxs_phy_hw_init() usb: dwc2: Fix DMA cache alignment issues usb: dwc2: host: Fix wMaxPacketSize handling (fix webcam regression)
2019-06-06usb: gadget: udc: lpc32xx: fix return value check in lpc32xx_udc_probe()Wei Yongjun1-2/+2
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). This issue was detected by using the Coccinelle software. Fixes: 408b56ca5c8e ("usb: gadget: udc: lpc32xx: simplify probe") Acked-by: Sylvain Lemieux <slemieux.tyco@gmail.com> Acked-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-06usb: gadget: dwc2: fix zlp handlingAndrzej Pietrasiewicz1-8/+12
The patch 10209abe87f5ebfd482a00323f5236d6094d0865 usb: dwc2: gadget: Add scatter-gather mode avoided a NULL pointer dereference (hs_ep->req == NULL) by calling dwc2_gadget_fill_nonisoc_xfer_dma_one() directly instead of through the dwc2_gadget_config_nonisoc_xfer_ddma() wrapper, which unconditionally dereferenced the said pointer. However, this was based on an incorrect assumption that in the context of dwc2_hsotg_program_zlp() the pointer is always NULL, which is not the case. The result were SB CV MSC tests failing starting from Test Case 6. Instead, this patch reverts to calling the wrapper and adds a check for the pointer being NULL inside the wrapper. Fixes: 10209abe87f5 (usb: dwc2: gadget: Add scatter-gather mode) Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-06usb: dwc2: Set actual frame number for completed ISOC transfer for none DDMAMinas Harutyunyan1-0/+4
On ISOC OUT transfer completion, in none DDMA mode, set actual frame number returning to function driver in usb_request. Signed-off-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-06usb: gadget: udc: lpc32xx: allocate descriptor with GFP_ATOMICAlexandre Belloni1-2/+1
Gadget drivers may queue request in interrupt context. This would lead to a descriptor allocation in that context. In that case we would hit BUG_ON(in_interrupt()) in __get_vm_area_node. Also remove the unnecessary cast. Acked-by: Sylvain Lemieux <slemieux.tyco@gmail.com> Tested-by: James Grant <jamesg@zaltys.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-06usb: gadget: fusb300_udc: Fix memory leak of fusb300->ep[i]Young Xiao1-0/+5
There is no deallocation of fusb300->ep[i] elements, allocated at fusb300_probe. The patch adds deallocation of fusb300->ep array elements. Signed-off-by: Young Xiao <92siuyang@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-06usb: phy: mxs: Disable external charger detect in mxs_phy_hw_init()Andrey Smirnov1-0/+14
Since this driver already handles changer detction state, copy the workaround code currently residing in arch/arm/mach-imx/anatop.c into this drier to consolidate the places modifying it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Chris Healy <cphealy@gmail.com> Cc: Felipe Balbi <balbi@kernel.org> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Fabio Estevam <festevam@gmail.com> Cc: NXP Linux Team <linux-imx@nxp.com> Cc: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-06usb: dwc2: Fix DMA cache alignment issuesMartin Schiller1-3/+7
Insert a padding between data and the stored_xfer_buffer pointer to ensure they are not on the same cache line. Otherwise, the stored_xfer_buffer gets corrupted for IN URBs on non-cache-coherent systems. (In my case: Lantiq xRX200 MIPS) Fixes: 3bc04e28a030 ("usb: dwc2: host: Get aligned DMA in a more supported way") Fixes: 56406e017a88 ("usb: dwc2: Fix DMA alignment to start at allocated boundary") Cc: <stable@vger.kernel.org> Tested-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Acked-by: Minas Harutyunyan <hminas@synopsys.com> Signed-off-by: Martin Schiller <ms@dev.tdt.de> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-06usb: dwc2: host: Fix wMaxPacketSize handling (fix webcam regression)Douglas Anderson4-27/+37
In commit abb621844f6a ("usb: ch9: make usb_endpoint_maxp() return only packet size") the API to usb_endpoint_maxp() changed. It used to just return wMaxPacketSize but after that commit it returned wMaxPacketSize with the high bits (the multiplier) masked off. If you wanted to get the multiplier it was now up to your code to call the new usb_endpoint_maxp_mult() which was introduced in commit 541b6fe63023 ("usb: add helper to extract bits 12:11 of wMaxPacketSize"). Prior to the API change most host drivers were updated, but no update was made to dwc2. Presumably it was assumed that dwc2 was too simplistic to use the multiplier and thus just didn't support a certain class of USB devices. However, it turns out that dwc2 did use the multiplier and many devices using it were working quite nicely. That means that many USB devices have been broken since the API change. One such device is a Logitech HD Pro Webcam C920. Specifically, though dwc2 didn't directly call usb_endpoint_maxp(), it did call usb_maxpacket() which in turn called usb_endpoint_maxp(). Let's update dwc2 to work properly with the new API. Fixes: abb621844f6a ("usb: ch9: make usb_endpoint_maxp() return only packet size") Cc: stable@vger.kernel.org Acked-by: Minas Harutyunyan <hminas@synopsys.com> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-06-06USB: move usb debugfs directory creation to the usb common coreGreg Kroah-Hartman5-14/+43
The USB gadget subsystem wants to use the USB debugfs root directory, so move it to the common "core" USB code so that it is properly initialized and removed as needed. In order to properly do this, we need to load the common code before the usb core code, when everything is linked into the kernel, so reorder the link order of the code. Also as the usb common code has the possibility of the led trigger logic to be merged into it, handle the build option properly by only having one module init/exit function and have the common code initialize the led trigger if needed. Reported-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Cc: Felipe Balbi <felipe.balbi@linux.intel.com> Tested-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06usb: host: u132-hcd: remove unneeded variable frameHariprasad Kelam1-2/+1
This patch fixes below issue reported by coccicheck drivers/usb/host/u132-hcd.c:2557:6-11: Unneeded variable: "frame". Return "0" on line 2560 Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05usbip: Replace unused kvec array with single variable in vhci_send_cmd_unlink()Suwan Kim1-7/+5
vhci_send_cmd_unlink() declears kvec array of size 3 but it actually uses just one element of the array. So, remove kvec array and replace it with single kvec variable. Signed-off-by: Suwan Kim <suwan.kim027@gmail.com> Acked-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05usb: renesas_usbhs: remove controlling PWEN/EXTLP supportYoshihiro Shimoda1-4/+0
Controlling PWMEN/EXTLP (named as "has_otg") was supported in v3.2, but the last user (kzm9g) was removed by the commit 30f8925a57d8ad49 ("ARM: shmobile: Remove legacy board code for KZM-A9-GT"). So, this patch remove it. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05usb: renesas_usbhs: remove sudmac supportYoshihiro Shimoda1-5/+1
SUDMAC feature was supported in v3.10, but was never used by any platform. So, this patch removes it. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05usb: xhci: Add Clear_TT_BufferJim Lin3-1/+52
USB 2.0 specification chapter 11.17.5 says "as part of endpoint halt processing for full-/low-speed endpoints connected via a TT, the host software must use the Clear_TT_Buffer request to the TT to ensure that the buffer is not in the busy state". In our case, a full-speed speaker (ConferenceCam) is behind a high- speed hub (ConferenceCam Connect), sometimes once we get STALL on a request we may continue to get STALL with the folllowing requests, like Set_Interface. Here we invoke usb_hub_clear_tt_buffer() to send Clear_TT_Buffer request to the hub of the device for the following Set_Interface requests to the device to get ACK successfully. Signed-off-by: Jim Lin <jilin@nvidia.com> Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05usb: Add devaddr in struct usb_deviceJim Lin2-1/+5
The Clear_TT_Buffer request sent to the hub includes the address of the LS/FS child device in wValue field. usb_hub_clear_tt_buffer() uses udev->devnum to set the address wValue. This won't work for devices connected to xHC. For other host controllers udev->devnum is the same as the address of the usb device, chosen and set by usb core. With xHC the controller hardware assigns the address, and won't be the same as devnum. Here we add devaddr in "struct usb_device" for usb_hub_clear_tt_buffer() to use. Signed-off-by: Jim Lin <jilin@nvidia.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05USB: Fix chipmunk-like voice when using Logitech C270 for recording audio.Marco Zatta1-0/+3
This patch fixes the chipmunk-like voice that manifets randomly when using the integrated mic of the Logitech Webcam HD C270. The issue was solved initially for this device by commit 2394d67e446b ("USB: add RESET_RESUME for webcams shown to be quirky") but it was then reintroduced by e387ef5c47dd ("usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams"). This patch is to have the fix back. Signed-off-by: Marco Zatta <marco@zatta.me> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05USB: usb-storage: Add new ID to ums-realtekKai-Heng Feng1-0/+5
There is one more Realtek card reader requires ums-realtek to work correctly. Add the device ID to support it. Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03usb: phy: mv-usb: Remove set but not used variable 'phy'YueHaibing1-2/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/usb/phy/phy-mv-usb.c: In function mv_otg_work: drivers/usb/phy/phy-mv-usb.c:404:18: warning: variable phy set but not used [-Wunused-but-set-variable] It's no used since commit e47d92545c29 ("usb: move the OTG state from the USB PHY to the OTG structure") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03usb: ftdi-elan: fix possible condition with no effect (if == else)Hariprasad Kelam1-7/+0
fix below warning reported by coccicheck ./drivers/usb/misc/ftdi-elan.c:2026:11-13: WARNING: possible condition with no effect (if == else) Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03USB: ohci-spear: Remove set but not used variable 'ohci'YueHaibing1-3/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/usb/host/ohci-spear.c: In function spear_ohci_hcd_drv_probe: drivers/usb/host/ohci-spear.c:38:19: warning: variable ohci set but not used [-Wunused-but-set-variable] It is never used since commit 1cc6ac59ffaa ("USB: OHCI: make ohci-spear a separate driver") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03USB: atm: ueagle-atm.c: remove redundant license textGreg Kroah-Hartman1-45/+1
Now that we have the correct SPDX tag for the ueagle-atm.c file, the wall of "boiler-plate" text is not needed. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Matthieu CASTET <castet.matthieu@free.fr> Cc: Stanislaw Gruszka <stf_xl@wp.pl> Cc: Damien Bergamini <damien.bergamini@free.fr> Cc: Duncan Sands <duncan.sands@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03USB: atm: ueagle-atm.c: fix SPDX tag to be BSD2Greg Kroah-Hartman1-1/+1
Thomas rightly points out that I got the BSD clause count wrong for this driver, it should be 2, not 3 based on the text in the license here, so fix that up. He also raises the question that the license text points to a v2 only license, yet the text in the header says "or later". Given that the text in the header says "or later" and all of the other USB atm drivers are licensed in that way, I am going to leave the string as-is for that mark. Reported-by: Thomas Gleixner <tglx@linutronix.de> Cc: Matthieu CASTET <castet.matthieu@free.fr> Cc: Stanislaw Gruszka <stf_xl@wp.pl> Cc: Damien Bergamini <damien.bergamini@free.fr> Cc: Duncan Sands <duncan.sands@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03usb: ohci-s3c2410: Remove set but not used variable 'hcd'YueHaibing1-2/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/usb/host/ohci-s3c2410.c: In function s3c2410_hcd_oc: drivers/usb/host/ohci-s3c2410.c:296:18: warning: variable hcd set but not used [-Wunused-but-set-variable] It is never used, so can be removed. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>