generic.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * drivers/usb/generic.c - generic driver for USB devices (not interfaces)
  3. *
  4. * (C) Copyright 2005 Greg Kroah-Hartman <gregkh@suse.de>
  5. *
  6. * based on drivers/usb/usb.c which had the following copyrights:
  7. * (C) Copyright Linus Torvalds 1999
  8. * (C) Copyright Johannes Erdfelt 1999-2001
  9. * (C) Copyright Andreas Gal 1999
  10. * (C) Copyright Gregory P. Smith 1999
  11. * (C) Copyright Deti Fliegl 1999 (new USB architecture)
  12. * (C) Copyright Randy Dunlap 2000
  13. * (C) Copyright David Brownell 2000-2004
  14. * (C) Copyright Yggdrasil Computing, Inc. 2000
  15. * (usb_device_id matching changes by Adam J. Richter)
  16. * (C) Copyright Greg Kroah-Hartman 2002-2003
  17. *
  18. */
  19. #include <linux/config.h>
  20. #include <linux/usb.h>
  21. #include "usb.h"
  22. static int generic_probe(struct device *dev)
  23. {
  24. return 0;
  25. }
  26. static int generic_remove(struct device *dev)
  27. {
  28. struct usb_device *udev = to_usb_device(dev);
  29. /* if this is only an unbind, not a physical disconnect, then
  30. * unconfigure the device */
  31. if (udev->state == USB_STATE_CONFIGURED)
  32. usb_set_configuration(udev, 0);
  33. /* in case the call failed or the device was suspended */
  34. if (udev->state >= USB_STATE_CONFIGURED)
  35. usb_disable_device(udev, 0);
  36. return 0;
  37. }
  38. struct device_driver usb_generic_driver = {
  39. .owner = THIS_MODULE,
  40. .name = "usb",
  41. .bus = &usb_bus_type,
  42. .probe = generic_probe,
  43. .remove = generic_remove,
  44. };
  45. /* Fun hack to determine if the struct device is a
  46. * usb device or a usb interface. */
  47. int usb_generic_driver_data;