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