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, 25 insertions, 7 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index f72aa51f7bcd..88079fd60235 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
@@ -408,6 +418,8 @@ struct usb_tt;
408 * @autosuspend_disabled: autosuspend disabled by the user 418 * @autosuspend_disabled: autosuspend disabled by the user
409 * @autoresume_disabled: autoresume disabled by the user 419 * @autoresume_disabled: autoresume disabled by the user
410 * @skip_sys_resume: skip the next system resume 420 * @skip_sys_resume: skip the next system resume
421 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
422 * specific data for the device.
411 * 423 *
412 * Notes: 424 * Notes:
413 * Usbcore drivers should not set usbdev->state directly. Instead use 425 * Usbcore drivers should not set usbdev->state directly. Instead use
@@ -476,6 +488,7 @@ struct usb_device {
476 488
477#ifdef CONFIG_PM 489#ifdef CONFIG_PM
478 struct delayed_work autosuspend; 490 struct delayed_work autosuspend;
491 struct work_struct autoresume;
479 struct mutex pm_mutex; 492 struct mutex pm_mutex;
480 493
481 unsigned long last_busy; 494 unsigned long last_busy;
@@ -505,6 +518,7 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
505 518
506/* USB port reset for device reinitialization */ 519/* USB port reset for device reinitialization */
507extern int usb_reset_device(struct usb_device *dev); 520extern int usb_reset_device(struct usb_device *dev);
521extern void usb_queue_reset_device(struct usb_interface *dev);
508 522
509extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); 523extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
510 524
@@ -513,6 +527,8 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
513extern int usb_autopm_set_interface(struct usb_interface *intf); 527extern int usb_autopm_set_interface(struct usb_interface *intf);
514extern int usb_autopm_get_interface(struct usb_interface *intf); 528extern int usb_autopm_get_interface(struct usb_interface *intf);
515extern void usb_autopm_put_interface(struct usb_interface *intf); 529extern void usb_autopm_put_interface(struct usb_interface *intf);
530extern int usb_autopm_get_interface_async(struct usb_interface *intf);
531extern void usb_autopm_put_interface_async(struct usb_interface *intf);
516 532
517static inline void usb_autopm_enable(struct usb_interface *intf) 533static inline void usb_autopm_enable(struct usb_interface *intf)
518{ 534{
@@ -539,8 +555,13 @@ static inline int usb_autopm_set_interface(struct usb_interface *intf)
539static inline int usb_autopm_get_interface(struct usb_interface *intf) 555static inline int usb_autopm_get_interface(struct usb_interface *intf)
540{ return 0; } 556{ return 0; }
541 557
558static inline int usb_autopm_get_interface_async(struct usb_interface *intf)
559{ return 0; }
560
542static inline void usb_autopm_put_interface(struct usb_interface *intf) 561static inline void usb_autopm_put_interface(struct usb_interface *intf)
543{ } 562{ }
563static inline void usb_autopm_put_interface_async(struct usb_interface *intf)
564{ }
544static inline void usb_autopm_enable(struct usb_interface *intf) 565static inline void usb_autopm_enable(struct usb_interface *intf)
545{ } 566{ }
546static inline void usb_autopm_disable(struct usb_interface *intf) 567static inline void usb_autopm_disable(struct usb_interface *intf)
@@ -1050,7 +1071,7 @@ struct usb_device_driver {
1050 void (*disconnect) (struct usb_device *udev); 1071 void (*disconnect) (struct usb_device *udev);
1051 1072
1052 int (*suspend) (struct usb_device *udev, pm_message_t message); 1073 int (*suspend) (struct usb_device *udev, pm_message_t message);
1053 int (*resume) (struct usb_device *udev); 1074 int (*resume) (struct usb_device *udev, pm_message_t message);
1054 struct usbdrv_wrap drvwrap; 1075 struct usbdrv_wrap drvwrap;
1055 unsigned int supports_autosuspend:1; 1076 unsigned int supports_autosuspend:1;
1056}; 1077};
@@ -1321,7 +1342,7 @@ struct urb {
1321 struct kref kref; /* reference count of the URB */ 1342 struct kref kref; /* reference count of the URB */
1322 void *hcpriv; /* private data for host controller */ 1343 void *hcpriv; /* private data for host controller */
1323 atomic_t use_count; /* concurrent submissions counter */ 1344 atomic_t use_count; /* concurrent submissions counter */
1324 u8 reject; /* submissions will fail */ 1345 atomic_t reject; /* submissions will fail */
1325 int unlinked; /* unlink error code */ 1346 int unlinked; /* unlink error code */
1326 1347
1327 /* public: documented fields in the urb that can be used by drivers */ 1348 /* public: documented fields in the urb that can be used by drivers */
@@ -1466,6 +1487,7 @@ extern void usb_poison_urb(struct urb *urb);
1466extern void usb_unpoison_urb(struct urb *urb); 1487extern void usb_unpoison_urb(struct urb *urb);
1467extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1488extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1468extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1489extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1490extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
1469extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1491extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1470extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1492extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1471extern void usb_unanchor_urb(struct urb *urb); 1493extern void usb_unanchor_urb(struct urb *urb);
@@ -1722,10 +1744,6 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1722 1744
1723#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ 1745#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
1724 format "\n" , ## arg) 1746 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 1747
1730#endif /* __KERNEL__ */ 1748#endif /* __KERNEL__ */
1731 1749