• Alan Stern's avatar
    [PATCH] USB: UHCI: Improved handling of short control transfers · 2212df84
    Alan Stern authored
    This patch simplies the way the UHCI driver handles short control
    transfers.  When a transfer is short the HC will stop handling that
    endpoint, and it's necessary to get it going again so that the status
    stage of the control transfer can take place.  Currently the driver does
    this by allocating a new QH for the transfer and setting its element
    pointer to point at the final status TD.  The old QH is recycled.  But
    it's not necessary to go to all that trouble; the element pointer in the
    original QH can be updated directly.
    
    Normally the element pointer is supposed to be owned by the HC, and it's
    not safe to just change its value since the HC may overwrite it at any
    time.  But when a transfer is stopped because of a short packet, the
    current TD is marked inactive and the HC will not update the element
    pointer.  To write an unchanged pointer value back to memory would be a
    waste of PCI bus cycles.  Now the UHCI spec doesn't say explicitly that an
    HC _can't_ do this, but I've tested both Intel and VIA hardware and
    neither of them does.
    
    As a side effect of this change, some of the code for removing QHs can be
    eliminated.
    2212df84
uhci-hcd.c 63.4 KB