diff mbox

[08/20] usb: host: xhci: convert add_timer() to mod_timer() calls

Message ID 20180416122930.15697-8-felipe.balbi@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Felipe Balbi April 16, 2018, 12:29 p.m. UTC
Instead of initializing t->expires and calling add_timer(t) right
after, we can rely on mod_timer(t, expires) to handle the details for
us.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
 drivers/usb/host/xhci.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 663eac3c8a1b..64eb50115fac 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -446,10 +446,8 @@  static void compliance_mode_recovery_timer_init(struct xhci_hcd *xhci)
 	xhci->port_status_u0 = 0;
 	timer_setup(&xhci->comp_mode_recovery_timer, compliance_mode_recovery,
 		    0);
-	xhci->comp_mode_recovery_timer.expires = jiffies +
-			msecs_to_jiffies(COMP_MODE_RCVRY_MSECS);
-
-	add_timer(&xhci->comp_mode_recovery_timer);
+	mod_timer(&xhci->comp_mode_recovery_timer, jiffies +
+			msecs_to_jiffies(COMP_MODE_RCVRY_MSECS));
 	xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
 			"Compliance mode recovery timer initialized");
 }
@@ -1505,8 +1503,8 @@  static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
 			goto done;
 		}
 		ep->ep_state |= EP_STOP_CMD_PENDING;
-		ep->stop_cmd_timer.expires = jiffies + XHCI_STOP_EP_CMD_TIMEOUT;
-		add_timer(&ep->stop_cmd_timer);
+		mod_timer(&ep->stop_cmd_timer, jiffies +
+				XHCI_STOP_EP_CMD_TIMEOUT);
 		xhci_queue_stop_endpoint(xhci, command, urb->dev->slot_id,
 					 ep_index, 0);
 		xhci_ring_cmd_db(xhci);