From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753173AbdJEAyR (ORCPT ); Wed, 4 Oct 2017 20:54:17 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:48455 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753154AbdJEAyN (ORCPT ); Wed, 4 Oct 2017 20:54:13 -0400 X-Google-Smtp-Source: AOwi7QC02k+BK3DeYNjGzWZKZyRwvHSAbPJDKt2sXAb5dhhmp3o4banB13g9b9abzfBV1z5+ssRx8Q== Date: Wed, 4 Oct 2017 17:54:11 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Thomas Gleixner Subject: [PATCH] xhci: Convert timers to use timer_setup() Message-ID: <20171005005411.GA23908@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Mathias Nyman Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Cc: Thomas Gleixner Signed-off-by: Kees Cook --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- drivers/usb/host/xhci-mem.c | 4 ++-- drivers/usb/host/xhci-ring.c | 9 +++------ drivers/usb/host/xhci.h | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 2a82c927ded2..f71d46d0aaeb 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -801,8 +801,8 @@ void xhci_free_stream_info(struct xhci_hcd *xhci, static void xhci_init_endpoint_timer(struct xhci_hcd *xhci, struct xhci_virt_ep *ep) { - setup_timer(&ep->stop_cmd_timer, xhci_stop_endpoint_command_watchdog, - (unsigned long)ep); + timer_setup(&ep->stop_cmd_timer, xhci_stop_endpoint_command_watchdog, + 0); ep->xhci = xhci; } diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index a9443651ce0f..e28d1b064c6b 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -946,15 +946,12 @@ void xhci_hc_died(struct xhci_hcd *xhci) * Instead we use a combination of that flag and checking if a new timer is * pending. */ -void xhci_stop_endpoint_command_watchdog(unsigned long arg) +void xhci_stop_endpoint_command_watchdog(struct timer_list *t) { - struct xhci_hcd *xhci; - struct xhci_virt_ep *ep; + struct xhci_virt_ep *ep = from_timer(ep, t, stop_cmd_timer); + struct xhci_hcd *xhci = ep->xhci; unsigned long flags; - ep = (struct xhci_virt_ep *) arg; - xhci = ep->xhci; - spin_lock_irqsave(&xhci->lock, flags); /* bail out if cmd completed but raced with stop ep watchdog timer.*/ diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 2abaa4d6d39d..43291a0d44cd 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -2066,7 +2066,7 @@ void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, struct xhci_dequeue_state *deq_state); void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int ep_index, unsigned int stream_id, struct xhci_td *td); -void xhci_stop_endpoint_command_watchdog(unsigned long arg); +void xhci_stop_endpoint_command_watchdog(struct timer_list *t); void xhci_handle_command_timeout(struct work_struct *work); void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id, -- 2.7.4 -- Kees Cook Pixel Security