diff options
-rw-r--r-- | drivers/usb/storage/usb.c | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index eb901817b7d2..c1a902691bc6 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -111,11 +111,6 @@ static atomic_t total_threads = ATOMIC_INIT(0); | |||
111 | static DECLARE_COMPLETION(threads_gone); | 111 | static DECLARE_COMPLETION(threads_gone); |
112 | 112 | ||
113 | 113 | ||
114 | static int storage_probe(struct usb_interface *iface, | ||
115 | const struct usb_device_id *id); | ||
116 | |||
117 | static void storage_disconnect(struct usb_interface *iface); | ||
118 | |||
119 | /* The entries in this table, except for final ones here | 114 | /* The entries in this table, except for final ones here |
120 | * (USB_MASS_STORAGE_CLASS and the empty entry), correspond, | 115 | * (USB_MASS_STORAGE_CLASS and the empty entry), correspond, |
121 | * line for line with the entries of us_unsuaul_dev_list[]. | 116 | * line for line with the entries of us_unsuaul_dev_list[]. |
@@ -233,13 +228,40 @@ static struct us_unusual_dev us_unusual_dev_list[] = { | |||
233 | { NULL } | 228 | { NULL } |
234 | }; | 229 | }; |
235 | 230 | ||
236 | static struct usb_driver usb_storage_driver = { | 231 | |
237 | .owner = THIS_MODULE, | 232 | #ifdef CONFIG_PM /* Minimal support for suspend and resume */ |
238 | .name = "usb-storage", | 233 | |
239 | .probe = storage_probe, | 234 | static int storage_suspend(struct usb_interface *iface, pm_message_t message) |
240 | .disconnect = storage_disconnect, | 235 | { |
241 | .id_table = storage_usb_ids, | 236 | struct us_data *us = usb_get_intfdata(iface); |
242 | }; | 237 | |
238 | /* Wait until no command is running */ | ||
239 | down(&us->dev_semaphore); | ||
240 | |||
241 | US_DEBUGP("%s\n", __FUNCTION__); | ||
242 | iface->dev.power.power_state.event = message.event; | ||
243 | |||
244 | /* When runtime PM is working, we'll set a flag to indicate | ||
245 | * whether we should autoresume when a SCSI request arrives. */ | ||
246 | |||
247 | up(&us->dev_semaphore); | ||
248 | return 0; | ||
249 | } | ||
250 | |||
251 | static int storage_resume(struct usb_interface *iface) | ||
252 | { | ||
253 | struct us_data *us = usb_get_intfdata(iface); | ||
254 | |||
255 | down(&us->dev_semaphore); | ||
256 | |||
257 | US_DEBUGP("%s\n", __FUNCTION__); | ||
258 | iface->dev.power.power_state.event = PM_EVENT_ON; | ||
259 | |||
260 | up(&us->dev_semaphore); | ||
261 | return 0; | ||
262 | } | ||
263 | |||
264 | #endif /* CONFIG_PM */ | ||
243 | 265 | ||
244 | /* | 266 | /* |
245 | * fill_inquiry_response takes an unsigned char array (which must | 267 | * fill_inquiry_response takes an unsigned char array (which must |
@@ -1042,6 +1064,18 @@ static void storage_disconnect(struct usb_interface *intf) | |||
1042 | * Initialization and registration | 1064 | * Initialization and registration |
1043 | ***********************************************************************/ | 1065 | ***********************************************************************/ |
1044 | 1066 | ||
1067 | static struct usb_driver usb_storage_driver = { | ||
1068 | .owner = THIS_MODULE, | ||
1069 | .name = "usb-storage", | ||
1070 | .probe = storage_probe, | ||
1071 | .disconnect = storage_disconnect, | ||
1072 | #ifdef CONFIG_PM | ||
1073 | .suspend = storage_suspend, | ||
1074 | .resume = storage_resume, | ||
1075 | #endif | ||
1076 | .id_table = storage_usb_ids, | ||
1077 | }; | ||
1078 | |||
1045 | static int __init usb_stor_init(void) | 1079 | static int __init usb_stor_init(void) |
1046 | { | 1080 | { |
1047 | int retval; | 1081 | int retval; |