diff options
-rw-r--r-- | drivers/staging/usbip/usbip_common.c | 3 | ||||
-rw-r--r-- | drivers/usb/core/devices.c | 7 | ||||
-rw-r--r-- | drivers/usb/core/hub.c | 73 | ||||
-rw-r--r-- | drivers/usb/host/r8a66597-hcd.c | 5 | ||||
-rw-r--r-- | include/linux/usb.h | 15 |
5 files changed, 68 insertions, 35 deletions
diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c index 70f230269329..95beb76497d6 100644 --- a/drivers/staging/usbip/usbip_common.c +++ b/drivers/staging/usbip/usbip_common.c | |||
@@ -157,8 +157,7 @@ static void usbip_dump_usb_device(struct usb_device *udev) | |||
157 | dev_dbg(dev, "have_langid %d, string_langid %d\n", | 157 | dev_dbg(dev, "have_langid %d, string_langid %d\n", |
158 | udev->have_langid, udev->string_langid); | 158 | udev->have_langid, udev->string_langid); |
159 | 159 | ||
160 | dev_dbg(dev, "maxchild %d, children %p\n", | 160 | dev_dbg(dev, "maxchild %d\n", udev->maxchild); |
161 | udev->maxchild, udev->children); | ||
162 | } | 161 | } |
163 | 162 | ||
164 | static void usbip_dump_request_type(__u8 rt) | 163 | static void usbip_dump_request_type(__u8 rt) |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index d95696584762..f4ead1296820 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -496,6 +496,7 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, | |||
496 | char *pages_start, *data_end, *speed; | 496 | char *pages_start, *data_end, *speed; |
497 | unsigned int length; | 497 | unsigned int length; |
498 | ssize_t total_written = 0; | 498 | ssize_t total_written = 0; |
499 | struct usb_device *childdev = NULL; | ||
499 | 500 | ||
500 | /* don't bother with anything else if we're not writing any data */ | 501 | /* don't bother with anything else if we're not writing any data */ |
501 | if (*nbytes <= 0) | 502 | if (*nbytes <= 0) |
@@ -589,14 +590,12 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, | |||
589 | free_pages((unsigned long)pages_start, 1); | 590 | free_pages((unsigned long)pages_start, 1); |
590 | 591 | ||
591 | /* Now look at all of this device's children. */ | 592 | /* Now look at all of this device's children. */ |
592 | for (chix = 0; chix < usbdev->maxchild; chix++) { | 593 | usb_hub_for_each_child(usbdev, chix, childdev) { |
593 | struct usb_device *childdev = usbdev->children[chix]; | ||
594 | |||
595 | if (childdev) { | 594 | if (childdev) { |
596 | usb_lock_device(childdev); | 595 | usb_lock_device(childdev); |
597 | ret = usb_device_dump(buffer, nbytes, skip_bytes, | 596 | ret = usb_device_dump(buffer, nbytes, skip_bytes, |
598 | file_offset, childdev, bus, | 597 | file_offset, childdev, bus, |
599 | level + 1, chix, ++cnt); | 598 | level + 1, chix - 1, ++cnt); |
600 | usb_unlock_device(childdev); | 599 | usb_unlock_device(childdev); |
601 | if (ret == -EFAULT) | 600 | if (ret == -EFAULT) |
602 | return total_written; | 601 | return total_written; |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 87df22eef491..cdbade148995 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | struct usb_port { | 42 | struct usb_port { |
43 | struct usb_device *child; | ||
43 | struct device dev; | 44 | struct device dev; |
44 | struct dev_state *port_owner; | 45 | struct dev_state *port_owner; |
45 | }; | 46 | }; |
@@ -181,7 +182,7 @@ static inline char *portspeed(struct usb_hub *hub, int portstatus) | |||
181 | /* Note that hdev or one of its children must be locked! */ | 182 | /* Note that hdev or one of its children must be locked! */ |
182 | static struct usb_hub *hdev_to_hub(struct usb_device *hdev) | 183 | static struct usb_hub *hdev_to_hub(struct usb_device *hdev) |
183 | { | 184 | { |
184 | if (!hdev || !hdev->actconfig) | 185 | if (!hdev || !hdev->actconfig || !hdev->maxchild) |
185 | return NULL; | 186 | return NULL; |
186 | return usb_get_intfdata(hdev->actconfig->interface[0]); | 187 | return usb_get_intfdata(hdev->actconfig->interface[0]); |
187 | } | 188 | } |
@@ -876,8 +877,8 @@ static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) | |||
876 | struct usb_device *hdev = hub->hdev; | 877 | struct usb_device *hdev = hub->hdev; |
877 | int ret = 0; | 878 | int ret = 0; |
878 | 879 | ||
879 | if (hdev->children[port1-1] && set_state) | 880 | if (hub->ports[port1 - 1]->child && set_state) |
880 | usb_set_device_state(hdev->children[port1-1], | 881 | usb_set_device_state(hub->ports[port1 - 1]->child, |
881 | USB_STATE_NOTATTACHED); | 882 | USB_STATE_NOTATTACHED); |
882 | if (!hub->error && !hub_is_superspeed(hub->hdev)) | 883 | if (!hub->error && !hub_is_superspeed(hub->hdev)) |
883 | ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_ENABLE); | 884 | ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_ENABLE); |
@@ -1033,7 +1034,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
1033 | * which ports need attention. | 1034 | * which ports need attention. |
1034 | */ | 1035 | */ |
1035 | for (port1 = 1; port1 <= hdev->maxchild; ++port1) { | 1036 | for (port1 = 1; port1 <= hdev->maxchild; ++port1) { |
1036 | struct usb_device *udev = hdev->children[port1-1]; | 1037 | struct usb_device *udev = hub->ports[port1 - 1]->child; |
1037 | u16 portstatus, portchange; | 1038 | u16 portstatus, portchange; |
1038 | 1039 | ||
1039 | portstatus = portchange = 0; | 1040 | portstatus = portchange = 0; |
@@ -1198,8 +1199,8 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type) | |||
1198 | if (type != HUB_SUSPEND) { | 1199 | if (type != HUB_SUSPEND) { |
1199 | /* Disconnect all the children */ | 1200 | /* Disconnect all the children */ |
1200 | for (i = 0; i < hdev->maxchild; ++i) { | 1201 | for (i = 0; i < hdev->maxchild; ++i) { |
1201 | if (hdev->children[i]) | 1202 | if (hub->ports[i]->child) |
1202 | usb_disconnect(&hdev->children[i]); | 1203 | usb_disconnect(&hub->ports[i]->child); |
1203 | } | 1204 | } |
1204 | } | 1205 | } |
1205 | 1206 | ||
@@ -1324,11 +1325,9 @@ static int hub_configure(struct usb_hub *hub, | |||
1324 | dev_info (hub_dev, "%d port%s detected\n", hdev->maxchild, | 1325 | dev_info (hub_dev, "%d port%s detected\n", hdev->maxchild, |
1325 | (hdev->maxchild == 1) ? "" : "s"); | 1326 | (hdev->maxchild == 1) ? "" : "s"); |
1326 | 1327 | ||
1327 | hdev->children = kzalloc(hdev->maxchild * | ||
1328 | sizeof(struct usb_device *), GFP_KERNEL); | ||
1329 | hub->ports = kzalloc(hdev->maxchild * sizeof(struct usb_port *), | 1328 | hub->ports = kzalloc(hdev->maxchild * sizeof(struct usb_port *), |
1330 | GFP_KERNEL); | 1329 | GFP_KERNEL); |
1331 | if (!hdev->children || !hub->ports) { | 1330 | if (!hub->ports) { |
1332 | ret = -ENOMEM; | 1331 | ret = -ENOMEM; |
1333 | goto fail; | 1332 | goto fail; |
1334 | } | 1333 | } |
@@ -1591,7 +1590,6 @@ static void hub_disconnect(struct usb_interface *intf) | |||
1591 | highspeed_hubs--; | 1590 | highspeed_hubs--; |
1592 | 1591 | ||
1593 | usb_free_urb(hub->urb); | 1592 | usb_free_urb(hub->urb); |
1594 | kfree(hdev->children); | ||
1595 | kfree(hub->ports); | 1593 | kfree(hub->ports); |
1596 | kfree(hub->descriptor); | 1594 | kfree(hub->descriptor); |
1597 | kfree(hub->status); | 1595 | kfree(hub->status); |
@@ -1679,6 +1677,7 @@ static int | |||
1679 | hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data) | 1677 | hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data) |
1680 | { | 1678 | { |
1681 | struct usb_device *hdev = interface_to_usbdev (intf); | 1679 | struct usb_device *hdev = interface_to_usbdev (intf); |
1680 | struct usb_hub *hub = hdev_to_hub(hdev); | ||
1682 | 1681 | ||
1683 | /* assert ifno == 0 (part of hub spec) */ | 1682 | /* assert ifno == 0 (part of hub spec) */ |
1684 | switch (code) { | 1683 | switch (code) { |
@@ -1692,11 +1691,11 @@ hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data) | |||
1692 | else { | 1691 | else { |
1693 | info->nports = hdev->maxchild; | 1692 | info->nports = hdev->maxchild; |
1694 | for (i = 0; i < info->nports; i++) { | 1693 | for (i = 0; i < info->nports; i++) { |
1695 | if (hdev->children[i] == NULL) | 1694 | if (hub->ports[i]->child == NULL) |
1696 | info->port[i] = 0; | 1695 | info->port[i] = 0; |
1697 | else | 1696 | else |
1698 | info->port[i] = | 1697 | info->port[i] = |
1699 | hdev->children[i]->devnum; | 1698 | hub->ports[i]->child->devnum; |
1700 | } | 1699 | } |
1701 | } | 1700 | } |
1702 | spin_unlock_irq(&device_state_lock); | 1701 | spin_unlock_irq(&device_state_lock); |
@@ -1784,11 +1783,12 @@ bool usb_device_is_owned(struct usb_device *udev) | |||
1784 | 1783 | ||
1785 | static void recursively_mark_NOTATTACHED(struct usb_device *udev) | 1784 | static void recursively_mark_NOTATTACHED(struct usb_device *udev) |
1786 | { | 1785 | { |
1786 | struct usb_hub *hub = hdev_to_hub(udev); | ||
1787 | int i; | 1787 | int i; |
1788 | 1788 | ||
1789 | for (i = 0; i < udev->maxchild; ++i) { | 1789 | for (i = 0; i < udev->maxchild; ++i) { |
1790 | if (udev->children[i]) | 1790 | if (hub->ports[i]->child) |
1791 | recursively_mark_NOTATTACHED(udev->children[i]); | 1791 | recursively_mark_NOTATTACHED(hub->ports[i]->child); |
1792 | } | 1792 | } |
1793 | if (udev->state == USB_STATE_SUSPENDED) | 1793 | if (udev->state == USB_STATE_SUSPENDED) |
1794 | udev->active_duration -= jiffies; | 1794 | udev->active_duration -= jiffies; |
@@ -1952,6 +1952,7 @@ static void hub_free_dev(struct usb_device *udev) | |||
1952 | void usb_disconnect(struct usb_device **pdev) | 1952 | void usb_disconnect(struct usb_device **pdev) |
1953 | { | 1953 | { |
1954 | struct usb_device *udev = *pdev; | 1954 | struct usb_device *udev = *pdev; |
1955 | struct usb_hub *hub = hdev_to_hub(udev); | ||
1955 | int i; | 1956 | int i; |
1956 | 1957 | ||
1957 | /* mark the device as inactive, so any further urb submissions for | 1958 | /* mark the device as inactive, so any further urb submissions for |
@@ -1966,8 +1967,8 @@ void usb_disconnect(struct usb_device **pdev) | |||
1966 | 1967 | ||
1967 | /* Free up all the children before we remove this device */ | 1968 | /* Free up all the children before we remove this device */ |
1968 | for (i = 0; i < udev->maxchild; i++) { | 1969 | for (i = 0; i < udev->maxchild; i++) { |
1969 | if (udev->children[i]) | 1970 | if (hub->ports[i]->child) |
1970 | usb_disconnect(&udev->children[i]); | 1971 | usb_disconnect(&hub->ports[i]->child); |
1971 | } | 1972 | } |
1972 | 1973 | ||
1973 | /* deallocate hcd/hardware state ... nuking all pending urbs and | 1974 | /* deallocate hcd/hardware state ... nuking all pending urbs and |
@@ -3131,7 +3132,7 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg) | |||
3131 | for (port1 = 1; port1 <= hdev->maxchild; port1++) { | 3132 | for (port1 = 1; port1 <= hdev->maxchild; port1++) { |
3132 | struct usb_device *udev; | 3133 | struct usb_device *udev; |
3133 | 3134 | ||
3134 | udev = hdev->children [port1-1]; | 3135 | udev = hub->ports[port1 - 1]->child; |
3135 | if (udev && udev->can_submit) { | 3136 | if (udev && udev->can_submit) { |
3136 | dev_warn(&intf->dev, "port %d nyet suspended\n", port1); | 3137 | dev_warn(&intf->dev, "port %d nyet suspended\n", port1); |
3137 | if (PMSG_IS_AUTO(msg)) | 3138 | if (PMSG_IS_AUTO(msg)) |
@@ -4058,7 +4059,7 @@ hub_power_remaining (struct usb_hub *hub) | |||
4058 | 4059 | ||
4059 | remaining = hdev->bus_mA - hub->descriptor->bHubContrCurrent; | 4060 | remaining = hdev->bus_mA - hub->descriptor->bHubContrCurrent; |
4060 | for (port1 = 1; port1 <= hdev->maxchild; ++port1) { | 4061 | for (port1 = 1; port1 <= hdev->maxchild; ++port1) { |
4061 | struct usb_device *udev = hdev->children[port1 - 1]; | 4062 | struct usb_device *udev = hub->ports[port1 - 1]->child; |
4062 | int delta; | 4063 | int delta; |
4063 | 4064 | ||
4064 | if (!udev) | 4065 | if (!udev) |
@@ -4122,7 +4123,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
4122 | #endif | 4123 | #endif |
4123 | 4124 | ||
4124 | /* Try to resuscitate an existing device */ | 4125 | /* Try to resuscitate an existing device */ |
4125 | udev = hdev->children[port1-1]; | 4126 | udev = hub->ports[port1 - 1]->child; |
4126 | if ((portstatus & USB_PORT_STAT_CONNECTION) && udev && | 4127 | if ((portstatus & USB_PORT_STAT_CONNECTION) && udev && |
4127 | udev->state != USB_STATE_NOTATTACHED) { | 4128 | udev->state != USB_STATE_NOTATTACHED) { |
4128 | usb_lock_device(udev); | 4129 | usb_lock_device(udev); |
@@ -4151,7 +4152,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
4151 | 4152 | ||
4152 | /* Disconnect any existing devices under this port */ | 4153 | /* Disconnect any existing devices under this port */ |
4153 | if (udev) | 4154 | if (udev) |
4154 | usb_disconnect(&hdev->children[port1-1]); | 4155 | usb_disconnect(&hub->ports[port1 - 1]->child); |
4155 | clear_bit(port1, hub->change_bits); | 4156 | clear_bit(port1, hub->change_bits); |
4156 | 4157 | ||
4157 | /* We can forget about a "removed" device when there's a physical | 4158 | /* We can forget about a "removed" device when there's a physical |
@@ -4287,7 +4288,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
4287 | if (hdev->state == USB_STATE_NOTATTACHED) | 4288 | if (hdev->state == USB_STATE_NOTATTACHED) |
4288 | status = -ENOTCONN; | 4289 | status = -ENOTCONN; |
4289 | else | 4290 | else |
4290 | hdev->children[port1-1] = udev; | 4291 | hub->ports[port1 - 1]->child = udev; |
4291 | spin_unlock_irq(&device_state_lock); | 4292 | spin_unlock_irq(&device_state_lock); |
4292 | 4293 | ||
4293 | /* Run it through the hoops (find a driver, etc) */ | 4294 | /* Run it through the hoops (find a driver, etc) */ |
@@ -4295,7 +4296,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, | |||
4295 | status = usb_new_device(udev); | 4296 | status = usb_new_device(udev); |
4296 | if (status) { | 4297 | if (status) { |
4297 | spin_lock_irq(&device_state_lock); | 4298 | spin_lock_irq(&device_state_lock); |
4298 | hdev->children[port1-1] = NULL; | 4299 | hub->ports[port1 - 1]->child = NULL; |
4299 | spin_unlock_irq(&device_state_lock); | 4300 | spin_unlock_irq(&device_state_lock); |
4300 | } | 4301 | } |
4301 | } | 4302 | } |
@@ -4341,7 +4342,7 @@ static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port, | |||
4341 | int ret; | 4342 | int ret; |
4342 | 4343 | ||
4343 | hdev = hub->hdev; | 4344 | hdev = hub->hdev; |
4344 | udev = hdev->children[port-1]; | 4345 | udev = hub->ports[port - 1]->child; |
4345 | if (!hub_is_superspeed(hdev)) { | 4346 | if (!hub_is_superspeed(hdev)) { |
4346 | if (!(portchange & USB_PORT_STAT_C_SUSPEND)) | 4347 | if (!(portchange & USB_PORT_STAT_C_SUSPEND)) |
4347 | return 0; | 4348 | return 0; |
@@ -4495,7 +4496,7 @@ static void hub_events(void) | |||
4495 | */ | 4496 | */ |
4496 | if (!(portstatus & USB_PORT_STAT_ENABLE) | 4497 | if (!(portstatus & USB_PORT_STAT_ENABLE) |
4497 | && !connect_change | 4498 | && !connect_change |
4498 | && hdev->children[i-1]) { | 4499 | && hub->ports[i - 1]->child) { |
4499 | dev_err (hub_dev, | 4500 | dev_err (hub_dev, |
4500 | "port %i " | 4501 | "port %i " |
4501 | "disabled by hub (EMI?), " | 4502 | "disabled by hub (EMI?), " |
@@ -5052,3 +5053,27 @@ void usb_queue_reset_device(struct usb_interface *iface) | |||
5052 | schedule_work(&iface->reset_ws); | 5053 | schedule_work(&iface->reset_ws); |
5053 | } | 5054 | } |
5054 | EXPORT_SYMBOL_GPL(usb_queue_reset_device); | 5055 | EXPORT_SYMBOL_GPL(usb_queue_reset_device); |
5056 | |||
5057 | /** | ||
5058 | * usb_hub_find_child - Get the pointer of child device | ||
5059 | * attached to the port which is specified by @port1. | ||
5060 | * @hdev: USB device belonging to the usb hub | ||
5061 | * @port1: port num to indicate which port the child device | ||
5062 | * is attached to. | ||
5063 | * | ||
5064 | * USB drivers call this function to get hub's child device | ||
5065 | * pointer. | ||
5066 | * | ||
5067 | * Return NULL if input param is invalid and | ||
5068 | * child's usb_device pointer if non-NULL. | ||
5069 | */ | ||
5070 | struct usb_device *usb_hub_find_child(struct usb_device *hdev, | ||
5071 | int port1) | ||
5072 | { | ||
5073 | struct usb_hub *hub = hdev_to_hub(hdev); | ||
5074 | |||
5075 | if (port1 < 1 || port1 > hdev->maxchild) | ||
5076 | return NULL; | ||
5077 | return hub->ports[port1 - 1]->child; | ||
5078 | } | ||
5079 | EXPORT_SYMBOL_GPL(usb_hub_find_child); | ||
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 4c634eb56358..fcc09e5ec0ad 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -2029,15 +2029,14 @@ static int r8a66597_get_frame(struct usb_hcd *hcd) | |||
2029 | static void collect_usb_address_map(struct usb_device *udev, unsigned long *map) | 2029 | static void collect_usb_address_map(struct usb_device *udev, unsigned long *map) |
2030 | { | 2030 | { |
2031 | int chix; | 2031 | int chix; |
2032 | struct usb_device *childdev; | ||
2032 | 2033 | ||
2033 | if (udev->state == USB_STATE_CONFIGURED && | 2034 | if (udev->state == USB_STATE_CONFIGURED && |
2034 | udev->parent && udev->parent->devnum > 1 && | 2035 | udev->parent && udev->parent->devnum > 1 && |
2035 | udev->parent->descriptor.bDeviceClass == USB_CLASS_HUB) | 2036 | udev->parent->descriptor.bDeviceClass == USB_CLASS_HUB) |
2036 | map[udev->devnum/32] |= (1 << (udev->devnum % 32)); | 2037 | map[udev->devnum/32] |= (1 << (udev->devnum % 32)); |
2037 | 2038 | ||
2038 | for (chix = 0; chix < udev->maxchild; chix++) { | 2039 | usb_hub_for_each_child(udev, chix, childdev) { |
2039 | struct usb_device *childdev = udev->children[chix]; | ||
2040 | |||
2041 | if (childdev) | 2040 | if (childdev) |
2042 | collect_usb_address_map(childdev, map); | 2041 | collect_usb_address_map(childdev, map); |
2043 | } | 2042 | } |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 30d1ae38eab1..ff8ef2d28589 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -469,7 +469,6 @@ struct usb3_lpm_parameters { | |||
469 | * access from userspace | 469 | * access from userspace |
470 | * @usbfs_dentry: usbfs dentry entry for the device | 470 | * @usbfs_dentry: usbfs dentry entry for the device |
471 | * @maxchild: number of ports if hub | 471 | * @maxchild: number of ports if hub |
472 | * @children: child devices - USB devices that are attached to this hub | ||
473 | * @quirks: quirks of the whole device | 472 | * @quirks: quirks of the whole device |
474 | * @urbnum: number of URBs submitted for the whole device | 473 | * @urbnum: number of URBs submitted for the whole device |
475 | * @active_duration: total time device is not suspended | 474 | * @active_duration: total time device is not suspended |
@@ -543,7 +542,6 @@ struct usb_device { | |||
543 | struct list_head filelist; | 542 | struct list_head filelist; |
544 | 543 | ||
545 | int maxchild; | 544 | int maxchild; |
546 | struct usb_device **children; | ||
547 | 545 | ||
548 | u32 quirks; | 546 | u32 quirks; |
549 | atomic_t urbnum; | 547 | atomic_t urbnum; |
@@ -572,6 +570,19 @@ static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf) | |||
572 | 570 | ||
573 | extern struct usb_device *usb_get_dev(struct usb_device *dev); | 571 | extern struct usb_device *usb_get_dev(struct usb_device *dev); |
574 | extern void usb_put_dev(struct usb_device *dev); | 572 | extern void usb_put_dev(struct usb_device *dev); |
573 | extern struct usb_device *usb_hub_find_child(struct usb_device *hdev, | ||
574 | int port1); | ||
575 | |||
576 | /** | ||
577 | * usb_hub_for_each_child - iterate over all child devices on the hub | ||
578 | * @hdev: USB device belonging to the usb hub | ||
579 | * @port1: portnum associated with child device | ||
580 | * @child: child device pointer | ||
581 | */ | ||
582 | #define usb_hub_for_each_child(hdev, port1, child) \ | ||
583 | for (port1 = 1, child = usb_hub_find_child(hdev, port1); \ | ||
584 | port1 <= hdev->maxchild; \ | ||
585 | child = usb_hub_find_child(hdev, ++port1)) | ||
575 | 586 | ||
576 | /* USB device locking */ | 587 | /* USB device locking */ |
577 | #define usb_lock_device(udev) device_lock(&(udev)->dev) | 588 | #define usb_lock_device(udev) device_lock(&(udev)->dev) |