• Niklas Neronin's avatar
    xhci: rework how real & fake ports are found · c9a63ec5
    Niklas Neronin authored
    xHC hardware needs to know which roothub port a USB device is attached to
    when controlling the device, so the xHCI driver stores in each device the
    roothub port which it's connected behind. This is done with two different
    port index values, the 'real_port' which is an index to the xHC hardware
    port register array, and the 'fake_port' which is the per hub port index
    used by the hub driver.
    
    Instead of finding real & fake port separately, find the root hub port
    'xhci_port' structure which contains both real & fake port values:
        - 'real_port' is ('hw_portnum' + 1)
        - 'fake_port' is ('hcd_portnum' + 1)
    i.e. real & fake port are 'hw_portnum' & 'hcd_portnum' in one-based
    format.
    
    The 'xhci_port' structure is a better way to refer to roothub ports than
    the 'real_port' & 'fake_port'. As a result, these port indexes are slated
    to be replaced with a direct pointer to the root hub port. This patch
    setups the ground work for the future changes.
    Signed-off-by: default avatarNiklas Neronin <niklas.neronin@intel.com>
    Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20240229141438.619372-2-mathias.nyman@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    c9a63ec5
xhci-mem.c 73.3 KB