Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[sfrench/cifs-2.6.git] / include / linux / usb.h
index 87dc75a6cee14e00a755cc49f9dd50e567373e19..56aa2ee21f1b284659e6164bcc9f2dea59ada2c1 100644 (file)
@@ -126,7 +126,7 @@ enum usb_interface_condition {
  * Each interface may have alternate settings.  The initial configuration
  * of a device sets altsetting 0, but the device driver can change
  * that setting using usb_set_interface().  Alternate settings are often
- * used to control the the use of periodic endpoints, such as by having
+ * used to control the use of periodic endpoints, such as by having
  * different endpoints use different amounts of reserved USB bandwidth.
  * All standards-conformant USB devices that use isochronous endpoints
  * will use them in non-default settings.
@@ -299,8 +299,9 @@ struct usb_bus {
        int bandwidth_int_reqs;         /* number of Interrupt requests */
        int bandwidth_isoc_reqs;        /* number of Isoc. requests */
 
+#ifdef CONFIG_USB_DEVICEFS
        struct dentry *usbfs_dentry;    /* usbfs dentry entry for the bus */
-
+#endif
        struct class_device *class_dev; /* class device for this bus */
 
 #if defined(CONFIG_USB_MON)
@@ -373,9 +374,12 @@ struct usb_device {
        char *serial;                   /* iSerialNumber string, if present */
 
        struct list_head filelist;
-       struct device *usbfs_dev;
+#ifdef CONFIG_USB_DEVICE_CLASS
+       struct device *usb_classdev;
+#endif
+#ifdef CONFIG_USB_DEVICEFS
        struct dentry *usbfs_dentry;    /* usbfs dentry entry for the device */
-
+#endif
        /*
         * Child devices - these can be either new devices
         * (if this is a hub device), or different instances
@@ -394,10 +398,13 @@ struct usb_device {
        struct delayed_work autosuspend; /* for delayed autosuspends */
        struct mutex pm_mutex;          /* protects PM operations */
 
-       unsigned autosuspend_delay;     /* in jiffies */
+       unsigned long last_busy;        /* time of last use */
+       int autosuspend_delay;          /* in jiffies */
 
        unsigned auto_pm:1;             /* autosuspend/resume in progress */
        unsigned do_remote_wakeup:1;    /* remote wakeup should be enabled */
+       unsigned autosuspend_disabled:1; /* autosuspend and autoresume */
+       unsigned autoresume_disabled:1;  /*  disabled by the user */
 #endif
 };
 #define        to_usb_device(d) container_of(d, struct usb_device, dev)
@@ -437,6 +444,11 @@ static inline void usb_autopm_disable(struct usb_interface *intf)
        usb_autopm_set_interface(intf);
 }
 
+static inline void usb_mark_last_busy(struct usb_device *udev)
+{
+       udev->last_busy = jiffies;
+}
+
 #else
 
 static inline int usb_autopm_set_interface(struct usb_interface *intf)
@@ -451,6 +463,8 @@ static inline void usb_autopm_enable(struct usb_interface *intf)
 { }
 static inline void usb_autopm_disable(struct usb_interface *intf)
 { }
+static inline void usb_mark_last_busy(struct usb_device *udev)
+{ }
 #endif
 
 /*-------------------------------------------------------------------------*/
@@ -714,6 +728,22 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
        .idVendor = (vend), .idProduct = (prod), \
        .bcdDevice_lo = (lo), .bcdDevice_hi = (hi)
 
+/**
+ * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb
+ *             device with a specific interface protocol
+ * @vend: the 16 bit USB Vendor ID
+ * @prod: the 16 bit USB Product ID
+ * @pr: bInterfaceProtocol value
+ *
+ * This macro is used to create a struct usb_device_id that matches a
+ * specific interface protocol of devices.
+ */
+#define USB_DEVICE_INTERFACE_PROTOCOL(vend,prod,pr) \
+       .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_PROTOCOL, \
+       .idVendor = (vend), \
+       .idProduct = (prod), \
+       .bInterfaceProtocol = (pr)
+
 /**
  * USB_DEVICE_INFO - macro used to describe a class of usb devices
  * @cl: bDeviceClass value