mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
Revert "usb: xhci: Add timeout argument in address_device USB HCD callback"
This reverts commit 5f9b63193b which is
commit a769154c7cac037914ba375ae88aae55b2c853e0 upstream.
It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.
Bug: 161946584
Change-Id: I77f823bdc857c0eb1a1f500b469f4678597d1484
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -4739,7 +4739,7 @@ static int hub_set_address(struct usb_device *udev, int devnum)
|
|||||||
if (udev->state != USB_STATE_DEFAULT)
|
if (udev->state != USB_STATE_DEFAULT)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (hcd->driver->address_device)
|
if (hcd->driver->address_device)
|
||||||
retval = hcd->driver->address_device(hcd, udev, timeout_ms);
|
retval = hcd->driver->address_device(hcd, udev);
|
||||||
else
|
else
|
||||||
retval = usb_control_msg(udev, usb_sndaddr0pipe(),
|
retval = usb_control_msg(udev, usb_sndaddr0pipe(),
|
||||||
USB_REQ_SET_ADDRESS, 0, devnum, 0,
|
USB_REQ_SET_ADDRESS, 0, devnum, 0,
|
||||||
|
|||||||
@@ -1832,8 +1832,6 @@ struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci,
|
|||||||
}
|
}
|
||||||
|
|
||||||
command->status = 0;
|
command->status = 0;
|
||||||
/* set default timeout to 5000 ms */
|
|
||||||
command->timeout_ms = XHCI_CMD_DEFAULT_TIMEOUT;
|
|
||||||
INIT_LIST_HEAD(&command->cmd_list);
|
INIT_LIST_HEAD(&command->cmd_list);
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -334,10 +334,9 @@ void xhci_ring_cmd_db(struct xhci_hcd *xhci)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(xhci_ring_cmd_db);
|
EXPORT_SYMBOL_GPL(xhci_ring_cmd_db);
|
||||||
|
|
||||||
static bool xhci_mod_cmd_timer(struct xhci_hcd *xhci)
|
static bool xhci_mod_cmd_timer(struct xhci_hcd *xhci, unsigned long delay)
|
||||||
{
|
{
|
||||||
return mod_delayed_work(system_wq, &xhci->cmd_timer,
|
return mod_delayed_work(system_wq, &xhci->cmd_timer, delay);
|
||||||
msecs_to_jiffies(xhci->current_cmd->timeout_ms));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct xhci_command *xhci_next_queued_cmd(struct xhci_hcd *xhci)
|
static struct xhci_command *xhci_next_queued_cmd(struct xhci_hcd *xhci)
|
||||||
@@ -381,7 +380,7 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,
|
|||||||
if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) &&
|
if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) &&
|
||||||
!(xhci->xhc_state & XHCI_STATE_DYING)) {
|
!(xhci->xhc_state & XHCI_STATE_DYING)) {
|
||||||
xhci->current_cmd = cur_cmd;
|
xhci->current_cmd = cur_cmd;
|
||||||
xhci_mod_cmd_timer(xhci);
|
xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT);
|
||||||
xhci_ring_cmd_db(xhci);
|
xhci_ring_cmd_db(xhci);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1765,7 +1764,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
|
|||||||
if (!list_is_singular(&xhci->cmd_list)) {
|
if (!list_is_singular(&xhci->cmd_list)) {
|
||||||
xhci->current_cmd = list_first_entry(&cmd->cmd_list,
|
xhci->current_cmd = list_first_entry(&cmd->cmd_list,
|
||||||
struct xhci_command, cmd_list);
|
struct xhci_command, cmd_list);
|
||||||
xhci_mod_cmd_timer(xhci);
|
xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT);
|
||||||
} else if (xhci->current_cmd == cmd) {
|
} else if (xhci->current_cmd == cmd) {
|
||||||
xhci->current_cmd = NULL;
|
xhci->current_cmd = NULL;
|
||||||
}
|
}
|
||||||
@@ -4342,7 +4341,7 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd,
|
|||||||
/* if there are no other commands queued we start the timeout timer */
|
/* if there are no other commands queued we start the timeout timer */
|
||||||
if (list_empty(&xhci->cmd_list)) {
|
if (list_empty(&xhci->cmd_list)) {
|
||||||
xhci->current_cmd = cmd;
|
xhci->current_cmd = cmd;
|
||||||
xhci_mod_cmd_timer(xhci);
|
xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_add_tail(&cmd->cmd_list, &xhci->cmd_list);
|
list_add_tail(&cmd->cmd_list, &xhci->cmd_list);
|
||||||
|
|||||||
@@ -4224,18 +4224,12 @@ disable_slot:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* xhci_setup_device - issues an Address Device command to assign a unique
|
* Issue an Address Device command and optionally send a corresponding
|
||||||
* USB bus address.
|
* SetAddress request to the device.
|
||||||
* @hcd: USB host controller data structure.
|
|
||||||
* @udev: USB dev structure representing the connected device.
|
|
||||||
* @setup: Enum specifying setup mode: address only or with context.
|
|
||||||
* @timeout_ms: Max wait time (ms) for the command operation to complete.
|
|
||||||
*
|
|
||||||
* Return: 0 if successful; otherwise, negative error code.
|
|
||||||
*/
|
*/
|
||||||
static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
|
static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
|
||||||
enum xhci_setup_dev setup, unsigned int timeout_ms)
|
enum xhci_setup_dev setup)
|
||||||
{
|
{
|
||||||
const char *act = setup == SETUP_CONTEXT_ONLY ? "context" : "address";
|
const char *act = setup == SETUP_CONTEXT_ONLY ? "context" : "address";
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
@@ -4292,7 +4286,6 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
command->in_ctx = virt_dev->in_ctx;
|
command->in_ctx = virt_dev->in_ctx;
|
||||||
command->timeout_ms = timeout_ms;
|
|
||||||
|
|
||||||
slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->in_ctx);
|
slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->in_ctx);
|
||||||
ctrl_ctx = xhci_get_input_control_ctx(virt_dev->in_ctx);
|
ctrl_ctx = xhci_get_input_control_ctx(virt_dev->in_ctx);
|
||||||
@@ -4426,17 +4419,15 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev,
|
int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
|
||||||
unsigned int timeout_ms)
|
|
||||||
{
|
{
|
||||||
return xhci_setup_device(hcd, udev, SETUP_CONTEXT_ADDRESS, timeout_ms);
|
return xhci_setup_device(hcd, udev, SETUP_CONTEXT_ADDRESS);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(xhci_address_device);
|
EXPORT_SYMBOL_GPL(xhci_address_device);
|
||||||
|
|
||||||
static int xhci_enable_device(struct usb_hcd *hcd, struct usb_device *udev)
|
static int xhci_enable_device(struct usb_hcd *hcd, struct usb_device *udev)
|
||||||
{
|
{
|
||||||
return xhci_setup_device(hcd, udev, SETUP_CONTEXT_ONLY,
|
return xhci_setup_device(hcd, udev, SETUP_CONTEXT_ONLY);
|
||||||
XHCI_CMD_DEFAULT_TIMEOUT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -817,9 +817,6 @@ struct xhci_command {
|
|||||||
union xhci_trb *command_trb;
|
union xhci_trb *command_trb;
|
||||||
struct list_head cmd_list;
|
struct list_head cmd_list;
|
||||||
|
|
||||||
/* xHCI command response timeout in milliseconds */
|
|
||||||
unsigned int timeout_ms;
|
|
||||||
|
|
||||||
ANDROID_KABI_RESERVE(1);
|
ANDROID_KABI_RESERVE(1);
|
||||||
ANDROID_KABI_RESERVE(2);
|
ANDROID_KABI_RESERVE(2);
|
||||||
};
|
};
|
||||||
@@ -1583,11 +1580,8 @@ struct xhci_td {
|
|||||||
unsigned int num_trbs;
|
unsigned int num_trbs;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/* xHCI command default timeout value */
|
||||||
* xHCI command default timeout value in milliseconds.
|
#define XHCI_CMD_DEFAULT_TIMEOUT (5 * HZ)
|
||||||
* USB 3.2 spec, section 9.2.6.1
|
|
||||||
*/
|
|
||||||
#define XHCI_CMD_DEFAULT_TIMEOUT 5000
|
|
||||||
|
|
||||||
/* command descriptor */
|
/* command descriptor */
|
||||||
struct xhci_cd {
|
struct xhci_cd {
|
||||||
|
|||||||
@@ -377,9 +377,8 @@ struct hc_driver {
|
|||||||
* or bandwidth constraints.
|
* or bandwidth constraints.
|
||||||
*/
|
*/
|
||||||
void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *);
|
void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *);
|
||||||
/* Set the hardware-chosen device address */
|
/* Returns the hardware-chosen device address */
|
||||||
int (*address_device)(struct usb_hcd *, struct usb_device *udev,
|
int (*address_device)(struct usb_hcd *, struct usb_device *udev);
|
||||||
unsigned int timeout_ms);
|
|
||||||
/* prepares the hardware to send commands to the device */
|
/* prepares the hardware to send commands to the device */
|
||||||
int (*enable_device)(struct usb_hcd *, struct usb_device *udev);
|
int (*enable_device)(struct usb_hcd *, struct usb_device *udev);
|
||||||
/* Notifies the HCD after a hub descriptor is fetched.
|
/* Notifies the HCD after a hub descriptor is fetched.
|
||||||
|
|||||||
Reference in New Issue
Block a user