From patchwork Mon Apr 16 12:29:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 10342877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 958E2601D7 for ; Mon, 16 Apr 2018 12:30:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87AE0286BD for ; Mon, 16 Apr 2018 12:30:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85E78286D5; Mon, 16 Apr 2018 12:30:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B006428718 for ; Mon, 16 Apr 2018 12:30:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754621AbeDPMaq (ORCPT ); Mon, 16 Apr 2018 08:30:46 -0400 Received: from mga03.intel.com ([134.134.136.65]:30669 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754273AbeDPMao (ORCPT ); Mon, 16 Apr 2018 08:30:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Apr 2018 05:30:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,459,1517904000"; d="scan'208";a="32973510" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.68.37]) by fmsmga008.fm.intel.com with ESMTP; 16 Apr 2018 05:30:42 -0700 From: Felipe Balbi To: Mathias Nyman Cc: Linux USB , Felipe Balbi Subject: [PATCH 08/20] usb: host: xhci: convert add_timer() to mod_timer() calls Date: Mon, 16 Apr 2018 15:29:18 +0300 Message-Id: <20180416122930.15697-8-felipe.balbi@linux.intel.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180416122930.15697-1-felipe.balbi@linux.intel.com> References: <20180416122930.15697-1-felipe.balbi@linux.intel.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/usb/host/xhci.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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);