Commit f67f19b7 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[PATCH] USB: fix address assignment after device reset

Until my ambitious project gets going, this patch at least fixes the
problem of assigning a device's new address following a device reset.
The only change needed to David's original suggestion was to handle the
pathway involved in registering root hubs.
parent f8d9e286
...@@ -720,6 +720,7 @@ int usb_register_root_hub (struct usb_device *usb_dev, struct device *parent_dev ...@@ -720,6 +720,7 @@ int usb_register_root_hub (struct usb_device *usb_dev, struct device *parent_dev
int retval; int retval;
sprintf (&usb_dev->dev.bus_id[0], "usb%d", usb_dev->bus->busnum); sprintf (&usb_dev->dev.bus_id[0], "usb%d", usb_dev->bus->busnum);
usb_dev->state = USB_STATE_DEFAULT;
retval = usb_new_device (usb_dev, parent_dev); retval = usb_new_device (usb_dev, parent_dev);
if (retval) if (retval)
dev_err (parent_dev, "can't register root hub for %s, %d\n", dev_err (parent_dev, "can't register root hub for %s, %d\n",
......
...@@ -737,6 +737,9 @@ static int usb_hub_port_reset(struct usb_device *hub, int port, ...@@ -737,6 +737,9 @@ static int usb_hub_port_reset(struct usb_device *hub, int port,
if (status != -1) { if (status != -1) {
usb_clear_port_feature(hub, usb_clear_port_feature(hub,
port + 1, USB_PORT_FEAT_C_RESET); port + 1, USB_PORT_FEAT_C_RESET);
dev->state = status
? USB_STATE_NOTATTACHED
: USB_STATE_DEFAULT;
return status; return status;
} }
......
...@@ -1017,9 +1017,6 @@ int usb_new_device(struct usb_device *dev, struct device *parent) ...@@ -1017,9 +1017,6 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
/* dma masks come from the controller; readonly, except to hcd */ /* dma masks come from the controller; readonly, except to hcd */
dev->dev.dma_mask = parent->dma_mask; dev->dev.dma_mask = parent->dma_mask;
/* it's not usable yet */
dev->state = USB_STATE_DEFAULT;
/* USB 2.0 section 5.5.3 talks about ep0 maxpacket ... /* USB 2.0 section 5.5.3 talks about ep0 maxpacket ...
* it's fixed size except for full speed devices. * it's fixed size except for full speed devices.
*/ */
......
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