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

[PATCH] USB: Code motion in the hub driver

This patch (as553) merely moves some code and deletes an unneeded test in
the hub driver.  This is in preparation for the patch that follows.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 68a6457e
...@@ -492,6 +492,23 @@ static int hub_hub_status(struct usb_hub *hub, ...@@ -492,6 +492,23 @@ static int hub_hub_status(struct usb_hub *hub,
return ret; return ret;
} }
static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)
{
struct usb_device *hdev = hub->hdev;
int ret;
if (hdev->children[port1-1] && set_state) {
usb_set_device_state(hdev->children[port1-1],
USB_STATE_NOTATTACHED);
}
ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_ENABLE);
if (ret)
dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n",
port1, ret);
return ret;
}
static int hub_configure(struct usb_hub *hub, static int hub_configure(struct usb_hub *hub,
struct usb_endpoint_descriptor *endpoint) struct usb_endpoint_descriptor *endpoint)
{ {
...@@ -717,15 +734,12 @@ static void hub_disconnect(struct usb_interface *intf) ...@@ -717,15 +734,12 @@ static void hub_disconnect(struct usb_interface *intf)
struct usb_hub *hub = usb_get_intfdata (intf); struct usb_hub *hub = usb_get_intfdata (intf);
struct usb_device *hdev; struct usb_device *hdev;
if (!hub) usb_set_intfdata (intf, NULL);
return;
hdev = hub->hdev; hdev = hub->hdev;
if (hdev->speed == USB_SPEED_HIGH) if (hdev->speed == USB_SPEED_HIGH)
highspeed_hubs--; highspeed_hubs--;
usb_set_intfdata (intf, NULL);
hub_quiesce(hub); hub_quiesce(hub);
usb_free_urb(hub->urb); usb_free_urb(hub->urb);
hub->urb = NULL; hub->urb = NULL;
...@@ -1430,23 +1444,6 @@ static int hub_port_reset(struct usb_hub *hub, int port1, ...@@ -1430,23 +1444,6 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
return status; return status;
} }
static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)
{
struct usb_device *hdev = hub->hdev;
int ret;
if (hdev->children[port1-1] && set_state) {
usb_set_device_state(hdev->children[port1-1],
USB_STATE_NOTATTACHED);
}
ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_ENABLE);
if (ret)
dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n",
port1, ret);
return ret;
}
/* /*
* Disable a port and mark a logical connnect-change event, so that some * Disable a port and mark a logical connnect-change event, so that some
* time later khubd will disconnect() any existing usb_device on the port * time later khubd will disconnect() any existing usb_device on the port
......
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