]>
Commit | Line | Data |
---|---|---|
65bfd296 AS |
1 | #include <linux/pm.h> |
2 | ||
1da177e4 LT |
3 | /* Functions local to drivers/usb/core/ */ |
4 | ||
84cca820 GKH |
5 | extern int usb_create_sysfs_dev_files(struct usb_device *dev); |
6 | extern void usb_remove_sysfs_dev_files(struct usb_device *dev); | |
7 | extern int usb_create_sysfs_intf_files(struct usb_interface *intf); | |
8 | extern void usb_remove_sysfs_intf_files(struct usb_interface *intf); | |
3b23dd6f | 9 | extern int usb_create_ep_devs(struct device *parent, |
84cca820 | 10 | struct usb_host_endpoint *endpoint, |
84412f62 | 11 | struct usb_device *udev); |
3b23dd6f | 12 | extern void usb_remove_ep_devs(struct usb_host_endpoint *endpoint); |
1da177e4 | 13 | |
bdd016ba | 14 | extern void usb_enable_endpoint(struct usb_device *dev, |
2caf7fcd AS |
15 | struct usb_host_endpoint *ep, bool reset_toggle); |
16 | extern void usb_enable_interface(struct usb_device *dev, | |
17 | struct usb_interface *intf, bool reset_toggles); | |
ddeac4e7 AS |
18 | extern void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr, |
19 | bool reset_hardware); | |
84cca820 | 20 | extern void usb_disable_interface(struct usb_device *dev, |
ddeac4e7 | 21 | struct usb_interface *intf, bool reset_hardware); |
1da177e4 | 22 | extern void usb_release_interface_cache(struct kref *ref); |
84cca820 GKH |
23 | extern void usb_disable_device(struct usb_device *dev, int skip_ep0); |
24 | extern int usb_deauthorize_device(struct usb_device *); | |
25 | extern int usb_authorize_device(struct usb_device *); | |
7ceec1f1 | 26 | extern void usb_detect_quirks(struct usb_device *udev); |
1da177e4 LT |
27 | |
28 | extern int usb_get_device_descriptor(struct usb_device *dev, | |
29 | unsigned int size); | |
4f62efe6 | 30 | extern char *usb_cache_string(struct usb_device *udev, int index); |
1da177e4 | 31 | extern int usb_set_configuration(struct usb_device *dev, int configuration); |
b5ea060f | 32 | extern int usb_choose_configuration(struct usb_device *udev); |
1da177e4 | 33 | |
1da177e4 | 34 | extern void usb_kick_khubd(struct usb_device *dev); |
bb417020 GKH |
35 | extern int usb_match_device(struct usb_device *dev, |
36 | const struct usb_device_id *id); | |
78d9a487 AS |
37 | extern void usb_forced_unbind_intf(struct usb_interface *intf); |
38 | extern void usb_rebind_intf(struct usb_interface *intf); | |
1da177e4 | 39 | |
6d5e8254 GKH |
40 | extern int usb_hub_init(void); |
41 | extern void usb_hub_cleanup(void); | |
42 | extern int usb_major_init(void); | |
43 | extern void usb_major_cleanup(void); | |
44 | extern int usb_host_init(void); | |
45 | extern void usb_host_cleanup(void); | |
46 | ||
d388dab7 AS |
47 | #ifdef CONFIG_PM |
48 | ||
f2189c47 | 49 | extern int usb_suspend(struct device *dev, pm_message_t msg); |
65bfd296 | 50 | extern int usb_resume(struct device *dev, pm_message_t msg); |
f2189c47 | 51 | |
718efa64 | 52 | extern void usb_autosuspend_work(struct work_struct *work); |
9ac39f28 | 53 | extern void usb_autoresume_work(struct work_struct *work); |
65bfd296 AS |
54 | extern int usb_port_suspend(struct usb_device *dev, pm_message_t msg); |
55 | extern int usb_port_resume(struct usb_device *dev, pm_message_t msg); | |
6b157c9b AS |
56 | extern int usb_external_suspend_device(struct usb_device *udev, |
57 | pm_message_t msg); | |
65bfd296 AS |
58 | extern int usb_external_resume_device(struct usb_device *udev, |
59 | pm_message_t msg); | |
5edbfb7c | 60 | |
e0318ebf AS |
61 | static inline void usb_pm_lock(struct usb_device *udev) |
62 | { | |
63 | mutex_lock_nested(&udev->pm_mutex, udev->level); | |
64 | } | |
65 | ||
66 | static inline void usb_pm_unlock(struct usb_device *udev) | |
67 | { | |
68 | mutex_unlock(&udev->pm_mutex); | |
69 | } | |
70 | ||
d388dab7 AS |
71 | #else |
72 | ||
65bfd296 | 73 | static inline int usb_port_suspend(struct usb_device *udev, pm_message_t msg) |
4956eccd AS |
74 | { |
75 | return 0; | |
76 | } | |
77 | ||
65bfd296 | 78 | static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg) |
4956eccd AS |
79 | { |
80 | return 0; | |
81 | } | |
82 | ||
e0318ebf AS |
83 | static inline void usb_pm_lock(struct usb_device *udev) {} |
84 | static inline void usb_pm_unlock(struct usb_device *udev) {} | |
d388dab7 AS |
85 | |
86 | #endif | |
87 | ||
645daaab AS |
88 | #ifdef CONFIG_USB_SUSPEND |
89 | ||
94fcda1f | 90 | extern void usb_autosuspend_device(struct usb_device *udev); |
19c26239 | 91 | extern void usb_try_autosuspend_device(struct usb_device *udev); |
94fcda1f | 92 | extern int usb_autoresume_device(struct usb_device *udev); |
645daaab AS |
93 | |
94 | #else | |
95 | ||
19c26239 AS |
96 | #define usb_autosuspend_device(udev) do {} while (0) |
97 | #define usb_try_autosuspend_device(udev) do {} while (0) | |
94fcda1f | 98 | static inline int usb_autoresume_device(struct usb_device *udev) |
e0318ebf AS |
99 | { |
100 | return 0; | |
101 | } | |
645daaab AS |
102 | |
103 | #endif | |
104 | ||
bd859281 | 105 | extern struct workqueue_struct *ksuspend_usb_wq; |
36e56a34 | 106 | extern struct bus_type usb_bus_type; |
9f8b17e6 KS |
107 | extern struct device_type usb_device_type; |
108 | extern struct device_type usb_if_device_type; | |
8bb54ab5 AS |
109 | extern struct usb_device_driver usb_generic_driver; |
110 | ||
095bc335 | 111 | static inline int is_usb_device(const struct device *dev) |
8bb54ab5 | 112 | { |
9f8b17e6 | 113 | return dev->type == &usb_device_type; |
8bb54ab5 AS |
114 | } |
115 | ||
116 | /* Do the same for device drivers and interface drivers. */ | |
117 | ||
118 | static inline int is_usb_device_driver(struct device_driver *drv) | |
119 | { | |
120 | return container_of(drv, struct usbdrv_wrap, driver)-> | |
121 | for_devices; | |
122 | } | |
5edbfb7c | 123 | |
db690874 DB |
124 | /* Interfaces and their "power state" are owned by usbcore */ |
125 | ||
126 | static inline void mark_active(struct usb_interface *f) | |
127 | { | |
4d064c08 | 128 | f->is_active = 1; |
db690874 DB |
129 | } |
130 | ||
131 | static inline void mark_quiesced(struct usb_interface *f) | |
132 | { | |
4d064c08 | 133 | f->is_active = 0; |
db690874 DB |
134 | } |
135 | ||
095bc335 | 136 | static inline int is_active(const struct usb_interface *f) |
db690874 | 137 | { |
4d064c08 | 138 | return f->is_active; |
db690874 DB |
139 | } |
140 | ||
141 | ||
1da177e4 LT |
142 | /* for labeling diagnostics */ |
143 | extern const char *usbcore_name; | |
144 | ||
2e5f10e4 AS |
145 | /* sysfs stuff */ |
146 | extern struct attribute_group *usb_device_groups[]; | |
147 | extern struct attribute_group *usb_interface_groups[]; | |
148 | ||
1da177e4 | 149 | /* usbfs stuff */ |
4a2a8a2c | 150 | extern struct mutex usbfs_mutex; |
1da177e4 | 151 | extern struct usb_driver usbfs_driver; |
066202dd | 152 | extern const struct file_operations usbfs_devices_fops; |
9f8b17e6 | 153 | extern const struct file_operations usbdev_file_operations; |
1da177e4 LT |
154 | extern void usbfs_conn_disc_event(void); |
155 | ||
9f8b17e6 KS |
156 | extern int usb_devio_init(void); |
157 | extern void usb_devio_cleanup(void); | |
6d5e8254 | 158 | |
3099e75a GKH |
159 | /* internal notify stuff */ |
160 | extern void usb_notify_add_device(struct usb_device *udev); | |
161 | extern void usb_notify_remove_device(struct usb_device *udev); | |
162 | extern void usb_notify_add_bus(struct usb_bus *ubus); | |
163 | extern void usb_notify_remove_bus(struct usb_bus *ubus); | |
164 |