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.h33
1 files changed, 15 insertions, 18 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index a34fa89f1474..e101a2d04d75 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -331,6 +331,7 @@ struct usb_bus {
331 u8 otg_port; /* 0, or number of OTG/HNP port */ 331 u8 otg_port; /* 0, or number of OTG/HNP port */
332 unsigned is_b_host:1; /* true during some HNP roleswitches */ 332 unsigned is_b_host:1; /* true during some HNP roleswitches */
333 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ 333 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
334 unsigned sg_tablesize; /* 0 or largest number of sg list entries */
334 335
335 int devnum_next; /* Next open device number in 336 int devnum_next; /* Next open device number in
336 * round-robin allocation */ 337 * round-robin allocation */
@@ -428,11 +429,9 @@ struct usb_tt;
428 * @last_busy: time of last use 429 * @last_busy: time of last use
429 * @autosuspend_delay: in jiffies 430 * @autosuspend_delay: in jiffies
430 * @connect_time: time device was first connected 431 * @connect_time: time device was first connected
431 * @auto_pm: autosuspend/resume in progress
432 * @do_remote_wakeup: remote wakeup should be enabled 432 * @do_remote_wakeup: remote wakeup should be enabled
433 * @reset_resume: needs reset instead of resume 433 * @reset_resume: needs reset instead of resume
434 * @autosuspend_disabled: autosuspend disabled by the user 434 * @autosuspend_disabled: autosuspend disabled by the user
435 * @autoresume_disabled: autoresume disabled by the user
436 * @skip_sys_resume: skip the next system resume 435 * @skip_sys_resume: skip the next system resume
437 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 436 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
438 * specific data for the device. 437 * specific data for the device.
@@ -513,11 +512,9 @@ struct usb_device {
513 int autosuspend_delay; 512 int autosuspend_delay;
514 unsigned long connect_time; 513 unsigned long connect_time;
515 514
516 unsigned auto_pm:1;
517 unsigned do_remote_wakeup:1; 515 unsigned do_remote_wakeup:1;
518 unsigned reset_resume:1; 516 unsigned reset_resume:1;
519 unsigned autosuspend_disabled:1; 517 unsigned autosuspend_disabled:1;
520 unsigned autoresume_disabled:1;
521 unsigned skip_sys_resume:1; 518 unsigned skip_sys_resume:1;
522#endif 519#endif
523 struct wusb_dev *wusb_dev; 520 struct wusb_dev *wusb_dev;
@@ -543,22 +540,20 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
543 540
544/* USB autosuspend and autoresume */ 541/* USB autosuspend and autoresume */
545#ifdef CONFIG_USB_SUSPEND 542#ifdef CONFIG_USB_SUSPEND
546extern int usb_autopm_set_interface(struct usb_interface *intf);
547extern int usb_autopm_get_interface(struct usb_interface *intf); 543extern int usb_autopm_get_interface(struct usb_interface *intf);
548extern void usb_autopm_put_interface(struct usb_interface *intf); 544extern void usb_autopm_put_interface(struct usb_interface *intf);
549extern int usb_autopm_get_interface_async(struct usb_interface *intf); 545extern int usb_autopm_get_interface_async(struct usb_interface *intf);
550extern void usb_autopm_put_interface_async(struct usb_interface *intf); 546extern void usb_autopm_put_interface_async(struct usb_interface *intf);
551 547
552static inline void usb_autopm_enable(struct usb_interface *intf) 548static inline void usb_autopm_get_interface_no_resume(
549 struct usb_interface *intf)
553{ 550{
554 atomic_set(&intf->pm_usage_cnt, 0); 551 atomic_inc(&intf->pm_usage_cnt);
555 usb_autopm_set_interface(intf);
556} 552}
557 553static inline void usb_autopm_put_interface_no_suspend(
558static inline void usb_autopm_disable(struct usb_interface *intf) 554 struct usb_interface *intf)
559{ 555{
560 atomic_set(&intf->pm_usage_cnt, 1); 556 atomic_dec(&intf->pm_usage_cnt);
561 usb_autopm_set_interface(intf);
562} 557}
563 558
564static inline void usb_mark_last_busy(struct usb_device *udev) 559static inline void usb_mark_last_busy(struct usb_device *udev)
@@ -568,12 +563,8 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
568 563
569#else 564#else
570 565
571static inline int usb_autopm_set_interface(struct usb_interface *intf)
572{ return 0; }
573
574static inline int usb_autopm_get_interface(struct usb_interface *intf) 566static inline int usb_autopm_get_interface(struct usb_interface *intf)
575{ return 0; } 567{ return 0; }
576
577static inline int usb_autopm_get_interface_async(struct usb_interface *intf) 568static inline int usb_autopm_get_interface_async(struct usb_interface *intf)
578{ return 0; } 569{ return 0; }
579 570
@@ -581,9 +572,11 @@ static inline void usb_autopm_put_interface(struct usb_interface *intf)
581{ } 572{ }
582static inline void usb_autopm_put_interface_async(struct usb_interface *intf) 573static inline void usb_autopm_put_interface_async(struct usb_interface *intf)
583{ } 574{ }
584static inline void usb_autopm_enable(struct usb_interface *intf) 575static inline void usb_autopm_get_interface_no_resume(
576 struct usb_interface *intf)
585{ } 577{ }
586static inline void usb_autopm_disable(struct usb_interface *intf) 578static inline void usb_autopm_put_interface_no_suspend(
579 struct usb_interface *intf)
587{ } 580{ }
588static inline void usb_mark_last_busy(struct usb_device *udev) 581static inline void usb_mark_last_busy(struct usb_device *udev)
589{ } 582{ }
@@ -626,6 +619,10 @@ extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev,
626 unsigned ifnum); 619 unsigned ifnum);
627extern struct usb_host_interface *usb_altnum_to_altsetting( 620extern struct usb_host_interface *usb_altnum_to_altsetting(
628 const struct usb_interface *intf, unsigned int altnum); 621 const struct usb_interface *intf, unsigned int altnum);
622extern struct usb_host_interface *usb_find_alt_setting(
623 struct usb_host_config *config,
624 unsigned int iface_num,
625 unsigned int alt_num);
629 626
630 627
631/** 628/**