Commit 76a35293 authored by Felipe Balbi's avatar Felipe Balbi Committed by Greg Kroah-Hartman

usb: host: xhci: simplify irq handler return

Instead of having several return points, let's use a local variable and
a single place to return. This makes the code slightly easier to read.

[set ret = IRQ_HANDLED in default working case  -Mathias]
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0b7c105a
...@@ -2605,27 +2605,28 @@ static int xhci_handle_event(struct xhci_hcd *xhci) ...@@ -2605,27 +2605,28 @@ static int xhci_handle_event(struct xhci_hcd *xhci)
irqreturn_t xhci_irq(struct usb_hcd *hcd) irqreturn_t xhci_irq(struct usb_hcd *hcd)
{ {
struct xhci_hcd *xhci = hcd_to_xhci(hcd); struct xhci_hcd *xhci = hcd_to_xhci(hcd);
u32 status;
u64 temp_64;
union xhci_trb *event_ring_deq; union xhci_trb *event_ring_deq;
irqreturn_t ret = IRQ_NONE;
dma_addr_t deq; dma_addr_t deq;
u64 temp_64;
u32 status;
spin_lock(&xhci->lock); spin_lock(&xhci->lock);
/* Check if the xHC generated the interrupt, or the irq is shared */ /* Check if the xHC generated the interrupt, or the irq is shared */
status = readl(&xhci->op_regs->status); status = readl(&xhci->op_regs->status);
if (status == 0xffffffff) if (status == 0xffffffff) {
goto hw_died; ret = IRQ_HANDLED;
goto out;
if (!(status & STS_EINT)) {
spin_unlock(&xhci->lock);
return IRQ_NONE;
} }
if (!(status & STS_EINT))
goto out;
if (status & STS_FATAL) { if (status & STS_FATAL) {
xhci_warn(xhci, "WARNING: Host System Error\n"); xhci_warn(xhci, "WARNING: Host System Error\n");
xhci_halt(xhci); xhci_halt(xhci);
hw_died: ret = IRQ_HANDLED;
spin_unlock(&xhci->lock); goto out;
return IRQ_HANDLED;
} }
/* /*
...@@ -2656,9 +2657,8 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) ...@@ -2656,9 +2657,8 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
temp_64 = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); temp_64 = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue);
xhci_write_64(xhci, temp_64 | ERST_EHB, xhci_write_64(xhci, temp_64 | ERST_EHB,
&xhci->ir_set->erst_dequeue); &xhci->ir_set->erst_dequeue);
spin_unlock(&xhci->lock); ret = IRQ_HANDLED;
goto out;
return IRQ_HANDLED;
} }
event_ring_deq = xhci->event_ring->dequeue; event_ring_deq = xhci->event_ring->dequeue;
...@@ -2683,10 +2683,12 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) ...@@ -2683,10 +2683,12 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
/* Clear the event handler busy flag (RW1C); event ring is empty. */ /* Clear the event handler busy flag (RW1C); event ring is empty. */
temp_64 |= ERST_EHB; temp_64 |= ERST_EHB;
xhci_write_64(xhci, temp_64, &xhci->ir_set->erst_dequeue); xhci_write_64(xhci, temp_64, &xhci->ir_set->erst_dequeue);
ret = IRQ_HANDLED;
out:
spin_unlock(&xhci->lock); spin_unlock(&xhci->lock);
return IRQ_HANDLED; return ret;
} }
irqreturn_t xhci_msi_irq(int irq, void *hcd) irqreturn_t xhci_msi_irq(int irq, void *hcd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment