summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* USB: hub: Clean up use of port initialization schemes and retriesAlan Stern2020-10-021-23/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | The SET_CONFIG_TRIES macro in hub.c is badly named; it controls the number of port-initialization retry attempts rather than the number of Set-Configuration attempts. Furthermore, the USE_NEW_SCHEME macro and use_new_scheme() function are written in a very confusing manner, making it almost impossible to figure out exactly what they do or check that they are correct. This patch renames SET_CONFIG_TRIES to PORT_INIT_TRIES, removes USE_NEW_SCHEME entirely, and rewrites use_new_scheme() to be much more transparent, with added comments explaining how it works. The patch also pulls the single call site of use_new_scheme() out from the Get-Descriptor retry loop (where it returns the same value each time) and renames the local variable used to store the result. The overall effect is a minor cleanup. However, there is one functional change: If the "use_both_schemes" module parameter isn't set (by default it is set), the existing code does only two retry iterations. After this patch it will always perform four, regardless of the parameter's value. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Link: https://lore.kernel.org/r/20200928152050.GA134701@rowland.harvard.edu Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Merge tag 'thunderbolt-for-v5.10-rc1' of ↵Greg Kroah-Hartman2020-09-3021-291/+1971
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next Mika writes: thunderbolt: Changes for v5.10 merge window This includes following Thunderbolt/USB4 changes for v5.10 merge window: * A couple of optimizations around Tiger Lake force power logic and NHI (Native Host Interface) LC (Link Controller) mailbox command processing * Power management improvements for Software Connection Manager * Debugfs support * Allow KUnit tests to be enabled also when Thunderbolt driver is configured as module. * Few minor cleanups and fixes All these have been in linux-next with no reported issues. * tag 'thunderbolt-for-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: (37 commits) thunderbolt: Capitalize comment on top of QUIRK_FORCE_POWER_LINK_CONTROLLER thunderbolt: Correct tb_check_quirks() kernel-doc thunderbolt: Log correct zeroX entries in decode_error() thunderbolt: Handle ERR_LOCK notification thunderbolt: Use "if USB4" instead of "depends on" in Kconfig thunderbolt: Allow KUnit tests to be built also when CONFIG_USB4=m thunderbolt: Only stop control channel when entering freeze thunderbolt: debugfs: Fix uninitialized return in counters_write() thunderbolt: Add debugfs interface thunderbolt: No need to warn in TB_CFG_ERROR_INVALID_CONFIG_SPACE thunderbolt: Introduce tb_switch_is_tiger_lake() thunderbolt: Introduce tb_switch_is_ice_lake() thunderbolt: Check for Intel vendor ID when identifying controller thunderbolt: Introduce tb_port_is_nhi() thunderbolt: Introduce tb_switch_next_cap() thunderbolt: Introduce tb_port_next_cap() thunderbolt: Move struct tb_cap_any to tb_regs.h thunderbolt: Add runtime PM for Software CM thunderbolt: Create device links from ACPI description ACPI: Export acpi_get_first_physical_node() to modules ...
| * thunderbolt: Capitalize comment on top of QUIRK_FORCE_POWER_LINK_CONTROLLERMika Westerberg2020-09-161-1/+1
| | | | | | | | | | | | To keep it consistent with the other single line comments in the driver. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Correct tb_check_quirks() kernel-docMika Westerberg2020-09-161-1/+1
| | | | | | | | | | | | Remove extra white space and make the sentence end with a period. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Log correct zeroX entries in decode_error()Mika Westerberg2020-09-161-3/+8
| | | | | | | | | | | | | | There was copy & paste error so it always printed value of pkg->zero1. Also use tb_ctl_warn() here, no need to print backtrace. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Handle ERR_LOCK notificationMika Westerberg2020-09-162-0/+8
| | | | | | | | | | | | | | | | | | | | If the USB4 router downstream port is locked, sending configuration packet to a router below it causes ERR_LOCK to be sent. Instead of warn splat about unknown error we log the error (just warning level) and return -EACCESS instead. The idea is that we may want to do something when such error code is received, like perform unlock. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Use "if USB4" instead of "depends on" in KconfigMika Westerberg2020-09-161-2/+4
| | | | | | | | | | | | | | This groups the USB4 options more nicely, and also does not require that every config option lists explicit depends on USB4. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Allow KUnit tests to be built also when CONFIG_USB4=mMika Westerberg2020-09-165-4/+26
| | | | | | | | | | | | | | | | | | This adds a bit more build coverage for the tests even though these are not expected to be enabled by normal users and distros. In order to make this working we need to open-code kunit_test_suite() and call the relevant functions directly in the driver init/exit hook. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Only stop control channel when entering freezeMika Westerberg2020-09-164-3/+69
| | | | | | | | | | | | | | | | | | | | According to the kernel power management documentation freeze phase should only quiesce the device, no need to configure wakes or put it to low power state. For this reason we simply stop the control channel and in case of Software Connection Manager also mark the hotplug disabled. This should align the driver better with the PM framework expectations. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: debugfs: Fix uninitialized return in counters_write()Dan Carpenter2020-09-101-0/+1
| | | | | | | | | | | | | | | | | | If the first line is in an invalid format then the "ret" value is uninitialized. We should return -EINVAL instead. Fixes: 54e418106c76 ("thunderbolt: Add debugfs interface") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Add debugfs interfaceGil Fine2020-09-037-3/+742
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds debugfs interface that can be used for debugging possible issues in hardware/software. It exposes router and adapter config spaces through files like this: /sys/kernel/debug/thunderbolt/<DEVICE>/regs /sys/kernel/debug/thunderbolt/<DEVICE>/<PORT1>/regs /sys/kernel/debug/thunderbolt/<DEVICE>/<PORT1>/path /sys/kernel/debug/thunderbolt/<DEVICE>/<PORT1>/counters /sys/kernel/debug/thunderbolt/<DEVICE>/<PORT2>/regs /sys/kernel/debug/thunderbolt/<DEVICE>/<PORT2>/path /sys/kernel/debug/thunderbolt/<DEVICE>/<PORT2>/counters ... The "regs" is either the router or port configuration space register dump. The "path" is the port path configuration space and "counters" is the optional counters configuration space. These files contains one register per line so it should be easy to use normal filtering tools to find the registers of interest if needed. The router and adapter regs file becomes writable when CONFIG_USB4_DEBUGFS_WRITE is enabled (which is not supposed to be done in production systems) and in this case the developer can write "offset value" lines there to modify the hardware directly. For convenience this also supports the long format the read side produces (but ignores the additional fields). The counters file can be written even when CONFIG_USB4_DEBUGFS_WRITE is not enabled and it is only used to clear the counter values. Signed-off-by: Gil Fine <gil.fine@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * thunderbolt: No need to warn in TB_CFG_ERROR_INVALID_CONFIG_SPACEMika Westerberg2020-09-031-3/+2
| | | | | | | | | | | | | | | | | | | | This may be returned for example when accessing some of the vendor specific capabilities. It is not fatal by any means so instead of WARN() just log it as debug level. The caller gets error back anyway and is expected to handle it accordingly. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * thunderbolt: Introduce tb_switch_is_tiger_lake()Gil Fine2020-09-031-0/+12
| | | | | | | | | | | | | | | | This is needed to differentiate Tiger Lake from other controllers. Signed-off-by: Gil Fine <gil.fine@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * thunderbolt: Introduce tb_switch_is_ice_lake()Mika Westerberg2020-09-031-0/+12
| | | | | | | | | | | | | | This is needed to differentiate Ice Lake from other controllers. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * thunderbolt: Check for Intel vendor ID when identifying controllerMika Westerberg2020-09-031-29/+35
| | | | | | | | | | | | | | | | With USB4 there will be other vendors so make sure the current checks for different Intel controllers will not accidentally match those. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * thunderbolt: Introduce tb_port_is_nhi()Mika Westerberg2020-09-032-1/+6
| | | | | | | | | | | | | | | | This is useful if one needs to check if adapter (port) is the host interface (NHI). Make tb_port_alloc_hopid() take advantage of this. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * thunderbolt: Introduce tb_switch_next_cap()Mika Westerberg2020-09-032-30/+64
| | | | | | | | | | | | | | | | | | This is similar to tb_port_next_cap() but instead allows walking capability list of a switch (router). Convert tb_switch_find_cap() and tb_switch_find_vse_cap() to use this as well. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * thunderbolt: Introduce tb_port_next_cap()Mika Westerberg2020-09-032-4/+32
| | | | | | | | | | | | | | | | This function is useful for walking port config space (adapter) capability lists. Convert the tb_port_find_cap() to use this as well. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * thunderbolt: Move struct tb_cap_any to tb_regs.hMika Westerberg2020-09-032-8/+14
| | | | | | | | | | | | | | | | | | | | This structure will be needed by the debugfs implementation so make it available outside of cap.c. While there add kernel-doc comments to the structure. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * thunderbolt: Add runtime PM for Software CMMika Westerberg2020-09-033-7/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds runtime PM support for the Software Connection Manager parts of the driver. This allows to save power when either there is no device attached at all or there is a device attached and all following conditions are true: - Tunneled PCIe root/downstream ports are runtime suspended - Tunneled USB3 ports are runtime suspended - No active DisplayPort stream - No active XDomain connection For the first two we take advantage of device links that were added in previous patch. Difference for the system sleep case is that we also enable wakes when something is geting plugged in/out of the Thunderbolt ports. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Create device links from ACPI descriptionMika Westerberg2020-09-034-0/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new way to describe relationship between tunneled ports and USB4 NHI (Native Host Interface) is with ACPI _DSD looking like below for a PCIe downstream port: Scope (\_SB.PCI0) { Device (NHI0) { } // Thunderbolt NHI Device (DSB0) // Hotplug downstream port { Name (_DSD, Package () { ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package () {"usb4-host-interface", \_SB.PCI0.NHI0}, ... } }) } } This is "documented" in these [1] USB-IF slides and being used on systems that ship with Windows. The _DSD can be added to tunneled USB3 and PCIe ports, and is needed to make sure the USB4 NHI is resumed before any of the tunneled ports so the protocol tunnels get established properly before the actual port itself is resumed. Othwerwise the USB/PCI core find the link may not be established and starts tearing down the device stack. This parses the ACPI description each time NHI is probed and tries to find devices that has the property and it references the NHI in question. For each matching device a device link from that device to the NHI is created. Since USB3 ports themselves do not get runtime suspended with the parent device (hub) we do not add the link from the USB3 port to USB4 NHI but instead we add the link from the xHCI device. This makes the device link usable for runtime PM as well. [1] https://www.usb.org/sites/default/files/D1T2-2%20-%20USB4%20on%20Windows.pdf Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| * ACPI: Export acpi_get_first_physical_node() to modulesMika Westerberg2020-09-031-0/+1
| | | | | | | | | | | | | | | | | | This function will be needed by the Thunderbolt driver when it parses ACPI description for linking tunneled ports to the Thunderbolt controller device. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| * PCI / thunderbolt: Switch to use device links instead of PCI quirkMika Westerberg2020-09-032-57/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On older Apple systems there is currently a PCI quirk in place to block resume of tunneled PCIe ports until NHI (Thunderbolt controller) is resumed. This makes sure the PCIe tunnels are re-established before PCI core notices it. With device links the same thing can be done without quirks. The driver core will make sure the supplier (NHI) is resumed before consumers (PCIe downstream ports). For this reason switch the Thunderbolt driver to use device links and remove the PCI quirk. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
| * thunderbolt: Enable wakes from system suspendMika Westerberg2020-09-037-3/+231
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order for the router and the whole domain to wake up from system suspend states we need to enable wakes for the connected routers. For device routers we enable wakes from PCIe and USB 3.x. This allows devices such as keyboards connected to USB 3.x hub that is tunneled to wake the system up as expected. For all routers we enabled wake on USB4 for each connected ports. This is used to propagate the wake from router to another. Do the same for legacy routers through link controller vendor specific registers as documented in USB4 spec chapter 13. While there correct kernel-doc of usb4_switch_set_sleep() -- it does not enable wakes instead there is a separate function (usb4_switch_set_wake()) that does. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Disable lane 1 for XDomain connectionMika Westerberg2020-09-034-0/+55
| | | | | | | | | | | | | | | | | | USB4 spec mandates that the lane 1 should be disabled if lanes are not bonded. For host-to-host connections (XDomain) we don't support lane bonding so in order to be compatible with the spec, disable lane 1 when another host is connected. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Configure port for XDomainMika Westerberg2020-09-035-4/+134
| | | | | | | | | | | | | | | | | | | | | | When the port is connected to another host it should be marked as such in the USB4 port capability. This information is used by the router during sleep and wakeup. Also do the same for legacy switches via link controller vendor specific registers. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Set port configured for both ends of the linkMika Westerberg2020-09-034-94/+87
| | | | | | | | | | | | | | | | | | | | Both ends of the link needs to have this set. Otherwise the link is not re-established properly after sleep. Now since it is possible to have mixed USB4 and Thunderbolt 1, 2 and 3 devices we need to split the link configuration functionality to happen per port so we can pick the correct implementation. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Configure link after lane bonding is enabledMika Westerberg2020-09-035-25/+49
| | | | | | | | | | | | | | | | | | | | During testing it was noticed that the link is not properly restored after the domain exits sleep if the link configured bits are set before lane bonding is enabled. The USB4 spec does not say in which order these need to be set but setting link configured afterwards makes the link restoration work so we do that instead. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Do not change default USB4 router notification timeoutMika Westerberg2020-09-031-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Some early stage USB4 devices do not like that any of the enumerating router config space fields (ROUTER_CS_1 - ROUTER_CS_4) are written after the initial enumeration for example when entering sleep states. The default timeout by the USB4 spec is 10 ms which should be fine for the driver to handle. For this reason do not change the notification timeout from the default 10 ms for USB4 routers. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Initialize TMU again on resumeMika Westerberg2020-09-031-0/+4
| | | | | | | | | | | | | | | | The TMU will be reset after router exits sleep so in order to re-configure it upon resume make sure the structure is initialized again based on the current hardware state. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Tear down DP tunnels when suspendingMika Westerberg2020-09-031-0/+24
| | | | | | | | | | | | | | | | | | | | DP tunnels do not need the same kind of treatment as others because they are created based on hot-plug events on DP adapter ports, and the display stack does not need the tunnels to be enabled when resuming from suspend. Also Tiger Lake Thunderbolt controller sends unplug event on D3 exit so this avoids that as well. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Send reset only to first generation routersMika Westerberg2020-09-033-12/+13
| | | | | | | | | | | | | | First generation routers may need the reset command upon resume but it is not supported by newer generations. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: No need to log an error if tb_switch_lane_bonding_enable() failsMika Westerberg2020-09-031-4/+2
| | | | | | | | | | | | | | The function already logs an error if it fails so get rid of the duplication. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Do not program NFC buffers for USB4 router protocol adaptersMika Westerberg2020-09-031-0/+7
| | | | | | | | | | | | | | | | USB4 spec says that NFC buffers field is not used for protocol adapters, only for lane adapters so make tb_port_add_nfc_credits() skip non-lane adapters in order to follow the spec. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Use bit 31 to check if Firmware CM is running in Tiger LakeMika Westerberg2020-09-031-1/+4
| | | | | | | | | | | | | | | | In Tiger Lake the Firmware CM is always enabled (so bit 0 is always set) but it may be in "pass through" mode which means it requires Software CM instead. This can be determined by checking bit 31 instead. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Software CM only should set force power in Tiger LakeMika Westerberg2020-09-031-9/+16
| | | | | | | | | | | | | | | | When Software CM is running it should not send any NHI mailbox command during PM flows. Only force power bit needs to be set and cleared so change Tiger Lake (well and Ice Lake) nhi_ops to take this into account. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Optimize NHI LC mailbox command processingRajmohan Mani2020-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the Ice Lake and Tiger Lake NHI (host controller) LC (link controller) mailbox command processing checks for the completion of command every 100 msecs. These controllers are found to complete this in the order of 1 ms or so. Since this delay is in suspend path, surplus delay is effectively affecting runtime PM suspend flows. Optimize this so that we do the wait for 1 ms after reading the mailbox register. This should make Ice Lake and Tiger Lake runtime suspend take less time to complete. Reported-by: Dana Alkattan <dana.alkattan@intel.com> Signed-off-by: Rajmohan Mani <rajmohan.mani@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Optimize Force Power logicRajmohan Mani2020-09-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the "Force Power" logic uses 10 retries, each with a delay of 250 ms. Thunderbolt controllers in Ice Lake and Tiger Lake platforms are found to complete this in the order of 3 ms or so. Since this delay is in resume path, surplus delay is effectively affecting runtime PM resume flows. Decrease the granularity of the delay to 3 ms and increase the number of retries so we wait maximum of ~1 s which is the recommended timeout. This should make runtime resume a bit faster. Reported-by: Dana Alkattan <dana.alkattan@intel.com> Signed-off-by: Rajmohan Mani <rajmohan.mani@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * thunderbolt: Use kobj_to_dev() instead of container_of()Tian Tao2020-09-012-2/+2
| | | | | | | | | | | | | | | | Doesn't really matter for an individual driver, but it may get coppied to lots more. I consider it's a little tidy up. Signed-off-by: Tian Tao <tiantao6@hisilicon.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
* | USB: cdc-acm: clean up no-union-descriptor handlingJohan Hovold2020-09-252-28/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For interfaces that lack a union descriptor, probe for a "combined-interface" before falling back to the call-management descriptor instead of the other way round. This allows for the removal of the NO_DATA_INTERFACE quirk and makes the probe algorithm somewhat easier to follow. Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20200921135951.24045-5-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | USB: cdc-acm: use common data-class defineJohan Hovold2020-09-252-6/+2
| | | | | | | | | | | | | | | | | | | | Use the data-class define provided by USB core and drop the driver-specific one. Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20200921135951.24045-4-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | USB: cdc-acm: handle broken union descriptorsJohan Hovold2020-09-251-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handle broken union functional descriptors where the master-interface doesn't exist or where its class is of neither Communication or Data type (as required by the specification) by falling back to "combined-interface" probing. Note that this still allows for handling union descriptors with switched interfaces. This specifically makes the Whistler radio scanners TRX series devices work with the driver without adding further quirks to the device-id table. Reported-by: Daniel Caujolle-Bert <f1rmb.daniel@gmail.com> Tested-by: Daniel Caujolle-Bert <f1rmb.daniel@gmail.com> Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20200921135951.24045-3-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | Revert "cdc-acm: hardening against malicious devices"Johan Hovold2020-09-251-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2ad9d544f2497a7bf239c34bd2b86fd19683dbb5. Drop bogus sanity check; an interface in the active configuration will always have a current altsetting assigned by USB core. Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20200921135951.24045-2-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | Bluetooth: ath3k: use usb_control_msg_send() and usb_control_msg_recv()Greg Kroah-Hartman2020-09-251-64/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The usb_control_msg_send() and usb_control_msg_recv() calls can return an error if a "short" write/read happens, and they can handle data off of the stack, so move the driver over to using those calls instead, saving some logic when dynamically allocating memory. v2: changed API of use usb_control_msg_send() and usb_control_msg_recv() Cc: Marcel Holtmann <marcel@holtmann.org> Cc: Johan Hedberg <johan.hedberg@gmail.com> Link: https://lore.kernel.org/r/20200914153756.3412156-11-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20200923134348.23862-15-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | sound: hiface: move to use usb_control_msg_send()Greg Kroah-Hartman2020-09-251-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The usb_control_msg_send() call can return an error if a "short" write happens, so move the driver over to using that call instead. v2: API change of use usb_control_msg_send() Cc: Jaroslav Kysela <perex@perex.cz> Reviewed-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20200914153756.3412156-10-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20200923134348.23862-14-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | sound: line6: move to use usb_control_msg_send() and usb_control_msg_recv()Greg Kroah-Hartman2020-09-253-60/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The usb_control_msg_send() and usb_control_msg_recv() calls can return an error if a "short" write/read happens, and they can handle data off of the stack, so move the driver over to using those calls instead, saving some logic when dynamically allocating memory. v2: API change of use usb_control_msg_send() and usb_control_msg_recv() Cc: Jaroslav Kysela <perex@perex.cz> Cc: Vasily Khoruzhick <anarsoul@gmail.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20200914153756.3412156-9-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20200923134348.23862-13-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | USB: legousbtower: use usb_control_msg_recv()Greg Kroah-Hartman2020-09-251-41/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The usb_control_msg_recv() function can handle data on the stack, as well as properly detecting short reads, so move to use that function instead of the older usb_control_msg() call. This ends up removing a lot of extra lines in the driver. v2: change API of usb_control_msg_send() Cc: Juergen Stuber <starblue@users.sourceforge.net> Link: https://lore.kernel.org/r/20200914153756.3412156-6-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20200923134348.23862-12-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | sound: 6fire: move to use usb_control_msg_send() and usb_control_msg_recv()Greg Kroah-Hartman2020-09-251-25/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The usb_control_msg_send() and usb_control_msg_recv() calls can return an error if a "short" write/read happens, so move the driver over to using those calls instead, saving some logic in the wrapper functions that were being used in this driver. This also resolves a long-staging bug where data on the stack was being sent in a USB control message, which was not allowed. v2: API change of usb_control_msg_send() Cc: Jaroslav Kysela <perex@perex.cz> Reviewed-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20200914153756.3412156-8-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20200923134348.23862-11-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | sound: usx2y: move to use usb_control_msg_send()Greg Kroah-Hartman2020-09-251-34/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The usb_control_msg_send() call can handle data on the stack, as well as returning an error if a "short" write happens, so move the driver over to using that call instead. This ends up removing a helper function that is no longer needed. v2: API change in usb_control_msg_send() Cc: Jaroslav Kysela <perex@perex.cz> Reviewed-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20200914153756.3412156-7-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20200923134348.23862-10-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | USB: correct API of usb_control_msg_send/recvOliver Neukum2020-09-252-11/+20
| | | | | | | | | | | | | | | | | | They need to specify how memory is to be allocated, as control messages need to work in contexts that require GFP_NOIO. Signed-off-by: Oliver Neukum <oneukum@suse.com> Link: https://lore.kernel.org/r/20200923134348.23862-9-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>