Since the slot id retrieved from the Reset Device TRB matches the slot id in
the command completion event, which is available, there is no need to determine
it again.
This patch removes the uneccessary reassignment to slot id and adds a WARN_ON
in case the two Slot ID fields differ (although according xhci spec rev1.0
they should not differ).

Signed-off-by: Xenia Ragiadakou <burzalod...@gmail.com>
---

Differences from v3:

-the above change is performed now in a separate patch
-a warning is triggered in case the slot id reported in event trb is
 different from the slot id renoted in command trb

Differences from v4:

-the warning was placed inside the TRB_RESET_DEV case statement, since
 for other type of commands, the slot id values may differ.
 The line overflow introduced by the change will be corrected by a follow on
 patch of this patchset

 drivers/usb/host/xhci-ring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index f00d9ef..8a74002 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1527,9 +1527,9 @@ bandwidth_change:
                xhci_handle_cmd_reset_ep(xhci, event, xhci->cmd_ring->dequeue);
                break;
        case TRB_TYPE(TRB_RESET_DEV):
+               WARN_ON(slot_id != TRB_TO_SLOT_ID(
+                               
le32_to_cpu(xhci->cmd_ring->dequeue->generic.field[3])));
                xhci_dbg(xhci, "Completed reset device command.\n");
-               slot_id = TRB_TO_SLOT_ID(
-                       le32_to_cpu(xhci->cmd_ring->dequeue->generic.field[3]));
                virt_dev = xhci->devs[slot_id];
                if (virt_dev)
                        handle_cmd_in_cmd_wait_list(xhci, virt_dev, event);
-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to