Commit 6d3bc5e9 authored by Mathias Nyman's avatar Mathias Nyman Committed by Greg Kroah-Hartman

xhci: remove xhci_check_usb2_port_capability helper

This helper was only called from one function.
Removing it both reduces lines of code and made it more readable.
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20240429140245.3955523-3-mathias.nyman@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 63a1f845
...@@ -4507,26 +4507,13 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, ...@@ -4507,26 +4507,13 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
return 0; return 0;
} }
/* check if a usb2 port supports a given extened capability protocol
* only USB2 ports extended protocol capability values are cached.
* Return 1 if capability is supported
*/
static bool xhci_check_usb2_port_capability(struct xhci_hcd *xhci, int portnum,
unsigned capability)
{
struct xhci_port *port;
port = xhci->usb2_rhub.ports[portnum];
return !!(port->port_cap->protocol_caps & capability);
}
static int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) static int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev)
{ {
struct xhci_hcd *xhci = hcd_to_xhci(hcd); struct xhci_hcd *xhci = hcd_to_xhci(hcd);
int portnum = udev->portnum - 1; struct xhci_port *port;
u32 capability;
if (hcd->speed >= HCD_USB3 || !udev->lpm_capable) if (hcd->speed >= HCD_USB3 || !udev->lpm_capable || !xhci->hw_lpm_support)
return 0; return 0;
/* we only support lpm for non-hub device connected to root hub yet */ /* we only support lpm for non-hub device connected to root hub yet */
...@@ -4534,14 +4521,14 @@ static int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) ...@@ -4534,14 +4521,14 @@ static int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev)
udev->descriptor.bDeviceClass == USB_CLASS_HUB) udev->descriptor.bDeviceClass == USB_CLASS_HUB)
return 0; return 0;
if (xhci->hw_lpm_support == 1 && port = xhci->usb2_rhub.ports[udev->portnum - 1];
xhci_check_usb2_port_capability( capability = port->port_cap->protocol_caps;
xhci, portnum, XHCI_HLC)) {
if (capability & XHCI_HLC) {
udev->usb2_hw_lpm_capable = 1; udev->usb2_hw_lpm_capable = 1;
udev->l1_params.timeout = XHCI_L1_TIMEOUT; udev->l1_params.timeout = XHCI_L1_TIMEOUT;
udev->l1_params.besl = XHCI_DEFAULT_BESL; udev->l1_params.besl = XHCI_DEFAULT_BESL;
if (xhci_check_usb2_port_capability(xhci, portnum, if (capability & XHCI_BLC)
XHCI_BLC))
udev->usb2_hw_lpm_besl_capable = 1; udev->usb2_hw_lpm_besl_capable = 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment