]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blobdiff - drivers/usb/host/xhci-ring.c
xhci: prevent runtime suspend when process command
[hercules2020/nv-tegra/linux-4.4.git] / drivers / usb / host / xhci-ring.c
index 1d2811d676956a1dff8daccaee91b51125b1eded..4cf76bc3a26477b89304ceaf9c696fe7361a8273 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * xHCI host controller driver
  *
- * Copyright (c) 2015-2016, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2015-2017, NVIDIA CORPORATION.  All rights reserved.
  * Copyright (C) 2008 Intel Corp.
  *
  * Author: Sarah Sharp
@@ -1339,6 +1339,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
        }
 
        del_timer(&xhci->cmd_timer);
+       pm_runtime_put(xhci->main_hcd->self.controller);
 
        trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event);
 
@@ -1419,6 +1420,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
        if (cmd->cmd_list.next != &xhci->cmd_list) {
                xhci->current_cmd = list_entry(cmd->cmd_list.next,
                                               struct xhci_command, cmd_list);
+               pm_runtime_get(xhci->main_hcd->self.controller);
                mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT);
        }
 
@@ -4109,6 +4111,7 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd,
        if (xhci->cmd_list.next == &cmd->cmd_list &&
            !timer_pending(&xhci->cmd_timer)) {
                xhci->current_cmd = cmd;
+               pm_runtime_get(xhci->main_hcd->self.controller);
                mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT);
        }