usb.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_resume_root_hub(struct usb_device *dev);
  18. extern int usb_hub_init(void);
  19. extern void usb_hub_cleanup(void);
  20. extern int usb_major_init(void);
  21. extern void usb_major_cleanup(void);
  22. extern int usb_host_init(void);
  23. extern void usb_host_cleanup(void);
  24. /* Interfaces and their "power state" are owned by usbcore */
  25. static inline void mark_active(struct usb_interface *f)
  26. {
  27. f->dev.power.power_state.event = PM_EVENT_ON;
  28. }
  29. static inline void mark_quiesced(struct usb_interface *f)
  30. {
  31. f->dev.power.power_state.event = PM_EVENT_FREEZE;
  32. }
  33. static inline int is_active(struct usb_interface *f)
  34. {
  35. return f->dev.power.power_state.event == PM_EVENT_ON;
  36. }
  37. /* for labeling diagnostics */
  38. extern const char *usbcore_name;
  39. /* usbfs stuff */
  40. extern struct usb_driver usbfs_driver;
  41. extern struct file_operations usbfs_devices_fops;
  42. extern struct file_operations usbfs_device_file_operations;
  43. extern void usbfs_conn_disc_event(void);
  44. extern int usbdev_init(void);
  45. extern void usbdev_cleanup(void);
  46. extern void usbdev_add(struct usb_device *dev);
  47. extern void usbdev_remove(struct usb_device *dev);
  48. extern struct usb_device *usbdev_lookup_minor(int minor);
  49. struct dev_state {
  50. struct list_head list; /* state list */
  51. struct usb_device *dev;
  52. struct file *file;
  53. spinlock_t lock; /* protects the async urb lists */
  54. struct list_head async_pending;
  55. struct list_head async_completed;
  56. wait_queue_head_t wait; /* wake up if a request completed */
  57. unsigned int discsignr;
  58. pid_t disc_pid;
  59. uid_t disc_uid, disc_euid;
  60. void __user *disccontext;
  61. unsigned long ifclaimed;
  62. };