Re: [RFC v4 06/19] xhci: use completion event's slot id rather than dig it out of command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/04/2013 08:39 AM, Xenia Ragiadakou wrote:
Since the slot id retrieved from the command TRB matches the one in Slot ID
field of 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.

Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
---

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

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

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index f00d9ef..f68a1f0 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1444,6 +1444,9 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
  		}
  	}
+ WARN_ON(slot_id != TRB_TO_SLOT_ID(
+		le32_to_cpu(xhci->cmd_ring->dequeue->generic.field[3])));
+
  	switch (le32_to_cpu(xhci->cmd_ring->dequeue->generic.field[3])
  		& TRB_TYPE_BITMASK) {
  	case TRB_TYPE(TRB_ENABLE_SLOT):
@@ -1528,8 +1531,6 @@ bandwidth_change:
  		break;
  	case TRB_TYPE(TRB_RESET_DEV):
  		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);

In this patch i did the stupid thing to place the WARN_ON() in the wrong place, since the Slot ID field of the Command TRB and the Slot ID field of the Command Completion Event TRB may differ for other commands. So, I will fix this and I will resend the patchset.

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux