USB: Export suspend statistics

This patch exports two statistics to userspace:
/sys/bus/usb/device/.../power/connected_duration
/sys/bus/usb/device/.../power/active_duration

connected_duration is the total time (in msec) that the device has
been connected.  active_duration is the total time the device has not
been suspended.  With these two statistics, tools like PowerTOP can
calculate the percentage time that a device is active, i.e. not
suspended or auto-suspended.

Users can also use the active_duration to check if a device is actually
autosuspended.  Currently, they can set power/level to auto and
power/autosuspend to a positive timeout, but there's no way to know from
userspace if a device was actually autosuspended without looking at the
dmesg output.  These statistics will be useful in creating an automated
userspace script to test autosuspend for USB devices.

Signed-off-by: Sarah Sharp <sarah.a.sharp@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

diff --git a/include/linux/usb.h b/include/linux/usb.h
index 8aae045..f8a60756 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -419,12 +419,15 @@
 	u32 quirks;			/* quirks of the whole device */
 	atomic_t urbnum;		/* number of URBs submitted for the whole device */
 
+	unsigned long active_duration;	/* total time device is not suspended */
+
 #ifdef CONFIG_PM
 	struct delayed_work autosuspend; /* for delayed autosuspends */
 	struct mutex pm_mutex;		/* protects PM operations */
 
 	unsigned long last_busy;	/* time of last use */
 	int autosuspend_delay;		/* in jiffies */
+	unsigned long connect_time;	/* time device was first connected */
 
 	unsigned auto_pm:1;		/* autosuspend/resume in progress */
 	unsigned do_remote_wakeup:1;	/* remote wakeup should be enabled */