| From c64d1747ddeecbec978a19f2d1b520ca8483a127 Mon Sep 17 00:00:00 2001 |
| From: Mathias Nyman <mathias.nyman@linux.intel.com> |
| Date: Fri, 8 Dec 2017 17:59:08 +0200 |
| Subject: [PATCH 0525/1795] xhci: remove unnecessary boolean parameter from |
| xhci_alloc_command |
| |
| commands with input contexts are allocated with the |
| xhci_alloc_command_with_ctx helper. |
| |
| No functional changes |
| |
| Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| (cherry picked from commit 103afda0e6ac58927bc85dc5a7ebc0f51892f407) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> |
| --- |
| drivers/usb/host/xhci-hub.c | 5 ++--- |
| drivers/usb/host/xhci-mem.c | 17 ++--------------- |
| drivers/usb/host/xhci-ring.c | 6 +++--- |
| drivers/usb/host/xhci.c | 16 ++++++++-------- |
| drivers/usb/host/xhci.h | 3 +-- |
| 5 files changed, 16 insertions(+), 31 deletions(-) |
| |
| diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
| index 0fb3fec94e04..a6ac7c5200fe 100644 |
| --- a/drivers/usb/host/xhci-hub.c |
| +++ b/drivers/usb/host/xhci-hub.c |
| @@ -388,7 +388,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) |
| |
| trace_xhci_stop_device(virt_dev); |
| |
| - cmd = xhci_alloc_command(xhci, false, true, GFP_NOIO); |
| + cmd = xhci_alloc_command(xhci, true, GFP_NOIO); |
| if (!cmd) |
| return -ENOMEM; |
| |
| @@ -404,8 +404,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) |
| if (GET_EP_CTX_STATE(ep_ctx) != EP_STATE_RUNNING) |
| continue; |
| |
| - command = xhci_alloc_command(xhci, false, false, |
| - GFP_NOWAIT); |
| + command = xhci_alloc_command(xhci, false, GFP_NOWAIT); |
| if (!command) { |
| spin_unlock_irqrestore(&xhci->lock, flags); |
| ret = -ENOMEM; |
| diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c |
| index 2d91faf3f128..bb104b8d217e 100644 |
| --- a/drivers/usb/host/xhci-mem.c |
| +++ b/drivers/usb/host/xhci-mem.c |
| @@ -1717,8 +1717,7 @@ static void scratchpad_free(struct xhci_hcd *xhci) |
| } |
| |
| struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, |
| - bool allocate_in_ctx, bool allocate_completion, |
| - gfp_t mem_flags) |
| + bool allocate_completion, gfp_t mem_flags) |
| { |
| struct xhci_command *command; |
| |
| @@ -1726,21 +1725,10 @@ struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, |
| if (!command) |
| return NULL; |
| |
| - if (allocate_in_ctx) { |
| - command->in_ctx = |
| - xhci_alloc_container_ctx(xhci, XHCI_CTX_TYPE_INPUT, |
| - mem_flags); |
| - if (!command->in_ctx) { |
| - kfree(command); |
| - return NULL; |
| - } |
| - } |
| - |
| if (allocate_completion) { |
| command->completion = |
| kzalloc(sizeof(struct completion), mem_flags); |
| if (!command->completion) { |
| - xhci_free_container_ctx(xhci, command->in_ctx); |
| kfree(command); |
| return NULL; |
| } |
| @@ -1757,8 +1745,7 @@ struct xhci_command *xhci_alloc_command_with_ctx(struct xhci_hcd *xhci, |
| { |
| struct xhci_command *command; |
| |
| - command = xhci_alloc_command(xhci, false, allocate_completion, |
| - mem_flags); |
| + command = xhci_alloc_command(xhci, allocate_completion, mem_flags); |
| if (!command) |
| return NULL; |
| |
| diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
| index 2ae63f0bcc14..af079f492a9e 100644 |
| --- a/drivers/usb/host/xhci-ring.c |
| +++ b/drivers/usb/host/xhci-ring.c |
| @@ -1141,7 +1141,7 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, |
| if (xhci->quirks & XHCI_RESET_EP_QUIRK) { |
| struct xhci_command *command; |
| |
| - command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); |
| + command = xhci_alloc_command(xhci, false, GFP_ATOMIC); |
| if (!command) |
| return; |
| |
| @@ -1821,7 +1821,7 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci, |
| { |
| struct xhci_virt_ep *ep = &xhci->devs[slot_id]->eps[ep_index]; |
| struct xhci_command *command; |
| - command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); |
| + command = xhci_alloc_command(xhci, false, GFP_ATOMIC); |
| if (!command) |
| return; |
| |
| @@ -4040,7 +4040,7 @@ void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, |
| } |
| |
| /* This function gets called from contexts where it cannot sleep */ |
| - cmd = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); |
| + cmd = xhci_alloc_command(xhci, false, GFP_ATOMIC); |
| if (!cmd) |
| return; |
| |
| diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
| index 47f77085d5ce..7dafd44cf1c2 100644 |
| --- a/drivers/usb/host/xhci.c |
| +++ b/drivers/usb/host/xhci.c |
| @@ -610,7 +610,7 @@ int xhci_run(struct usb_hcd *hcd) |
| if (xhci->quirks & XHCI_NEC_HOST) { |
| struct xhci_command *command; |
| |
| - command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); |
| + command = xhci_alloc_command(xhci, false, GFP_KERNEL); |
| if (!command) |
| return -ENOMEM; |
| |
| @@ -1285,7 +1285,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, |
| * changes max packet sizes. |
| */ |
| |
| - command = xhci_alloc_command(xhci, false, true, GFP_KERNEL); |
| + command = xhci_alloc_command(xhci, true, GFP_KERNEL); |
| if (!command) |
| return -ENOMEM; |
| |
| @@ -1540,7 +1540,7 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) |
| * the first cancellation to be handled. |
| */ |
| if (!(ep->ep_state & EP_STOP_CMD_PENDING)) { |
| - command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); |
| + command = xhci_alloc_command(xhci, false, GFP_ATOMIC); |
| if (!command) { |
| ret = -ENOMEM; |
| goto done; |
| @@ -2725,7 +2725,7 @@ static int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) |
| xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev); |
| virt_dev = xhci->devs[udev->slot_id]; |
| |
| - command = xhci_alloc_command(xhci, false, true, GFP_KERNEL); |
| + command = xhci_alloc_command(xhci, true, GFP_KERNEL); |
| if (!command) |
| return -ENOMEM; |
| |
| @@ -3455,7 +3455,7 @@ static int xhci_discover_or_reset_device(struct usb_hcd *hcd, |
| * reset as part of error handling, so use GFP_NOIO instead of |
| * GFP_KERNEL. |
| */ |
| - reset_device_cmd = xhci_alloc_command(xhci, false, true, GFP_NOIO); |
| + reset_device_cmd = xhci_alloc_command(xhci, true, GFP_NOIO); |
| if (!reset_device_cmd) { |
| xhci_dbg(xhci, "Couldn't allocate command structure.\n"); |
| return -ENOMEM; |
| @@ -3604,7 +3604,7 @@ int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) |
| u32 state; |
| int ret = 0; |
| |
| - command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); |
| + command = xhci_alloc_command(xhci, false, GFP_KERNEL); |
| if (!command) |
| return -ENOMEM; |
| |
| @@ -3666,7 +3666,7 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) |
| int ret, slot_id; |
| struct xhci_command *command; |
| |
| - command = xhci_alloc_command(xhci, false, true, GFP_KERNEL); |
| + command = xhci_alloc_command(xhci, true, GFP_KERNEL); |
| if (!command) |
| return 0; |
| |
| @@ -3799,7 +3799,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, |
| } |
| } |
| |
| - command = xhci_alloc_command(xhci, false, true, GFP_KERNEL); |
| + command = xhci_alloc_command(xhci, true, GFP_KERNEL); |
| if (!command) { |
| ret = -ENOMEM; |
| goto out; |
| diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
| index e3f8ca79867c..98c68f76ef44 100644 |
| --- a/drivers/usb/host/xhci.h |
| +++ b/drivers/usb/host/xhci.h |
| @@ -1998,8 +1998,7 @@ struct xhci_ring *xhci_stream_id_to_ring( |
| unsigned int ep_index, |
| unsigned int stream_id); |
| struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, |
| - bool allocate_in_ctx, bool allocate_completion, |
| - gfp_t mem_flags); |
| + bool allocate_completion, gfp_t mem_flags); |
| struct xhci_command *xhci_alloc_command_with_ctx(struct xhci_hcd *xhci, |
| bool allocate_completion, gfp_t mem_flags); |
| void xhci_urb_free_priv(struct urb_priv *urb_priv); |
| -- |
| 2.19.0 |
| |