usb.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* Functions local to drivers/usb/core/ */
  2. extern void usb_create_sysfs_dev_files (struct usb_device *dev);
  3. extern void usb_remove_sysfs_dev_files (struct usb_device *dev);
  4. extern void usb_create_sysfs_intf_files (struct usb_interface *intf);
  5. extern void usb_remove_sysfs_intf_files (struct usb_interface *intf);
  6. extern void usb_disable_endpoint (struct usb_device *dev, unsigned int epaddr);
  7. extern void usb_disable_interface (struct usb_device *dev,
  8. struct usb_interface *intf);
  9. extern void usb_release_interface_cache(struct kref *ref);
  10. extern void usb_disable_device (struct usb_device *dev, int skip_ep0);
  11. extern int usb_get_device_descriptor(struct usb_device *dev,
  12. unsigned int size);
  13. extern int usb_set_configuration(struct usb_device *dev, int configuration);
  14. extern void usb_lock_all_devices(void);
  15. extern void usb_unlock_all_devices(void);
  16. extern void usb_kick_khubd(struct usb_device *dev);
  17. extern void usb_suspend_root_hub(struct usb_device *hdev);
  18. extern void usb_resume_root_hub(struct usb_device *dev);
  19. extern int usb_hub_init(void);
  20. extern void usb_hub_cleanup(void);
  21. extern int usb_major_init(void);
  22. extern void usb_major_cleanup(void);
  23. extern int usb_host_init(void);
  24. extern void usb_host_cleanup(void);
  25. /* Interfaces and their "power state" are owned by usbcore */
  26. static inline void mark_active(struct usb_interface *f)
  27. {
  28. f->dev.power.power_state.event = PM_EVENT_ON;
  29. }
  30. static inline void mark_quiesced(struct usb_interface *f)
  31. {
  32. f->dev.power.power_state.event = PM_EVENT_FREEZE;
  33. }
  34. static inline int is_active(struct usb_interface *f)
  35. {
  36. return f->dev.power.power_state.event == PM_EVENT_ON;
  37. }
  38. /* for labeling diagnostics */
  39. extern const char *usbcore_name;
  40. /* usbfs stuff */
  41. extern struct usb_driver usbfs_driver;
  42. extern struct file_operations usbfs_devices_fops;
  43. extern struct file_operations usbfs_device_file_operations;
  44. extern void usbfs_conn_disc_event(void);
  45. extern int usbdev_init(void);
  46. extern void usbdev_cleanup(void);
  47. extern void usbdev_add(struct usb_device *dev);
  48. extern void usbdev_remove(struct usb_device *dev);
  49. extern struct usb_device *usbdev_lookup_minor(int minor);
  50. struct dev_state {
  51. struct list_head list; /* state list */
  52. struct usb_device *dev;
  53. struct file *file;
  54. spinlock_t lock; /* protects the async urb lists */
  55. struct list_head async_pending;
  56. struct list_head async_completed;
  57. wait_queue_head_t wait; /* wake up if a request completed */
  58. unsigned int discsignr;
  59. pid_t disc_pid;
  60. uid_t disc_uid, disc_euid;
  61. void __user *disccontext;
  62. unsigned long ifclaimed;
  63. };