aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r--include/linux/usb.h32
1 files changed, 30 insertions, 2 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 30d1ae38eab1..07915a32fb9d 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -384,6 +384,13 @@ enum usb_device_removable {
384 USB_DEVICE_FIXED, 384 USB_DEVICE_FIXED,
385}; 385};
386 386
387enum usb_port_connect_type {
388 USB_PORT_CONNECT_TYPE_UNKNOWN = 0,
389 USB_PORT_CONNECT_TYPE_HOT_PLUG,
390 USB_PORT_CONNECT_TYPE_HARD_WIRED,
391 USB_PORT_NOT_USED,
392};
393
387/* 394/*
388 * USB 3.0 Link Power Management (LPM) parameters. 395 * USB 3.0 Link Power Management (LPM) parameters.
389 * 396 *
@@ -469,7 +476,6 @@ struct usb3_lpm_parameters {
469 * access from userspace 476 * access from userspace
470 * @usbfs_dentry: usbfs dentry entry for the device 477 * @usbfs_dentry: usbfs dentry entry for the device
471 * @maxchild: number of ports if hub 478 * @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 479 * @quirks: quirks of the whole device
474 * @urbnum: number of URBs submitted for the whole device 480 * @urbnum: number of URBs submitted for the whole device
475 * @active_duration: total time device is not suspended 481 * @active_duration: total time device is not suspended
@@ -543,7 +549,6 @@ struct usb_device {
543 struct list_head filelist; 549 struct list_head filelist;
544 550
545 int maxchild; 551 int maxchild;
546 struct usb_device **children;
547 552
548 u32 quirks; 553 u32 quirks;
549 atomic_t urbnum; 554 atomic_t urbnum;
@@ -572,6 +577,19 @@ static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf)
572 577
573extern struct usb_device *usb_get_dev(struct usb_device *dev); 578extern struct usb_device *usb_get_dev(struct usb_device *dev);
574extern void usb_put_dev(struct usb_device *dev); 579extern void usb_put_dev(struct usb_device *dev);
580extern struct usb_device *usb_hub_find_child(struct usb_device *hdev,
581 int port1);
582
583/**
584 * usb_hub_for_each_child - iterate over all child devices on the hub
585 * @hdev: USB device belonging to the usb hub
586 * @port1: portnum associated with child device
587 * @child: child device pointer
588 */
589#define usb_hub_for_each_child(hdev, port1, child) \
590 for (port1 = 1, child = usb_hub_find_child(hdev, port1); \
591 port1 <= hdev->maxchild; \
592 child = usb_hub_find_child(hdev, ++port1))
575 593
576/* USB device locking */ 594/* USB device locking */
577#define usb_lock_device(udev) device_lock(&(udev)->dev) 595#define usb_lock_device(udev) device_lock(&(udev)->dev)
@@ -584,6 +602,16 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
584extern int usb_reset_device(struct usb_device *dev); 602extern int usb_reset_device(struct usb_device *dev);
585extern void usb_queue_reset_device(struct usb_interface *dev); 603extern void usb_queue_reset_device(struct usb_interface *dev);
586 604
605#ifdef CONFIG_ACPI
606extern int usb_acpi_set_power_state(struct usb_device *hdev, int index,
607 bool enable);
608extern bool usb_acpi_power_manageable(struct usb_device *hdev, int index);
609#else
610static inline int usb_acpi_set_power_state(struct usb_device *hdev, int index,
611 bool enable) { return 0; }
612static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index)
613 { return true; }
614#endif
587 615
588/* USB autosuspend and autoresume */ 616/* USB autosuspend and autoresume */
589#ifdef CONFIG_USB_SUSPEND 617#ifdef CONFIG_USB_SUSPEND