[RFC PATCH 10/20] xhci: clarify "ring valid" checks

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

 



All rings have ->dequeue = ->enqueue = "first trb in first segment", so
it is redundant to check if ->dequeue is NULL when ->ring is set.

Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
---
 drivers/usb/host/xhci-hub.c  |    5 ++---
 drivers/usb/host/xhci-ring.c |    2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index aa79e8749040..b01778002be2 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -285,7 +285,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
 
 	spin_lock_irqsave(&xhci->lock, flags);
 	for (i = LAST_EP_INDEX; i > 0; i--) {
-		if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) {
+		if (virt_dev->eps[i].ring) {
 			struct xhci_command *command;
 			command = xhci_alloc_command(xhci, false, false,
 						     GFP_NOWAIT);
@@ -322,8 +322,7 @@ void xhci_ring_device(struct xhci_hcd *xhci, int slot_id)
 	int i;
 
 	for (i = 0; i < LAST_EP_INDEX + 1; i++)
-		if (xhci->devs[slot_id]->eps[i].ring &&
-		    xhci->devs[slot_id]->eps[i].ring->dequeue)
+		if (xhci->devs[slot_id]->eps[i].ring)
 			xhci_ring_ep_doorbell(xhci, slot_id, i, 0);
 
 	return;
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 8a46c99c6ba5..61c48ed4db9b 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2767,7 +2767,7 @@ static int xhci_handle_event(struct xhci_hcd *xhci)
 	int update_ptrs = 1;
 	int ret;
 
-	if (!xhci->event_ring || !xhci->event_ring->dequeue) {
+	if (!xhci->event_ring) {
 		xhci->error_bitmask |= 1 << 1;
 		return 0;
 	}

--
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