blob: 4647e1ebc68d08fcfadae61bd9e0f4310c23abc0 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* Functions local to drivers/usb/core/ */
2
3extern void usb_create_sysfs_dev_files (struct usb_device *dev);
4extern void usb_remove_sysfs_dev_files (struct usb_device *dev);
5extern void usb_create_sysfs_intf_files (struct usb_interface *intf);
6extern void usb_remove_sysfs_intf_files (struct usb_interface *intf);
7
8extern void usb_disable_endpoint (struct usb_device *dev, unsigned int epaddr);
9extern void usb_disable_interface (struct usb_device *dev,
10 struct usb_interface *intf);
11extern void usb_release_interface_cache(struct kref *ref);
12extern void usb_disable_device (struct usb_device *dev, int skip_ep0);
13
14extern int usb_get_device_descriptor(struct usb_device *dev,
15 unsigned int size);
Alan Stern4f62efe2005-10-24 16:24:14 -040016extern char *usb_cache_string(struct usb_device *udev, int index);
Linus Torvalds1da177e2005-04-16 15:20:36 -070017extern int usb_set_configuration(struct usb_device *dev, int configuration);
18
Linus Torvalds1da177e2005-04-16 15:20:36 -070019extern void usb_kick_khubd(struct usb_device *dev);
David Brownell979d5192005-09-22 22:32:24 -070020extern void usb_suspend_root_hub(struct usb_device *hdev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070021extern void usb_resume_root_hub(struct usb_device *dev);
22
Greg KH6d5e8252005-04-18 17:39:24 -070023extern int usb_hub_init(void);
24extern void usb_hub_cleanup(void);
25extern int usb_major_init(void);
26extern void usb_major_cleanup(void);
27extern int usb_host_init(void);
28extern void usb_host_cleanup(void);
29
David Brownell5edbfb72005-09-22 22:45:26 -070030extern int usb_suspend_device(struct usb_device *dev);
31extern int usb_resume_device(struct usb_device *dev);
32
Greg Kroah-Hartmanddae41b2005-11-16 13:41:28 -080033extern struct device_driver usb_generic_driver;
34extern int usb_generic_driver_data;
35extern int usb_device_match(struct device *dev, struct device_driver *drv);
David Brownell5edbfb72005-09-22 22:45:26 -070036
David Brownelldb690872005-09-13 19:56:33 -070037/* Interfaces and their "power state" are owned by usbcore */
38
39static inline void mark_active(struct usb_interface *f)
40{
41 f->dev.power.power_state.event = PM_EVENT_ON;
42}
43
44static inline void mark_quiesced(struct usb_interface *f)
45{
46 f->dev.power.power_state.event = PM_EVENT_FREEZE;
47}
48
49static inline int is_active(struct usb_interface *f)
50{
51 return f->dev.power.power_state.event == PM_EVENT_ON;
52}
53
54
Linus Torvalds1da177e2005-04-16 15:20:36 -070055/* for labeling diagnostics */
56extern const char *usbcore_name;
57
58/* usbfs stuff */
59extern struct usb_driver usbfs_driver;
60extern struct file_operations usbfs_devices_fops;
61extern struct file_operations usbfs_device_file_operations;
62extern void usbfs_conn_disc_event(void);
63
Kay Sieversfbf82fd2005-07-31 01:05:53 +020064extern int usbdev_init(void);
65extern void usbdev_cleanup(void);
Greg KH6d5e8252005-04-18 17:39:24 -070066
Linus Torvalds1da177e2005-04-16 15:20:36 -070067struct dev_state {
68 struct list_head list; /* state list */
69 struct usb_device *dev;
70 struct file *file;
71 spinlock_t lock; /* protects the async urb lists */
72 struct list_head async_pending;
73 struct list_head async_completed;
74 wait_queue_head_t wait; /* wake up if a request completed */
75 unsigned int discsignr;
Linus Torvaldsd7dd8a72005-10-10 16:31:30 -070076 pid_t disc_pid;
77 uid_t disc_uid, disc_euid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 void __user *disccontext;
79 unsigned long ifclaimed;
80};
81
Greg Kroah-Hartman3099e752005-06-20 21:15:16 -070082/* internal notify stuff */
83extern void usb_notify_add_device(struct usb_device *udev);
84extern void usb_notify_remove_device(struct usb_device *udev);
85extern void usb_notify_add_bus(struct usb_bus *ubus);
86extern void usb_notify_remove_bus(struct usb_bus *ubus);
87