Alan Stern | 36e56a3 | 2006-07-01 22:08:06 -0400 | [diff] [blame] | 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 | |
| 20 | #include <linux/config.h> |
| 21 | #include <linux/usb.h> |
| 22 | #include "usb.h" |
| 23 | |
Alan Stern | 8bb54ab | 2006-07-01 22:08:49 -0400 | [diff] [blame^] | 24 | static int generic_probe(struct usb_device *udev) |
Alan Stern | 36e56a3 | 2006-07-01 22:08:06 -0400 | [diff] [blame] | 25 | { |
| 26 | return 0; |
| 27 | } |
Alan Stern | 8bb54ab | 2006-07-01 22:08:49 -0400 | [diff] [blame^] | 28 | static void generic_disconnect(struct usb_device *udev) |
Alan Stern | 36e56a3 | 2006-07-01 22:08:06 -0400 | [diff] [blame] | 29 | { |
Alan Stern | 36e56a3 | 2006-07-01 22:08:06 -0400 | [diff] [blame] | 30 | /* if this is only an unbind, not a physical disconnect, then |
| 31 | * unconfigure the device */ |
| 32 | if (udev->state == USB_STATE_CONFIGURED) |
| 33 | usb_set_configuration(udev, 0); |
| 34 | |
| 35 | /* in case the call failed or the device was suspended */ |
| 36 | if (udev->state >= USB_STATE_CONFIGURED) |
| 37 | usb_disable_device(udev, 0); |
Alan Stern | 36e56a3 | 2006-07-01 22:08:06 -0400 | [diff] [blame] | 38 | } |
| 39 | |
Alan Stern | 8bb54ab | 2006-07-01 22:08:49 -0400 | [diff] [blame^] | 40 | struct usb_device_driver usb_generic_driver = { |
Alan Stern | 36e56a3 | 2006-07-01 22:08:06 -0400 | [diff] [blame] | 41 | .name = "usb", |
Alan Stern | 36e56a3 | 2006-07-01 22:08:06 -0400 | [diff] [blame] | 42 | .probe = generic_probe, |
Alan Stern | 8bb54ab | 2006-07-01 22:08:49 -0400 | [diff] [blame^] | 43 | .disconnect = generic_disconnect, |
Alan Stern | 36e56a3 | 2006-07-01 22:08:06 -0400 | [diff] [blame] | 44 | }; |