5 /* Functions local to drivers/usb/core/ */
7 extern int usb_create_sysfs_dev_files(struct usb_device *dev);
8 extern void usb_remove_sysfs_dev_files(struct usb_device *dev);
9 extern void usb_create_sysfs_intf_files(struct usb_interface *intf);
10 extern void usb_remove_sysfs_intf_files(struct usb_interface *intf);
11 extern int usb_create_ep_devs(struct device *parent,
12 struct usb_host_endpoint *endpoint,
13 struct usb_device *udev);
14 extern void usb_remove_ep_devs(struct usb_host_endpoint *endpoint);
16 extern void usb_enable_endpoint(struct usb_device *dev,
17 struct usb_host_endpoint *ep, bool reset_toggle);
18 extern void usb_enable_interface(struct usb_device *dev,
19 struct usb_interface *intf, bool reset_toggles);
20 extern void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr,
22 extern void usb_disable_interface(struct usb_device *dev,
23 struct usb_interface *intf, bool reset_hardware);
24 extern void usb_release_interface_cache(struct kref *ref);
25 extern void usb_disable_device(struct usb_device *dev, int skip_ep0);
26 extern int usb_deauthorize_device(struct usb_device *);
27 extern int usb_authorize_device(struct usb_device *);
28 extern void usb_detect_quirks(struct usb_device *udev);
29 extern int usb_remove_device(struct usb_device *udev);
31 extern int usb_get_device_descriptor(struct usb_device *dev,
33 extern int usb_get_bos_descriptor(struct usb_device *dev);
34 extern void usb_release_bos_descriptor(struct usb_device *dev);
35 extern char *usb_cache_string(struct usb_device *udev, int index);
36 extern int usb_set_configuration(struct usb_device *dev, int configuration);
37 extern int usb_choose_configuration(struct usb_device *udev);
39 extern void usb_kick_khubd(struct usb_device *dev);
40 extern int usb_match_device(struct usb_device *dev,
41 const struct usb_device_id *id);
42 extern void usb_forced_unbind_intf(struct usb_interface *intf);
43 extern void usb_rebind_intf(struct usb_interface *intf);
45 extern int usb_hub_claim_port(struct usb_device *hdev, unsigned port,
46 struct dev_state *owner);
47 extern int usb_hub_release_port(struct usb_device *hdev, unsigned port,
48 struct dev_state *owner);
49 extern void usb_hub_release_all_ports(struct usb_device *hdev,
50 struct dev_state *owner);
51 extern bool usb_device_is_owned(struct usb_device *udev);
53 extern int usb_hub_init(void);
54 extern void usb_hub_cleanup(void);
55 extern int usb_major_init(void);
56 extern void usb_major_cleanup(void);
60 extern int usb_suspend(struct device *dev, pm_message_t msg);
61 extern int usb_resume(struct device *dev, pm_message_t msg);
62 extern int usb_resume_complete(struct device *dev);
64 extern int usb_port_suspend(struct usb_device *dev, pm_message_t msg);
65 extern int usb_port_resume(struct usb_device *dev, pm_message_t msg);
69 static inline int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
74 static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg)
81 #ifdef CONFIG_USB_SUSPEND
83 extern void usb_autosuspend_device(struct usb_device *udev);
84 extern int usb_autoresume_device(struct usb_device *udev);
85 extern int usb_remote_wakeup(struct usb_device *dev);
86 extern int usb_runtime_suspend(struct device *dev);
87 extern int usb_runtime_resume(struct device *dev);
88 extern int usb_runtime_idle(struct device *dev);
89 extern int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable);
93 #define usb_autosuspend_device(udev) do {} while (0)
94 static inline int usb_autoresume_device(struct usb_device *udev)
99 static inline int usb_remote_wakeup(struct usb_device *udev)
104 static inline int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable)
110 extern struct bus_type usb_bus_type;
111 extern struct device_type usb_device_type;
112 extern struct device_type usb_if_device_type;
113 extern struct device_type usb_ep_device_type;
114 extern struct usb_device_driver usb_generic_driver;
116 static inline int is_usb_device(const struct device *dev)
118 return dev->type == &usb_device_type;
121 static inline int is_usb_interface(const struct device *dev)
123 return dev->type == &usb_if_device_type;
126 static inline int is_usb_endpoint(const struct device *dev)
128 return dev->type == &usb_ep_device_type;
131 /* Do the same for device drivers and interface drivers. */
133 static inline int is_usb_device_driver(struct device_driver *drv)
135 return container_of(drv, struct usbdrv_wrap, driver)->
139 /* for labeling diagnostics */
140 extern const char *usbcore_name;
143 extern const struct attribute_group *usb_device_groups[];
144 extern const struct attribute_group *usb_interface_groups[];
147 extern struct mutex usbfs_mutex;
148 extern struct usb_driver usbfs_driver;
149 extern const struct file_operations usbfs_devices_fops;
150 extern const struct file_operations usbdev_file_operations;
151 extern void usbfs_conn_disc_event(void);
153 extern int usb_devio_init(void);
154 extern void usb_devio_cleanup(void);
156 /* internal notify stuff */
157 extern void usb_notify_add_device(struct usb_device *udev);
158 extern void usb_notify_remove_device(struct usb_device *udev);
159 extern void usb_notify_add_bus(struct usb_bus *ubus);
160 extern void usb_notify_remove_bus(struct usb_bus *ubus);
163 extern int usb_acpi_register(void);
164 extern void usb_acpi_unregister(void);
166 static inline int usb_acpi_register(void) { return 0; };
167 static inline void usb_acpi_unregister(void) { };