| From 657d0af147d88ecdf0ed98d7758fd5e00457053f Mon Sep 17 00:00:00 2001 |
| From: Kees Cook <keescook@chromium.org> |
| Date: Mon, 16 Oct 2017 16:16:58 -0700 |
| Subject: [PATCH 0256/1795] xhci: Convert timers to use timer_setup() |
| |
| 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 <mathias.nyman@intel.com> |
| Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| Cc: linux-usb@vger.kernel.org |
| Signed-off-by: Kees Cook <keescook@chromium.org> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| (cherry picked from commit 66a4550308b8391fecd46c7e733cbccb3e01ee96) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> |
| --- |
| 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 477868b5b307..d10129e664fd 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 d5f44776b360..54231beef4f5 100644 |
| --- a/drivers/usb/host/xhci-ring.c |
| +++ b/drivers/usb/host/xhci-ring.c |
| @@ -948,15 +948,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 3ece11154a31..fd13ae14c28b 100644 |
| --- a/drivers/usb/host/xhci.h |
| +++ b/drivers/usb/host/xhci.h |
| @@ -2083,7 +2083,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.19.0 |
| |