Commit 103afda0 authored by Mathias Nyman's avatar Mathias Nyman Committed by Greg Kroah-Hartman

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: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 14d49b7a
...@@ -388,7 +388,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) ...@@ -388,7 +388,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
trace_xhci_stop_device(virt_dev); 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) if (!cmd)
return -ENOMEM; return -ENOMEM;
...@@ -404,8 +404,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) ...@@ -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) if (GET_EP_CTX_STATE(ep_ctx) != EP_STATE_RUNNING)
continue; continue;
command = xhci_alloc_command(xhci, false, false, command = xhci_alloc_command(xhci, false, GFP_NOWAIT);
GFP_NOWAIT);
if (!command) { if (!command) {
spin_unlock_irqrestore(&xhci->lock, flags); spin_unlock_irqrestore(&xhci->lock, flags);
ret = -ENOMEM; ret = -ENOMEM;
......
...@@ -1701,8 +1701,7 @@ static void scratchpad_free(struct xhci_hcd *xhci) ...@@ -1701,8 +1701,7 @@ static void scratchpad_free(struct xhci_hcd *xhci)
} }
struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci,
bool allocate_in_ctx, bool allocate_completion, bool allocate_completion, gfp_t mem_flags)
gfp_t mem_flags)
{ {
struct xhci_command *command; struct xhci_command *command;
...@@ -1710,21 +1709,10 @@ struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, ...@@ -1710,21 +1709,10 @@ struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci,
if (!command) if (!command)
return NULL; 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) { if (allocate_completion) {
command->completion = command->completion =
kzalloc(sizeof(struct completion), mem_flags); kzalloc(sizeof(struct completion), mem_flags);
if (!command->completion) { if (!command->completion) {
xhci_free_container_ctx(xhci, command->in_ctx);
kfree(command); kfree(command);
return NULL; return NULL;
} }
...@@ -1741,8 +1729,7 @@ struct xhci_command *xhci_alloc_command_with_ctx(struct xhci_hcd *xhci, ...@@ -1741,8 +1729,7 @@ struct xhci_command *xhci_alloc_command_with_ctx(struct xhci_hcd *xhci,
{ {
struct xhci_command *command; struct xhci_command *command;
command = xhci_alloc_command(xhci, false, allocate_completion, command = xhci_alloc_command(xhci, allocate_completion, mem_flags);
mem_flags);
if (!command) if (!command)
return NULL; return NULL;
......
...@@ -1141,7 +1141,7 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, ...@@ -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) { if (xhci->quirks & XHCI_RESET_EP_QUIRK) {
struct xhci_command *command; struct xhci_command *command;
command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); command = xhci_alloc_command(xhci, false, GFP_ATOMIC);
if (!command) if (!command)
return; return;
...@@ -1821,7 +1821,7 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci, ...@@ -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_virt_ep *ep = &xhci->devs[slot_id]->eps[ep_index];
struct xhci_command *command; struct xhci_command *command;
command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); command = xhci_alloc_command(xhci, false, GFP_ATOMIC);
if (!command) if (!command)
return; return;
...@@ -4036,7 +4036,7 @@ void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, ...@@ -4036,7 +4036,7 @@ void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci,
} }
/* This function gets called from contexts where it cannot sleep */ /* 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) if (!cmd)
return; return;
......
...@@ -610,7 +610,7 @@ int xhci_run(struct usb_hcd *hcd) ...@@ -610,7 +610,7 @@ int xhci_run(struct usb_hcd *hcd)
if (xhci->quirks & XHCI_NEC_HOST) { if (xhci->quirks & XHCI_NEC_HOST) {
struct xhci_command *command; struct xhci_command *command;
command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); command = xhci_alloc_command(xhci, false, GFP_KERNEL);
if (!command) if (!command)
return -ENOMEM; return -ENOMEM;
...@@ -1243,7 +1243,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, ...@@ -1243,7 +1243,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id,
* changes max packet sizes. * changes max packet sizes.
*/ */
command = xhci_alloc_command(xhci, false, true, GFP_KERNEL); command = xhci_alloc_command(xhci, true, GFP_KERNEL);
if (!command) if (!command)
return -ENOMEM; return -ENOMEM;
...@@ -1498,7 +1498,7 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) ...@@ -1498,7 +1498,7 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
* the first cancellation to be handled. * the first cancellation to be handled.
*/ */
if (!(ep->ep_state & EP_STOP_CMD_PENDING)) { 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) { if (!command) {
ret = -ENOMEM; ret = -ENOMEM;
goto done; goto done;
...@@ -2683,7 +2683,7 @@ static int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) ...@@ -2683,7 +2683,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); xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev);
virt_dev = xhci->devs[udev->slot_id]; 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) if (!command)
return -ENOMEM; return -ENOMEM;
...@@ -3413,7 +3413,7 @@ static int xhci_discover_or_reset_device(struct usb_hcd *hcd, ...@@ -3413,7 +3413,7 @@ static int xhci_discover_or_reset_device(struct usb_hcd *hcd,
* reset as part of error handling, so use GFP_NOIO instead of * reset as part of error handling, so use GFP_NOIO instead of
* GFP_KERNEL. * 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) { if (!reset_device_cmd) {
xhci_dbg(xhci, "Couldn't allocate command structure.\n"); xhci_dbg(xhci, "Couldn't allocate command structure.\n");
return -ENOMEM; return -ENOMEM;
...@@ -3561,7 +3561,7 @@ int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) ...@@ -3561,7 +3561,7 @@ int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id)
u32 state; u32 state;
int ret = 0; int ret = 0;
command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); command = xhci_alloc_command(xhci, false, GFP_KERNEL);
if (!command) if (!command)
return -ENOMEM; return -ENOMEM;
...@@ -3623,7 +3623,7 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) ...@@ -3623,7 +3623,7 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
int ret, slot_id; int ret, slot_id;
struct xhci_command *command; struct xhci_command *command;
command = xhci_alloc_command(xhci, false, true, GFP_KERNEL); command = xhci_alloc_command(xhci, true, GFP_KERNEL);
if (!command) if (!command)
return 0; return 0;
...@@ -3756,7 +3756,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, ...@@ -3756,7 +3756,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) { if (!command) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
......
...@@ -1992,8 +1992,7 @@ struct xhci_ring *xhci_stream_id_to_ring( ...@@ -1992,8 +1992,7 @@ struct xhci_ring *xhci_stream_id_to_ring(
unsigned int ep_index, unsigned int ep_index,
unsigned int stream_id); unsigned int stream_id);
struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci,
bool allocate_in_ctx, bool allocate_completion, bool allocate_completion, gfp_t mem_flags);
gfp_t mem_flags);
struct xhci_command *xhci_alloc_command_with_ctx(struct xhci_hcd *xhci, struct xhci_command *xhci_alloc_command_with_ctx(struct xhci_hcd *xhci,
bool allocate_completion, gfp_t mem_flags); bool allocate_completion, gfp_t mem_flags);
void xhci_urb_free_priv(struct urb_priv *urb_priv); void xhci_urb_free_priv(struct urb_priv *urb_priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment