usb.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 char *usb_cache_string(struct usb_device *udev, int index);
  14. extern int usb_set_configuration(struct usb_device *dev, int configuration);
  15. extern void usb_kick_khubd(struct usb_device *dev);
  16. extern void usb_suspend_root_hub(struct usb_device *hdev);
  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. extern int usb_suspend_device(struct usb_device *dev);
  25. extern int usb_resume_device(struct usb_device *dev);
  26. extern struct device_driver usb_generic_driver;
  27. extern int usb_generic_driver_data;
  28. extern int usb_device_match(struct device *dev, struct device_driver *drv);
  29. /* Interfaces and their "power state" are owned by usbcore */
  30. static inline void mark_active(struct usb_interface *f)
  31. {
  32. f->dev.power.power_state.event = PM_EVENT_ON;
  33. }
  34. static inline void mark_quiesced(struct usb_interface *f)
  35. {
  36. f->dev.power.power_state.event = PM_EVENT_FREEZE;
  37. }
  38. static inline int is_active(struct usb_interface *f)
  39. {
  40. return f->dev.power.power_state.event == PM_EVENT_ON;
  41. }
  42. /* for labeling diagnostics */
  43. extern const char *usbcore_name;
  44. /* usbfs stuff */
  45. extern struct usb_driver usbfs_driver;
  46. extern struct file_operations usbfs_devices_fops;
  47. extern struct file_operations usbfs_device_file_operations;
  48. extern void usbfs_conn_disc_event(void);
  49. extern int usbdev_init(void);
  50. extern void usbdev_cleanup(void);
  51. struct dev_state {
  52. struct list_head list; /* state list */
  53. struct usb_device *dev;
  54. struct file *file;
  55. spinlock_t lock; /* protects the async urb lists */
  56. struct list_head async_pending;
  57. struct list_head async_completed;
  58. wait_queue_head_t wait; /* wake up if a request completed */
  59. unsigned int discsignr;
  60. pid_t disc_pid;
  61. uid_t disc_uid, disc_euid;
  62. void __user *disccontext;
  63. unsigned long ifclaimed;
  64. };
  65. /* internal notify stuff */
  66. extern void usb_notify_add_device(struct usb_device *udev);
  67. extern void usb_notify_remove_device(struct usb_device *udev);
  68. extern void usb_notify_add_bus(struct usb_bus *ubus);
  69. extern void usb_notify_remove_bus(struct usb_bus *ubus);