Merge branch 'next/drivers' into HEAD
[deliverable/linux.git] / include / linux / usb.h
index 30d1ae38eab1912c89e8458759fba9bf1d21eed5..07915a32fb9dcda932989cb495798cdc48bb1059 100644 (file)
@@ -384,6 +384,13 @@ enum usb_device_removable {
        USB_DEVICE_FIXED,
 };
 
+enum usb_port_connect_type {
+       USB_PORT_CONNECT_TYPE_UNKNOWN = 0,
+       USB_PORT_CONNECT_TYPE_HOT_PLUG,
+       USB_PORT_CONNECT_TYPE_HARD_WIRED,
+       USB_PORT_NOT_USED,
+};
+
 /*
  * USB 3.0 Link Power Management (LPM) parameters.
  *
@@ -469,7 +476,6 @@ struct usb3_lpm_parameters {
  *     access from userspace
  * @usbfs_dentry: usbfs dentry entry for the device
  * @maxchild: number of ports if hub
- * @children: child devices - USB devices that are attached to this hub
  * @quirks: quirks of the whole device
  * @urbnum: number of URBs submitted for the whole device
  * @active_duration: total time device is not suspended
@@ -543,7 +549,6 @@ struct usb_device {
        struct list_head filelist;
 
        int maxchild;
-       struct usb_device **children;
 
        u32 quirks;
        atomic_t urbnum;
@@ -572,6 +577,19 @@ static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf)
 
 extern struct usb_device *usb_get_dev(struct usb_device *dev);
 extern void usb_put_dev(struct usb_device *dev);
+extern struct usb_device *usb_hub_find_child(struct usb_device *hdev,
+       int port1);
+
+/**
+ * usb_hub_for_each_child - iterate over all child devices on the hub
+ * @hdev:  USB device belonging to the usb hub
+ * @port1: portnum associated with child device
+ * @child: child device pointer
+ */
+#define usb_hub_for_each_child(hdev, port1, child) \
+       for (port1 = 1, child = usb_hub_find_child(hdev, port1); \
+               port1 <= hdev->maxchild; \
+               child = usb_hub_find_child(hdev, ++port1))
 
 /* USB device locking */
 #define usb_lock_device(udev)          device_lock(&(udev)->dev)
@@ -584,6 +602,16 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
 extern int usb_reset_device(struct usb_device *dev);
 extern void usb_queue_reset_device(struct usb_interface *dev);
 
+#ifdef CONFIG_ACPI
+extern int usb_acpi_set_power_state(struct usb_device *hdev, int index,
+       bool enable);
+extern bool usb_acpi_power_manageable(struct usb_device *hdev, int index);
+#else
+static inline int usb_acpi_set_power_state(struct usb_device *hdev, int index,
+       bool enable) { return 0; }
+static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index)
+       { return true; }
+#endif
 
 /* USB autosuspend and autoresume */
 #ifdef CONFIG_USB_SUSPEND
This page took 0.032501 seconds and 5 git commands to generate.