diff options
| author | Kai-Heng Feng <kai.heng.feng@canonical.com> | 2018-07-02 10:13:31 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-02 11:19:27 -0400 |
| commit | 74cb319bd97dd62881f97ea5a3228f7c2546bf56 (patch) | |
| tree | 4cbcdc81c5dacb075f0547804e6652a75155f816 | |
| parent | 021c91791a5e7e85c567452f1be3e4c2c6cb6063 (diff) | |
usb: xhci: dbc: Don't decrement runtime PM counter if DBC is not started
pm_runtime_put_sync() gets called everytime in xhci_dbc_stop().
If dbc is not started, this makes the runtime PM counter incorrectly
becomes 0, and calls autosuspend function. Then we'll keep seeing this:
[54664.762220] xhci_hcd 0000:00:14.0: Root hub is not suspended
So only calls pm_runtime_put_sync() when dbc was started.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/usb/host/xhci-dbgcap.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index 1fbfd89d0a0f..387f124a8334 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c | |||
| @@ -508,16 +508,18 @@ static int xhci_do_dbc_start(struct xhci_hcd *xhci) | |||
| 508 | return 0; | 508 | return 0; |
| 509 | } | 509 | } |
| 510 | 510 | ||
| 511 | static void xhci_do_dbc_stop(struct xhci_hcd *xhci) | 511 | static int xhci_do_dbc_stop(struct xhci_hcd *xhci) |
| 512 | { | 512 | { |
| 513 | struct xhci_dbc *dbc = xhci->dbc; | 513 | struct xhci_dbc *dbc = xhci->dbc; |
| 514 | 514 | ||
| 515 | if (dbc->state == DS_DISABLED) | 515 | if (dbc->state == DS_DISABLED) |
| 516 | return; | 516 | return -1; |
| 517 | 517 | ||
| 518 | writel(0, &dbc->regs->control); | 518 | writel(0, &dbc->regs->control); |
| 519 | xhci_dbc_mem_cleanup(xhci); | 519 | xhci_dbc_mem_cleanup(xhci); |
| 520 | dbc->state = DS_DISABLED; | 520 | dbc->state = DS_DISABLED; |
| 521 | |||
| 522 | return 0; | ||
| 521 | } | 523 | } |
| 522 | 524 | ||
| 523 | static int xhci_dbc_start(struct xhci_hcd *xhci) | 525 | static int xhci_dbc_start(struct xhci_hcd *xhci) |
| @@ -544,6 +546,7 @@ static int xhci_dbc_start(struct xhci_hcd *xhci) | |||
| 544 | 546 | ||
| 545 | static void xhci_dbc_stop(struct xhci_hcd *xhci) | 547 | static void xhci_dbc_stop(struct xhci_hcd *xhci) |
| 546 | { | 548 | { |
| 549 | int ret; | ||
| 547 | unsigned long flags; | 550 | unsigned long flags; |
| 548 | struct xhci_dbc *dbc = xhci->dbc; | 551 | struct xhci_dbc *dbc = xhci->dbc; |
| 549 | struct dbc_port *port = &dbc->port; | 552 | struct dbc_port *port = &dbc->port; |
| @@ -556,10 +559,11 @@ static void xhci_dbc_stop(struct xhci_hcd *xhci) | |||
| 556 | xhci_dbc_tty_unregister_device(xhci); | 559 | xhci_dbc_tty_unregister_device(xhci); |
| 557 | 560 | ||
| 558 | spin_lock_irqsave(&dbc->lock, flags); | 561 | spin_lock_irqsave(&dbc->lock, flags); |
| 559 | xhci_do_dbc_stop(xhci); | 562 | ret = xhci_do_dbc_stop(xhci); |
| 560 | spin_unlock_irqrestore(&dbc->lock, flags); | 563 | spin_unlock_irqrestore(&dbc->lock, flags); |
| 561 | 564 | ||
| 562 | pm_runtime_put_sync(xhci_to_hcd(xhci)->self.controller); | 565 | if (!ret) |
| 566 | pm_runtime_put_sync(xhci_to_hcd(xhci)->self.controller); | ||
| 563 | } | 567 | } |
| 564 | 568 | ||
| 565 | static void | 569 | static void |
