• A
    USB: hub: Clean up use of port initialization schemes and retries · 19502e69
    Alan Stern 提交于
    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: NAlan Stern <stern@rowland.harvard.edu>
    Link: https://lore.kernel.org/r/20200928152050.GA134701@rowland.harvard.eduSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    19502e69
hub.c 174.2 KB