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.h30
1 files changed, 23 insertions, 7 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index f72aa51f7bcd..85ee9be9361e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -108,6 +108,7 @@ enum usb_interface_condition {
108 * (in probe()), bound to a driver, or unbinding (in disconnect()) 108 * (in probe()), bound to a driver, or unbinding (in disconnect())
109 * @is_active: flag set when the interface is bound and not suspended. 109 * @is_active: flag set when the interface is bound and not suspended.
110 * @sysfs_files_created: sysfs attributes exist 110 * @sysfs_files_created: sysfs attributes exist
111 * @ep_devs_created: endpoint child pseudo-devices exist
111 * @unregistering: flag set when the interface is being unregistered 112 * @unregistering: flag set when the interface is being unregistered
112 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup 113 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
113 * capability during autosuspend. 114 * capability during autosuspend.
@@ -120,6 +121,11 @@ enum usb_interface_condition {
120 * to the sysfs representation for that device. 121 * to the sysfs representation for that device.
121 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not 122 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not
122 * allowed unless the counter is 0. 123 * allowed unless the counter is 0.
124 * @reset_ws: Used for scheduling resets from atomic context.
125 * @reset_running: set to 1 if the interface is currently running a
126 * queued reset so that usb_cancel_queued_reset() doesn't try to
127 * remove from the workqueue when running inside the worker
128 * thread. See __usb_queue_reset_device().
123 * 129 *
124 * USB device drivers attach to interfaces on a physical device. Each 130 * USB device drivers attach to interfaces on a physical device. Each
125 * interface encapsulates a single high level function, such as feeding 131 * interface encapsulates a single high level function, such as feeding
@@ -164,14 +170,17 @@ struct usb_interface {
164 enum usb_interface_condition condition; /* state of binding */ 170 enum usb_interface_condition condition; /* state of binding */
165 unsigned is_active:1; /* the interface is not suspended */ 171 unsigned is_active:1; /* the interface is not suspended */
166 unsigned sysfs_files_created:1; /* the sysfs attributes exist */ 172 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
173 unsigned ep_devs_created:1; /* endpoint "devices" exist */
167 unsigned unregistering:1; /* unregistration is in progress */ 174 unsigned unregistering:1; /* unregistration is in progress */
168 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 175 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
169 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ 176 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */
170 unsigned needs_binding:1; /* needs delayed unbind/rebind */ 177 unsigned needs_binding:1; /* needs delayed unbind/rebind */
178 unsigned reset_running:1;
171 179
172 struct device dev; /* interface specific device info */ 180 struct device dev; /* interface specific device info */
173 struct device *usb_dev; 181 struct device *usb_dev;
174 int pm_usage_cnt; /* usage counter for autosuspend */ 182 int pm_usage_cnt; /* usage counter for autosuspend */
183 struct work_struct reset_ws; /* for resets in atomic context */
175}; 184};
176#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 185#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
177#define interface_to_usbdev(intf) \ 186#define interface_to_usbdev(intf) \
@@ -329,7 +338,7 @@ struct usb_bus {
329#endif 338#endif
330 struct device *dev; /* device for this bus */ 339 struct device *dev; /* device for this bus */
331 340
332#if defined(CONFIG_USB_MON) 341#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
333 struct mon_bus *mon_bus; /* non-null when associated */ 342 struct mon_bus *mon_bus; /* non-null when associated */
334 int monitored; /* non-zero when monitored */ 343 int monitored; /* non-zero when monitored */
335#endif 344#endif
@@ -398,6 +407,7 @@ struct usb_tt;
398 * @urbnum: number of URBs submitted for the whole device 407 * @urbnum: number of URBs submitted for the whole device
399 * @active_duration: total time device is not suspended 408 * @active_duration: total time device is not suspended
400 * @autosuspend: for delayed autosuspends 409 * @autosuspend: for delayed autosuspends
410 * @autoresume: for autoresumes requested while in_interrupt
401 * @pm_mutex: protects PM operations 411 * @pm_mutex: protects PM operations
402 * @last_busy: time of last use 412 * @last_busy: time of last use
403 * @autosuspend_delay: in jiffies 413 * @autosuspend_delay: in jiffies
@@ -476,6 +486,7 @@ struct usb_device {
476 486
477#ifdef CONFIG_PM 487#ifdef CONFIG_PM
478 struct delayed_work autosuspend; 488 struct delayed_work autosuspend;
489 struct work_struct autoresume;
479 struct mutex pm_mutex; 490 struct mutex pm_mutex;
480 491
481 unsigned long last_busy; 492 unsigned long last_busy;
@@ -505,6 +516,7 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
505 516
506/* USB port reset for device reinitialization */ 517/* USB port reset for device reinitialization */
507extern int usb_reset_device(struct usb_device *dev); 518extern int usb_reset_device(struct usb_device *dev);
519extern void usb_queue_reset_device(struct usb_interface *dev);
508 520
509extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); 521extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
510 522
@@ -513,6 +525,8 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
513extern int usb_autopm_set_interface(struct usb_interface *intf); 525extern int usb_autopm_set_interface(struct usb_interface *intf);
514extern int usb_autopm_get_interface(struct usb_interface *intf); 526extern int usb_autopm_get_interface(struct usb_interface *intf);
515extern void usb_autopm_put_interface(struct usb_interface *intf); 527extern void usb_autopm_put_interface(struct usb_interface *intf);
528extern int usb_autopm_get_interface_async(struct usb_interface *intf);
529extern void usb_autopm_put_interface_async(struct usb_interface *intf);
516 530
517static inline void usb_autopm_enable(struct usb_interface *intf) 531static inline void usb_autopm_enable(struct usb_interface *intf)
518{ 532{
@@ -539,8 +553,13 @@ static inline int usb_autopm_set_interface(struct usb_interface *intf)
539static inline int usb_autopm_get_interface(struct usb_interface *intf) 553static inline int usb_autopm_get_interface(struct usb_interface *intf)
540{ return 0; } 554{ return 0; }
541 555
556static inline int usb_autopm_get_interface_async(struct usb_interface *intf)
557{ return 0; }
558
542static inline void usb_autopm_put_interface(struct usb_interface *intf) 559static inline void usb_autopm_put_interface(struct usb_interface *intf)
543{ } 560{ }
561static inline void usb_autopm_put_interface_async(struct usb_interface *intf)
562{ }
544static inline void usb_autopm_enable(struct usb_interface *intf) 563static inline void usb_autopm_enable(struct usb_interface *intf)
545{ } 564{ }
546static inline void usb_autopm_disable(struct usb_interface *intf) 565static inline void usb_autopm_disable(struct usb_interface *intf)
@@ -1050,7 +1069,7 @@ struct usb_device_driver {
1050 void (*disconnect) (struct usb_device *udev); 1069 void (*disconnect) (struct usb_device *udev);
1051 1070
1052 int (*suspend) (struct usb_device *udev, pm_message_t message); 1071 int (*suspend) (struct usb_device *udev, pm_message_t message);
1053 int (*resume) (struct usb_device *udev); 1072 int (*resume) (struct usb_device *udev, pm_message_t message);
1054 struct usbdrv_wrap drvwrap; 1073 struct usbdrv_wrap drvwrap;
1055 unsigned int supports_autosuspend:1; 1074 unsigned int supports_autosuspend:1;
1056}; 1075};
@@ -1321,7 +1340,7 @@ struct urb {
1321 struct kref kref; /* reference count of the URB */ 1340 struct kref kref; /* reference count of the URB */
1322 void *hcpriv; /* private data for host controller */ 1341 void *hcpriv; /* private data for host controller */
1323 atomic_t use_count; /* concurrent submissions counter */ 1342 atomic_t use_count; /* concurrent submissions counter */
1324 u8 reject; /* submissions will fail */ 1343 atomic_t reject; /* submissions will fail */
1325 int unlinked; /* unlink error code */ 1344 int unlinked; /* unlink error code */
1326 1345
1327 /* public: documented fields in the urb that can be used by drivers */ 1346 /* public: documented fields in the urb that can be used by drivers */
@@ -1466,6 +1485,7 @@ extern void usb_poison_urb(struct urb *urb);
1466extern void usb_unpoison_urb(struct urb *urb); 1485extern void usb_unpoison_urb(struct urb *urb);
1467extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1486extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1468extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1487extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1488extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
1469extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1489extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1470extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1490extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1471extern void usb_unanchor_urb(struct urb *urb); 1491extern void usb_unanchor_urb(struct urb *urb);
@@ -1722,10 +1742,6 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1722 1742
1723#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ 1743#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
1724 format "\n" , ## arg) 1744 format "\n" , ## arg)
1725#define info(format, arg...) printk(KERN_INFO KBUILD_MODNAME ": " \
1726 format "\n" , ## arg)
1727#define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \
1728 format "\n" , ## arg)
1729 1745
1730#endif /* __KERNEL__ */ 1746#endif /* __KERNEL__ */
1731 1747