Merge branch 'for-curr' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / keucr / usb.c
CommitLineData
126bb03b
AC
1#include <linux/sched.h>
2#include <linux/errno.h>
3#include <linux/freezer.h>
4#include <linux/module.h>
5#include <linux/init.h>
6#include <linux/slab.h>
7#include <linux/kthread.h>
8#include <linux/mutex.h>
9#include <linux/utsname.h>
10
11#include <scsi/scsi.h>
12#include <scsi/scsi_cmnd.h>
13#include <scsi/scsi_device.h>
14
15#include "usb.h"
16#include "scsiglue.h"
d8aba9d5 17#include "smil.h"
126bb03b
AC
18#include "transport.h"
19
20/* Some informational data */
21MODULE_AUTHOR("Domao");
22MODULE_DESCRIPTION("ENE USB Mass Storage driver for Linux");
23MODULE_LICENSE("GPL");
24
a8718692
AC
25static unsigned int delay_use = 1;
26
126bb03b
AC
27static struct usb_device_id eucr_usb_ids [] = {
28 { USB_DEVICE(0x058f, 0x6366) },
29 { USB_DEVICE(0x0cf2, 0x6230) },
30 { USB_DEVICE(0x0cf2, 0x6250) },
31 { } /* Terminating entry */
32};
33MODULE_DEVICE_TABLE (usb, eucr_usb_ids);
34
35
e23f773e 36#ifdef CONFIG_PM
126bb03b 37
d8aba9d5 38static int eucr_suspend(struct usb_interface *iface, pm_message_t message)
126bb03b
AC
39{
40 struct us_data *us = usb_get_intfdata(iface);
871f8477 41 pr_info("--- eucr_suspend ---\n");
126bb03b
AC
42 /* Wait until no command is running */
43 mutex_lock(&us->dev_mutex);
44
126bb03b
AC
45 if (us->suspend_resume_hook)
46 (us->suspend_resume_hook)(us, US_SUSPEND);
47
126bb03b
AC
48 mutex_unlock(&us->dev_mutex);
49 return 0;
50}
126bb03b 51
d8aba9d5 52static int eucr_resume(struct usb_interface *iface)
126bb03b
AC
53{
54 BYTE tmp = 0;
55
56 struct us_data *us = usb_get_intfdata(iface);
871f8477 57 pr_info("--- eucr_resume---\n");
126bb03b
AC
58 mutex_lock(&us->dev_mutex);
59
126bb03b
AC
60 if (us->suspend_resume_hook)
61 (us->suspend_resume_hook)(us, US_RESUME);
62
63
64 mutex_unlock(&us->dev_mutex);
65
531c3361
KK
66 us->Power_IsResum = true;
67
68 us->SM_Status = *(PSM_STATUS)&tmp;
2c392daf 69
126bb03b
AC
70 return 0;
71}
531c3361 72
d8aba9d5 73static int eucr_reset_resume(struct usb_interface *iface)
126bb03b
AC
74{
75 BYTE tmp = 0;
76 struct us_data *us = usb_get_intfdata(iface);
77
871f8477 78 pr_info("--- eucr_reset_resume---\n");
126bb03b
AC
79
80 /* Report the reset to the SCSI core */
81 usb_stor_report_bus_reset(us);
82
531c3361
KK
83 /*
84 * FIXME: Notify the subdrivers that they need to reinitialize
85 * the device
86 */
87
126bb03b 88 us->Power_IsResum = true;
531c3361
KK
89
90 us->SM_Status = *(PSM_STATUS)&tmp;
91
126bb03b
AC
92 return 0;
93}
126bb03b 94
e23f773e
RD
95#else
96
97#define eucr_suspend NULL
98#define eucr_resume NULL
99#define eucr_reset_resume NULL
100
101#endif
102
126bb03b
AC
103static int eucr_pre_reset(struct usb_interface *iface)
104{
105 struct us_data *us = usb_get_intfdata(iface);
106
871f8477 107 pr_info("usb --- eucr_pre_reset\n");
126bb03b
AC
108
109 /* Make sure no command runs during the reset */
110 mutex_lock(&us->dev_mutex);
111 return 0;
112}
113
126bb03b
AC
114static int eucr_post_reset(struct usb_interface *iface)
115{
116 struct us_data *us = usb_get_intfdata(iface);
117
871f8477 118 pr_info("usb --- eucr_post_reset\n");
126bb03b
AC
119
120 /* Report the reset to the SCSI core */
121 usb_stor_report_bus_reset(us);
122
123 mutex_unlock(&us->dev_mutex);
124 return 0;
125}
126
126bb03b
AC
127void fill_inquiry_response(struct us_data *us, unsigned char *data, unsigned int data_len)
128{
871f8477 129 pr_info("usb --- fill_inquiry_response\n");
531c3361 130 if (data_len < 36) /* You lose. */
126bb03b
AC
131 return;
132
b466eb5e 133 if (data[0]&0x20) {
126bb03b 134 memset(data+8,0,28);
b466eb5e 135 } else {
126bb03b
AC
136 u16 bcdDevice = le16_to_cpu(us->pusb_dev->descriptor.bcdDevice);
137 memcpy(data+8, us->unusual_dev->vendorName,
138 strlen(us->unusual_dev->vendorName) > 8 ? 8 :
139 strlen(us->unusual_dev->vendorName));
140 memcpy(data+16, us->unusual_dev->productName,
141 strlen(us->unusual_dev->productName) > 16 ? 16 :
142 strlen(us->unusual_dev->productName));
143 data[32] = 0x30 + ((bcdDevice>>12) & 0x0F);
144 data[33] = 0x30 + ((bcdDevice>>8) & 0x0F);
145 data[34] = 0x30 + ((bcdDevice>>4) & 0x0F);
146 data[35] = 0x30 + ((bcdDevice) & 0x0F);
147 }
148 usb_stor_set_xfer_buf(us, data, data_len, us->srb, TO_XFER_BUF);
149}
150
126bb03b
AC
151static int usb_stor_control_thread(void * __us)
152{
153 struct us_data *us = (struct us_data *)__us;
154 struct Scsi_Host *host = us_to_host(us);
155
871f8477 156 pr_info("usb --- usb_stor_control_thread\n");
b466eb5e 157 for (;;) {
126bb03b
AC
158 if (wait_for_completion_interruptible(&us->cmnd_ready))
159 break;
531c3361 160
126bb03b
AC
161 /* lock the device pointers */
162 mutex_lock(&(us->dev_mutex));
163
164 /* if the device has disconnected, we are free to exit */
a8718692 165 if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) {
126bb03b
AC
166 mutex_unlock(&us->dev_mutex);
167 break;
a8718692 168 }
126bb03b
AC
169
170 /* lock access to the state */
171 scsi_lock(host);
172
173 /* When we are called with no command pending, we're done */
b466eb5e 174 if (us->srb == NULL) {
126bb03b
AC
175 scsi_unlock(host);
176 mutex_unlock(&us->dev_mutex);
126bb03b
AC
177 break;
178 }
179
180 /* has the command timed out *already* ? */
b466eb5e 181 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
126bb03b
AC
182 us->srb->result = DID_ABORT << 16;
183 goto SkipForAbort;
184 }
185
186 scsi_unlock(host);
187
b466eb5e 188 if (us->srb->sc_data_direction == DMA_BIDIRECTIONAL) {
126bb03b 189 us->srb->result = DID_ERROR << 16;
b466eb5e
KK
190 } else if (us->srb->device->id
191 && !(us->fflags & US_FL_SCM_MULT_TARG)) {
126bb03b 192 us->srb->result = DID_BAD_TARGET << 16;
b466eb5e 193 } else if (us->srb->device->lun > us->max_lun) {
126bb03b 194 us->srb->result = DID_BAD_TARGET << 16;
b466eb5e
KK
195 } else if ((us->srb->cmnd[0] == INQUIRY)
196 && (us->fflags & US_FL_FIX_INQUIRY)) {
126bb03b
AC
197 unsigned char data_ptr[36] = {0x00, 0x80, 0x02, 0x02, 0x1F, 0x00, 0x00, 0x00};
198
199 fill_inquiry_response(us, data_ptr, 36);
200 us->srb->result = SAM_STAT_GOOD;
b466eb5e 201 } else {
126bb03b
AC
202 us->proto_handler(us->srb, us);
203 }
204
205 /* lock access to the state */
206 scsi_lock(host);
207
208 /* indicate that the command is done */
b466eb5e 209 if (us->srb->result != DID_ABORT << 16) {
126bb03b 210 us->srb->scsi_done(us->srb);
b466eb5e 211 } else {
126bb03b 212SkipForAbort:
871f8477 213 pr_info("scsi command aborted\n");
126bb03b
AC
214 }
215
b466eb5e 216 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
126bb03b
AC
217 complete(&(us->notify));
218
219 /* Allow USB transfers to resume */
220 clear_bit(US_FLIDX_ABORTING, &us->dflags);
221 clear_bit(US_FLIDX_TIMED_OUT, &us->dflags);
222 }
223
224 /* finished working on this command */
225 us->srb = NULL;
226 scsi_unlock(host);
227
228 /* unlock the device pointers */
229 mutex_unlock(&us->dev_mutex);
230 } /* for (;;) */
231
232 /* Wait until we are told to stop */
b466eb5e 233 for (;;) {
126bb03b
AC
234 set_current_state(TASK_INTERRUPTIBLE);
235 if (kthread_should_stop())
236 break;
237 schedule();
238 }
239 __set_current_state(TASK_RUNNING);
240 return 0;
2c392daf 241}
126bb03b 242
126bb03b
AC
243static int associate_dev(struct us_data *us, struct usb_interface *intf)
244{
871f8477 245 pr_info("usb --- associate_dev\n");
126bb03b
AC
246
247 /* Fill in the device-related fields */
248 us->pusb_dev = interface_to_usbdev(intf);
249 us->pusb_intf = intf;
250 us->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
251
252 /* Store our private data in the interface */
253 usb_set_intfdata(intf, us);
254
255 /* Allocate the device-related DMA-mapped buffers */
256 us->cr = usb_alloc_coherent(us->pusb_dev, sizeof(*us->cr), GFP_KERNEL, &us->cr_dma);
b466eb5e 257 if (!us->cr) {
871f8477 258 pr_info("usb_ctrlrequest allocation failed\n");
126bb03b
AC
259 return -ENOMEM;
260 }
261
262 us->iobuf = usb_alloc_coherent(us->pusb_dev, US_IOBUF_SIZE, GFP_KERNEL, &us->iobuf_dma);
b466eb5e 263 if (!us->iobuf) {
871f8477 264 pr_info("I/O buffer allocation failed\n");
126bb03b
AC
265 return -ENOMEM;
266 }
267
268 us->sensebuf = kmalloc(US_SENSE_SIZE, GFP_KERNEL);
78110bb8 269 if (!us->sensebuf)
126bb03b 270 return -ENOMEM;
78110bb8 271
126bb03b
AC
272 return 0;
273}
274
126bb03b
AC
275static int get_device_info(struct us_data *us, const struct usb_device_id *id)
276{
277 struct usb_device *dev = us->pusb_dev;
278 struct usb_interface_descriptor *idesc = &us->pusb_intf->cur_altsetting->desc;
279
871f8477 280 pr_info("usb --- get_device_info\n");
126bb03b
AC
281
282 us->subclass = idesc->bInterfaceSubClass;
283 us->protocol = idesc->bInterfaceProtocol;
f61870ee 284 us->fflags = id->driver_info;
126bb03b
AC
285 us->Power_IsResum = false;
286
b466eb5e 287 if (us->fflags & US_FL_IGNORE_DEVICE) {
871f8477 288 pr_info("device ignored\n");
126bb03b
AC
289 return -ENODEV;
290 }
291
292 if (dev->speed != USB_SPEED_HIGH)
293 us->fflags &= ~US_FL_GO_SLOW;
294
295 return 0;
296}
297
126bb03b
AC
298static int get_transport(struct us_data *us)
299{
871f8477 300 pr_info("usb --- get_transport\n");
126bb03b 301 switch (us->protocol) {
bceadddd 302 case USB_PR_BULK:
126bb03b
AC
303 us->transport_name = "Bulk";
304 us->transport = usb_stor_Bulk_transport;
305 us->transport_reset = usb_stor_Bulk_reset;
306 break;
307
308 default:
309 return -EIO;
310 }
126bb03b
AC
311
312 /* fix for single-lun devices */
313 if (us->fflags & US_FL_SINGLE_LUN)
314 us->max_lun = 0;
315 return 0;
316}
317
126bb03b
AC
318static int get_protocol(struct us_data *us)
319{
871f8477
CYC
320 pr_info("usb --- get_protocol\n");
321 pr_info("us->pusb_dev->descriptor.idVendor = %x\n",
322 us->pusb_dev->descriptor.idVendor);
323 pr_info("us->pusb_dev->descriptor.idProduct = %x\n",
324 us->pusb_dev->descriptor.idProduct);
126bb03b 325 switch (us->subclass) {
bceadddd 326 case USB_SC_SCSI:
126bb03b 327 us->protocol_name = "Transparent SCSI";
b466eb5e
KK
328 if ((us->pusb_dev->descriptor.idVendor == 0x0CF2)
329 && (us->pusb_dev->descriptor.idProduct == 0x6250))
126bb03b
AC
330 us->proto_handler = ENE_stor_invoke_transport;
331 else
332 us->proto_handler = usb_stor_invoke_transport;
333 break;
334
335 default:
336 return -EIO;
337 }
126bb03b
AC
338 return 0;
339}
340
126bb03b
AC
341static int get_pipes(struct us_data *us)
342{
343 struct usb_host_interface *altsetting = us->pusb_intf->cur_altsetting;
344 int i;
345 struct usb_endpoint_descriptor *ep;
346 struct usb_endpoint_descriptor *ep_in = NULL;
347 struct usb_endpoint_descriptor *ep_out = NULL;
348 struct usb_endpoint_descriptor *ep_int = NULL;
349
871f8477 350 pr_info("usb --- get_pipes\n");
126bb03b 351
b466eb5e 352 for (i = 0; i < altsetting->desc.bNumEndpoints; i++) {
126bb03b
AC
353 ep = &altsetting->endpoint[i].desc;
354
b466eb5e
KK
355 if (usb_endpoint_xfer_bulk(ep)) {
356 if (usb_endpoint_dir_in(ep)) {
126bb03b
AC
357 if (!ep_in)
358 ep_in = ep;
b466eb5e 359 } else {
126bb03b
AC
360 if (!ep_out)
361 ep_out = ep;
362 }
b466eb5e 363 } else if (usb_endpoint_is_int_in(ep)) {
126bb03b
AC
364 if (!ep_int)
365 ep_int = ep;
366 }
367 }
368
b466eb5e 369 if (!ep_in || !ep_out || (us->protocol == USB_PR_CBI && !ep_int)) {
871f8477 370 pr_info("Endpoint sanity check failed! Rejecting dev.\n");
126bb03b
AC
371 return -EIO;
372 }
373
374 /* Calculate and store the pipe values */
375 us->send_ctrl_pipe = usb_sndctrlpipe(us->pusb_dev, 0);
376 us->recv_ctrl_pipe = usb_rcvctrlpipe(us->pusb_dev, 0);
377 us->send_bulk_pipe = usb_sndbulkpipe(us->pusb_dev, ep_out->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
378 us->recv_bulk_pipe = usb_rcvbulkpipe(us->pusb_dev, ep_in->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
b466eb5e 379 if (ep_int) {
126bb03b
AC
380 us->recv_intr_pipe = usb_rcvintpipe(us->pusb_dev, ep_int->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
381 us->ep_bInterval = ep_int->bInterval;
382 }
383 return 0;
384}
385
126bb03b
AC
386static int usb_stor_acquire_resources(struct us_data *us)
387{
388 struct task_struct *th;
389
871f8477 390 pr_info("usb --- usb_stor_acquire_resources\n");
126bb03b 391 us->current_urb = usb_alloc_urb(0, GFP_KERNEL);
b466eb5e 392 if (!us->current_urb) {
871f8477 393 pr_info("URB allocation failed\n");
126bb03b
AC
394 return -ENOMEM;
395 }
396
397 /* Start up our control thread */
398 th = kthread_run(usb_stor_control_thread, us, "eucr-storage");
b466eb5e 399 if (IS_ERR(th)) {
871f8477 400 pr_info("Unable to start control thread\n");
126bb03b
AC
401 return PTR_ERR(th);
402 }
403 us->ctl_thread = th;
404
405 return 0;
406}
407
126bb03b
AC
408static void usb_stor_release_resources(struct us_data *us)
409{
871f8477 410 pr_info("usb --- usb_stor_release_resources\n");
126bb03b
AC
411
412 SM_FreeMem();
413
414 complete(&us->cmnd_ready);
415 if (us->ctl_thread)
416 kthread_stop(us->ctl_thread);
417
418 /* Call the destructor routine, if it exists */
b466eb5e 419 if (us->extra_destructor) {
871f8477 420 pr_info("-- calling extra_destructor()\n");
126bb03b
AC
421 us->extra_destructor(us->extra);
422 }
423
424 /* Free the extra data and the URB */
425 kfree(us->extra);
426 usb_free_urb(us->current_urb);
427}
428
126bb03b
AC
429static void dissociate_dev(struct us_data *us)
430{
871f8477 431 pr_info("usb --- dissociate_dev\n");
126bb03b
AC
432
433 kfree(us->sensebuf);
434
435 /* Free the device-related DMA-mapped buffers */
436 if (us->cr)
437 usb_free_coherent(us->pusb_dev, sizeof(*us->cr), us->cr, us->cr_dma);
438 if (us->iobuf)
439 usb_free_coherent(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, us->iobuf_dma);
440
441 /* Remove our private data from the interface */
442 usb_set_intfdata(us->pusb_intf, NULL);
443}
444
126bb03b
AC
445static void quiesce_and_remove_host(struct us_data *us)
446{
447 struct Scsi_Host *host = us_to_host(us);
448
871f8477 449 pr_info("usb --- quiesce_and_remove_host\n");
126bb03b
AC
450
451 /* If the device is really gone, cut short reset delays */
452 if (us->pusb_dev->state == USB_STATE_NOTATTACHED)
453 set_bit(US_FLIDX_DISCONNECTING, &us->dflags);
454
531c3361
KK
455 /*
456 * Prevent SCSI-scanning (if it hasn't started yet)
126bb03b
AC
457 * and wait for the SCSI-scanning thread to stop.
458 */
459 set_bit(US_FLIDX_DONT_SCAN, &us->dflags);
460 wake_up(&us->delay_wait);
461 wait_for_completion(&us->scanning_done);
462
531c3361
KK
463 /*
464 * Removing the host will perform an orderly shutdown: caches
126bb03b
AC
465 * synchronized, disks spun down, etc.
466 */
467 scsi_remove_host(host);
468
531c3361
KK
469 /*
470 * Prevent any new commands from being accepted and cut short
126bb03b
AC
471 * reset delays.
472 */
473 scsi_lock(host);
474 set_bit(US_FLIDX_DISCONNECTING, &us->dflags);
475 scsi_unlock(host);
476 wake_up(&us->delay_wait);
477}
478
126bb03b
AC
479static void release_everything(struct us_data *us)
480{
871f8477 481 pr_info("usb --- release_everything\n");
126bb03b
AC
482
483 usb_stor_release_resources(us);
484 dissociate_dev(us);
485 scsi_host_put(us_to_host(us));
486}
487
126bb03b
AC
488static int usb_stor_scan_thread(void * __us)
489{
490 struct us_data *us = (struct us_data *)__us;
491
871f8477
CYC
492 pr_info("usb --- usb_stor_scan_thread\n");
493 pr_info("EUCR : device found at %d\n", us->pusb_dev->devnum);
126bb03b 494
a8718692
AC
495 set_freezable();
496 /* Wait for the timeout to expire or for a disconnect */
497 if (delay_use > 0) {
498 wait_event_freezable_timeout(us->delay_wait,
499 test_bit(US_FLIDX_DONT_SCAN, &us->dflags),
500 delay_use * HZ);
501 }
126bb03b
AC
502
503 /* If the device is still connected, perform the scanning */
b466eb5e 504 if (!test_bit(US_FLIDX_DONT_SCAN, &us->dflags)) {
126bb03b 505 /* For bulk-only devices, determine the max LUN value */
b466eb5e
KK
506 if (us->protocol == USB_PR_BULK
507 && !(us->fflags & US_FL_SINGLE_LUN)) {
126bb03b
AC
508 mutex_lock(&us->dev_mutex);
509 us->max_lun = usb_stor_Bulk_max_lun(us);
510 mutex_unlock(&us->dev_mutex);
511 }
512 scsi_scan_host(us_to_host(us));
871f8477 513 pr_info("EUCR : device scan complete\n");
126bb03b
AC
514 }
515 complete_and_exit(&us->scanning_done, 0);
516}
517
126bb03b
AC
518static int eucr_probe(struct usb_interface *intf, const struct usb_device_id *id)
519{
520 struct Scsi_Host *host;
521 struct us_data *us;
522 int result;
41e568d1 523 BYTE MiscReg03 = 0;
126bb03b
AC
524 struct task_struct *th;
525
871f8477 526 pr_info("usb --- eucr_probe\n");
126bb03b
AC
527
528 host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us));
b466eb5e 529 if (!host) {
871f8477 530 pr_info("Unable to allocate the scsi host\n");
126bb03b
AC
531 return -ENOMEM;
532 }
533
534 /* Allow 16-byte CDBs and thus > 2TB */
535 host->max_cmd_len = 16;
536 us = host_to_us(host);
537 memset(us, 0, sizeof(struct us_data));
538 mutex_init(&(us->dev_mutex));
539 init_completion(&us->cmnd_ready);
540 init_completion(&(us->notify));
541 init_waitqueue_head(&us->delay_wait);
542 init_completion(&us->scanning_done);
543
544 /* Associate the us_data structure with the USB device */
545 result = associate_dev(us, intf);
546 if (result)
547 goto BadDevice;
548
549 /* Get Device info */
550 result = get_device_info(us, id);
551 if (result)
552 goto BadDevice;
553
554 /* Get the transport, protocol, and pipe settings */
555 result = get_transport(us);
556 if (result)
557 goto BadDevice;
558 result = get_protocol(us);
559 if (result)
560 goto BadDevice;
561 result = get_pipes(us);
562 if (result)
563 goto BadDevice;
564
565 /* Acquire all the other resources and add the host */
566 result = usb_stor_acquire_resources(us);
567 if (result)
568 goto BadDevice;
569
570 result = scsi_add_host(host, &intf->dev);
b466eb5e 571 if (result) {
871f8477 572 pr_info("Unable to add the scsi host\n");
126bb03b
AC
573 goto BadDevice;
574 }
575
576 /* Start up the thread for delayed SCSI-device scanning */
577 th = kthread_create(usb_stor_scan_thread, us, "eucr-stor-scan");
7d51b77a 578 if (IS_ERR(th)) {
871f8477 579 pr_info("Unable to start the device-scanning thread\n");
126bb03b
AC
580 complete(&us->scanning_done);
581 quiesce_and_remove_host(us);
582 result = PTR_ERR(th);
583 goto BadDevice;
584 }
585 wake_up_process(th);
41e568d1 586
587 /* probe card type */
588 result = ENE_Read_BYTE(us, REG_CARD_STATUS, &MiscReg03);
589 if (result != USB_STOR_XFER_GOOD) {
590 result = USB_STOR_TRANSPORT_ERROR;
591 quiesce_and_remove_host(us);
592 goto BadDevice;
593 }
594
595 if (!(MiscReg03 & 0x02)) {
596 result = -ENODEV;
597 quiesce_and_remove_host(us);
871f8477 598 pr_info("keucr: The driver only supports SM/MS card.\
41e568d1 599 To use SD card, \
600 please build driver/usb/storage/ums-eneub6250.ko\n");
601 goto BadDevice;
602 }
603
126bb03b
AC
604 return 0;
605
606 /* We come here if there are any problems */
607BadDevice:
871f8477 608 pr_info("usb --- eucr_probe failed\n");
126bb03b
AC
609 release_everything(us);
610 return result;
611}
612
126bb03b
AC
613static void eucr_disconnect(struct usb_interface *intf)
614{
615 struct us_data *us = usb_get_intfdata(intf);
616
871f8477 617 pr_info("usb --- eucr_disconnect\n");
126bb03b
AC
618 quiesce_and_remove_host(us);
619 release_everything(us);
620}
621
531c3361 622/* Initialization and registration */
126bb03b
AC
623static struct usb_driver usb_storage_driver = {
624 .name = "eucr",
625 .probe = eucr_probe,
626 .suspend = eucr_suspend,
627 .resume = eucr_resume,
628 .reset_resume = eucr_reset_resume,
629 .disconnect = eucr_disconnect,
630 .pre_reset = eucr_pre_reset,
631 .post_reset = eucr_post_reset,
632 .id_table = eucr_usb_ids,
633 .soft_unbind = 1,
634};
635
bac2c126 636module_usb_driver(usb_storage_driver);