diff options
author | Lan Tianyu <tianyu.lan@intel.com> | 2012-09-05 01:44:32 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-10 15:59:42 -0400 |
commit | ff823c79a5c33194c2e5594f7c4686ea3547910c (patch) | |
tree | 0685b5aee627d7f3440dc09865a7715406cfee54 /include/linux/usb.h | |
parent | fa2a9566257a3b62c328ea5d621ccf5952079dac (diff) |
usb: move children to struct usb_port
The usb_device structure contains an array of usb_device "children".
This array is only valid if the usb_device is a hub, so it makes no
sense to store it there. Instead, store the usb_device child
in its parent usb_port structure.
Since usb_port is an internal USB core structure, add a new function to
get the USB device child, usb_hub_find_child(). Add a new macro,
usb_hub_get_each_child(), to iterate over all the children attached to a
particular USB hub.
Remove the printing the USB children array pointer from the usb-ip
driver, since it's really not necessary.
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r-- | include/linux/usb.h | 15 |
1 files changed, 13 insertions, 2 deletions
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) |