Lines Matching +full:wait +full:- +full:free +full:- +full:us

1 // SPDX-License-Identifier: GPL-2.0+
6 * (c) 1999-2003 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
9 * (c) 2000 David L. Brown, Jr. (usb-[email protected])
10 * (c) 2003-2009 Alan Stern ([email protected])
22 * similar to commands in the SCSI-II and ATAPI specifications.
25 * exhibits class-specific exemptions from the USB specification.
27 * that they are used to communicate wait, failed and OK on commands.
61 #include "uas-detect.h"
64 #define DRV_NAME "usb-storage"
67 MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>");
74 * parse_delay_str - parse an unsigned decimal integer delay
94 if (n > 0 && str[n - 1] == '\n') in parse_delay_str()
95 --n; in parse_delay_str()
96 if (n >= l && !strncmp(&str[n - l], suffix, l)) { in parse_delay_str()
97 n -= l; in parse_delay_str()
102 if (n + n2 > sizeof(buf) - 1) in parse_delay_str()
103 return -EINVAL; in parse_delay_str()
106 while (n2-- > 0) in parse_delay_str()
114 * format_delay_ms - format an integer value into a delay string
150 *((unsigned int *)kp->arg) = delay_ms; in delay_use_set()
156 unsigned int delay_ms = *((unsigned int *)kp->arg); in delay_use_get()
175 * with the entries in usb_storage_usb_ids[], defined in usual-tables.c.
185 * are free to use as many characters as you like.
227 struct usb_host_config *config = udev->actconfig; in us_set_lock_class()
230 for (i = 0; i < config->desc.bNumInterfaces; i++) { in us_set_lock_class()
231 if (config->interface[i] == intf) in us_set_lock_class()
235 BUG_ON(i == config->desc.bNumInterfaces); in us_set_lock_class()
253 struct us_data *us = usb_get_intfdata(iface); in usb_stor_suspend() local
255 /* Wait until no command is running */ in usb_stor_suspend()
256 mutex_lock(&us->dev_mutex); in usb_stor_suspend()
258 if (us->suspend_resume_hook) in usb_stor_suspend()
259 (us->suspend_resume_hook)(us, US_SUSPEND); in usb_stor_suspend()
266 mutex_unlock(&us->dev_mutex); in usb_stor_suspend()
273 struct us_data *us = usb_get_intfdata(iface); in usb_stor_resume() local
275 mutex_lock(&us->dev_mutex); in usb_stor_resume()
277 if (us->suspend_resume_hook) in usb_stor_resume()
278 (us->suspend_resume_hook)(us, US_RESUME); in usb_stor_resume()
280 mutex_unlock(&us->dev_mutex); in usb_stor_resume()
287 struct us_data *us = usb_get_intfdata(iface); in usb_stor_reset_resume() local
290 usb_stor_report_bus_reset(us); in usb_stor_reset_resume()
309 struct us_data *us = usb_get_intfdata(iface); in usb_stor_pre_reset() local
312 mutex_lock(&us->dev_mutex); in usb_stor_pre_reset()
319 struct us_data *us = usb_get_intfdata(iface); in usb_stor_post_reset() local
322 usb_stor_report_bus_reset(us); in usb_stor_post_reset()
329 mutex_unlock(&us->dev_mutex); in usb_stor_post_reset()
343 void fill_inquiry_response(struct us_data *us, unsigned char *data, in fill_inquiry_response() argument
362 u16 bcdDevice = le16_to_cpu(us->pusb_dev->descriptor.bcdDevice); in fill_inquiry_response()
365 n = strlen(us->unusual_dev->vendorName); in fill_inquiry_response()
366 memcpy(data+8, us->unusual_dev->vendorName, min(8, n)); in fill_inquiry_response()
367 n = strlen(us->unusual_dev->productName); in fill_inquiry_response()
368 memcpy(data+16, us->unusual_dev->productName, min(16, n)); in fill_inquiry_response()
376 usb_stor_set_xfer_buf(data, data_len, us->srb); in fill_inquiry_response()
382 struct us_data *us = (struct us_data *)__us; in usb_stor_control_thread() local
383 struct Scsi_Host *host = us_to_host(us); in usb_stor_control_thread()
387 usb_stor_dbg(us, "*** thread sleeping\n"); in usb_stor_control_thread()
388 if (wait_for_completion_interruptible(&us->cmnd_ready)) in usb_stor_control_thread()
391 usb_stor_dbg(us, "*** thread awakened\n"); in usb_stor_control_thread()
394 mutex_lock(&(us->dev_mutex)); in usb_stor_control_thread()
400 srb = us->srb; in usb_stor_control_thread()
403 mutex_unlock(&us->dev_mutex); in usb_stor_control_thread()
404 usb_stor_dbg(us, "-- exiting\n"); in usb_stor_control_thread()
409 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { in usb_stor_control_thread()
410 srb->result = DID_ABORT << 16; in usb_stor_control_thread()
420 if (srb->sc_data_direction == DMA_BIDIRECTIONAL) { in usb_stor_control_thread()
421 usb_stor_dbg(us, "UNKNOWN data direction\n"); in usb_stor_control_thread()
422 srb->result = DID_ERROR << 16; in usb_stor_control_thread()
429 else if (srb->device->id && in usb_stor_control_thread()
430 !(us->fflags & US_FL_SCM_MULT_TARG)) { in usb_stor_control_thread()
431 usb_stor_dbg(us, "Bad target number (%d:%llu)\n", in usb_stor_control_thread()
432 srb->device->id, in usb_stor_control_thread()
433 srb->device->lun); in usb_stor_control_thread()
434 srb->result = DID_BAD_TARGET << 16; in usb_stor_control_thread()
437 else if (srb->device->lun > us->max_lun) { in usb_stor_control_thread()
438 usb_stor_dbg(us, "Bad LUN (%d:%llu)\n", in usb_stor_control_thread()
439 srb->device->id, in usb_stor_control_thread()
440 srb->device->lun); in usb_stor_control_thread()
441 srb->result = DID_BAD_TARGET << 16; in usb_stor_control_thread()
445 * Handle those devices which need us to fake in usb_stor_control_thread()
448 else if ((srb->cmnd[0] == INQUIRY) && in usb_stor_control_thread()
449 (us->fflags & US_FL_FIX_INQUIRY)) { in usb_stor_control_thread()
454 usb_stor_dbg(us, "Faking INQUIRY command\n"); in usb_stor_control_thread()
455 fill_inquiry_response(us, data_ptr, 36); in usb_stor_control_thread()
456 srb->result = SAM_STAT_GOOD; in usb_stor_control_thread()
461 US_DEBUG(usb_stor_show_command(us, srb)); in usb_stor_control_thread()
462 us->proto_handler(srb, us); in usb_stor_control_thread()
463 usb_mark_last_busy(us->pusb_dev); in usb_stor_control_thread()
470 if (srb->result == DID_ABORT << 16) { in usb_stor_control_thread()
472 usb_stor_dbg(us, "scsi command aborted\n"); in usb_stor_control_thread()
479 * the TIMED_OUT flag, not srb->result == DID_ABORT, because in usb_stor_control_thread()
483 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { in usb_stor_control_thread()
484 complete(&(us->notify)); in usb_stor_control_thread()
487 clear_bit(US_FLIDX_ABORTING, &us->dflags); in usb_stor_control_thread()
488 clear_bit(US_FLIDX_TIMED_OUT, &us->dflags); in usb_stor_control_thread()
492 us->srb = NULL; in usb_stor_control_thread()
496 mutex_unlock(&us->dev_mutex); in usb_stor_control_thread()
500 usb_stor_dbg(us, "scsi cmd done, result=0x%x\n", in usb_stor_control_thread()
501 srb->result); in usb_stor_control_thread()
506 /* Wait until we are told to stop */ in usb_stor_control_thread()
522 static int associate_dev(struct us_data *us, struct usb_interface *intf) in associate_dev() argument
524 /* Fill in the device-related fields */ in associate_dev()
525 us->pusb_dev = interface_to_usbdev(intf); in associate_dev()
526 us->pusb_intf = intf; in associate_dev()
527 us->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; in associate_dev()
528 usb_stor_dbg(us, "Vendor: 0x%04x, Product: 0x%04x, Revision: 0x%04x\n", in associate_dev()
529 le16_to_cpu(us->pusb_dev->descriptor.idVendor), in associate_dev()
530 le16_to_cpu(us->pusb_dev->descriptor.idProduct), in associate_dev()
531 le16_to_cpu(us->pusb_dev->descriptor.bcdDevice)); in associate_dev()
532 usb_stor_dbg(us, "Interface Subclass: 0x%02x, Protocol: 0x%02x\n", in associate_dev()
533 intf->cur_altsetting->desc.bInterfaceSubClass, in associate_dev()
534 intf->cur_altsetting->desc.bInterfaceProtocol); in associate_dev()
537 usb_set_intfdata(intf, us); in associate_dev()
539 /* Allocate the control/setup and DMA-mapped buffers */ in associate_dev()
540 us->cr = kmalloc(sizeof(*us->cr), GFP_KERNEL); in associate_dev()
541 if (!us->cr) in associate_dev()
542 return -ENOMEM; in associate_dev()
544 us->iobuf = usb_alloc_coherent(us->pusb_dev, US_IOBUF_SIZE, in associate_dev()
545 GFP_KERNEL, &us->iobuf_dma); in associate_dev()
546 if (!us->iobuf) { in associate_dev()
547 usb_stor_dbg(us, "I/O buffer allocation failed\n"); in associate_dev()
548 return -ENOMEM; in associate_dev()
560 u16 vid = le16_to_cpu(udev->descriptor.idVendor); in usb_stor_adjust_quirks()
561 u16 pid = le16_to_cpu(udev->descriptor.idProduct); in usb_stor_adjust_quirks()
670 static int get_device_info(struct us_data *us, const struct usb_device_id *id, in get_device_info() argument
673 struct usb_device *dev = us->pusb_dev; in get_device_info()
675 &us->pusb_intf->cur_altsetting->desc; in get_device_info()
676 struct device *pdev = &us->pusb_intf->dev; in get_device_info()
679 us->unusual_dev = unusual_dev; in get_device_info()
680 us->subclass = (unusual_dev->useProtocol == USB_SC_DEVICE) ? in get_device_info()
681 idesc->bInterfaceSubClass : in get_device_info()
682 unusual_dev->useProtocol; in get_device_info()
683 us->protocol = (unusual_dev->useTransport == USB_PR_DEVICE) ? in get_device_info()
684 idesc->bInterfaceProtocol : in get_device_info()
685 unusual_dev->useTransport; in get_device_info()
686 us->fflags = id->driver_info; in get_device_info()
687 usb_stor_adjust_quirks(us->pusb_dev, &us->fflags); in get_device_info()
689 if (us->fflags & US_FL_IGNORE_DEVICE) { in get_device_info()
691 return -ENODEV; in get_device_info()
695 * This flag is only needed when we're in high-speed, so let's in get_device_info()
696 * disable it if we're in full-speed in get_device_info()
698 if (dev->speed != USB_SPEED_HIGH) in get_device_info()
699 us->fflags &= ~US_FL_GO_SLOW; in get_device_info()
701 if (us->fflags) in get_device_info()
703 le16_to_cpu(dev->descriptor.idVendor), in get_device_info()
704 le16_to_cpu(dev->descriptor.idProduct), in get_device_info()
705 us->fflags); in get_device_info()
708 * Log a message if a non-generic unusual_dev entry contains an in get_device_info()
710 * reports from users that will help us remove unneeded entries in get_device_info()
713 if (id->idVendor || id->idProduct) { in get_device_info()
718 struct usb_device_descriptor *ddesc = &dev->descriptor; in get_device_info()
719 int msg = -1; in get_device_info()
721 if (unusual_dev->useProtocol != USB_SC_DEVICE && in get_device_info()
722 us->subclass == idesc->bInterfaceSubClass) in get_device_info()
724 if (unusual_dev->useTransport != USB_PR_DEVICE && in get_device_info()
725 us->protocol == idesc->bInterfaceProtocol) in get_device_info()
727 if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE)) in get_device_info()
733 "<linux-[email protected]> and " in get_device_info()
734 "<usb-[email protected]-eyed-alien.net>\n", in get_device_info()
735 le16_to_cpu(ddesc->idVendor), in get_device_info()
736 le16_to_cpu(ddesc->idProduct), in get_device_info()
737 le16_to_cpu(ddesc->bcdDevice), in get_device_info()
738 idesc->bInterfaceSubClass, in get_device_info()
739 idesc->bInterfaceProtocol, in get_device_info()
741 utsname()->release); in get_device_info()
748 static void get_transport(struct us_data *us) in get_transport() argument
750 switch (us->protocol) { in get_transport()
752 us->transport_name = "Control/Bulk"; in get_transport()
753 us->transport = usb_stor_CB_transport; in get_transport()
754 us->transport_reset = usb_stor_CB_reset; in get_transport()
755 us->max_lun = 7; in get_transport()
759 us->transport_name = "Control/Bulk/Interrupt"; in get_transport()
760 us->transport = usb_stor_CB_transport; in get_transport()
761 us->transport_reset = usb_stor_CB_reset; in get_transport()
762 us->max_lun = 7; in get_transport()
766 us->transport_name = "Bulk"; in get_transport()
767 us->transport = usb_stor_Bulk_transport; in get_transport()
768 us->transport_reset = usb_stor_Bulk_reset; in get_transport()
774 static void get_protocol(struct us_data *us) in get_protocol() argument
776 switch (us->subclass) { in get_protocol()
778 us->protocol_name = "Reduced Block Commands (RBC)"; in get_protocol()
779 us->proto_handler = usb_stor_transparent_scsi_command; in get_protocol()
783 us->protocol_name = "8020i"; in get_protocol()
784 us->proto_handler = usb_stor_pad12_command; in get_protocol()
785 us->max_lun = 0; in get_protocol()
789 us->protocol_name = "QIC-157"; in get_protocol()
790 us->proto_handler = usb_stor_pad12_command; in get_protocol()
791 us->max_lun = 0; in get_protocol()
795 us->protocol_name = "8070i"; in get_protocol()
796 us->proto_handler = usb_stor_pad12_command; in get_protocol()
797 us->max_lun = 0; in get_protocol()
801 us->protocol_name = "Transparent SCSI"; in get_protocol()
802 us->proto_handler = usb_stor_transparent_scsi_command; in get_protocol()
806 us->protocol_name = "Uniform Floppy Interface (UFI)"; in get_protocol()
807 us->proto_handler = usb_stor_ufi_command; in get_protocol()
813 static int get_pipes(struct us_data *us) in get_pipes() argument
815 struct usb_host_interface *alt = us->pusb_intf->cur_altsetting; in get_pipes()
823 * We are expecting a minimum of 2 endpoints - in and out (bulk). in get_pipes()
824 * An optional interrupt-in is OK (necessary for CBI protocol). in get_pipes()
829 usb_stor_dbg(us, "bulk endpoints not found\n"); in get_pipes()
834 if (res && us->protocol == USB_PR_CBI) { in get_pipes()
835 usb_stor_dbg(us, "interrupt endpoint not found\n"); in get_pipes()
840 us->send_ctrl_pipe = usb_sndctrlpipe(us->pusb_dev, 0); in get_pipes()
841 us->recv_ctrl_pipe = usb_rcvctrlpipe(us->pusb_dev, 0); in get_pipes()
842 us->send_bulk_pipe = usb_sndbulkpipe(us->pusb_dev, in get_pipes()
844 us->recv_bulk_pipe = usb_rcvbulkpipe(us->pusb_dev, in get_pipes()
847 us->recv_intr_pipe = usb_rcvintpipe(us->pusb_dev, in get_pipes()
849 us->ep_bInterval = ep_int->bInterval; in get_pipes()
855 static int usb_stor_acquire_resources(struct us_data *us) in usb_stor_acquire_resources() argument
860 us->current_urb = usb_alloc_urb(0, GFP_KERNEL); in usb_stor_acquire_resources()
861 if (!us->current_urb) in usb_stor_acquire_resources()
862 return -ENOMEM; in usb_stor_acquire_resources()
868 if (us->unusual_dev->initFunction) { in usb_stor_acquire_resources()
869 p = us->unusual_dev->initFunction(us); in usb_stor_acquire_resources()
875 th = kthread_run(usb_stor_control_thread, us, "usb-storage"); in usb_stor_acquire_resources()
877 dev_warn(&us->pusb_intf->dev, in usb_stor_acquire_resources()
881 us->ctl_thread = th; in usb_stor_acquire_resources()
887 static void usb_stor_release_resources(struct us_data *us) in usb_stor_release_resources() argument
894 usb_stor_dbg(us, "-- sending exit command to thread\n"); in usb_stor_release_resources()
895 complete(&us->cmnd_ready); in usb_stor_release_resources()
896 if (us->ctl_thread) in usb_stor_release_resources()
897 kthread_stop(us->ctl_thread); in usb_stor_release_resources()
900 if (us->extra_destructor) { in usb_stor_release_resources()
901 usb_stor_dbg(us, "-- calling extra_destructor()\n"); in usb_stor_release_resources()
902 us->extra_destructor(us->extra); in usb_stor_release_resources()
905 /* Free the extra data and the URB */ in usb_stor_release_resources()
906 kfree(us->extra); in usb_stor_release_resources()
907 usb_free_urb(us->current_urb); in usb_stor_release_resources()
911 static void dissociate_dev(struct us_data *us) in dissociate_dev() argument
913 /* Free the buffers */ in dissociate_dev()
914 kfree(us->cr); in dissociate_dev()
915 usb_free_coherent(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, us->iobuf_dma); in dissociate_dev()
918 usb_set_intfdata(us->pusb_intf, NULL); in dissociate_dev()
925 static void quiesce_and_remove_host(struct us_data *us) in quiesce_and_remove_host() argument
927 struct Scsi_Host *host = us_to_host(us); in quiesce_and_remove_host()
930 if (us->pusb_dev->state == USB_STATE_NOTATTACHED) { in quiesce_and_remove_host()
931 set_bit(US_FLIDX_DISCONNECTING, &us->dflags); in quiesce_and_remove_host()
932 wake_up(&us->delay_wait); in quiesce_and_remove_host()
937 * or wait for the SCSI-scanning routine to stop. in quiesce_and_remove_host()
939 cancel_delayed_work_sync(&us->scan_dwork); in quiesce_and_remove_host()
942 if (test_bit(US_FLIDX_SCAN_PENDING, &us->dflags)) in quiesce_and_remove_host()
943 usb_autopm_put_interface_no_suspend(us->pusb_intf); in quiesce_and_remove_host()
956 set_bit(US_FLIDX_DISCONNECTING, &us->dflags); in quiesce_and_remove_host()
958 wake_up(&us->delay_wait); in quiesce_and_remove_host()
962 static void release_everything(struct us_data *us) in release_everything() argument
964 usb_stor_release_resources(us); in release_everything()
965 dissociate_dev(us); in release_everything()
968 * Drop our reference to the host; the SCSI core will free it in release_everything()
969 * (and "us" along with it) when the refcount becomes 0. in release_everything()
971 scsi_host_put(us_to_host(us)); in release_everything()
974 /* Delayed-work routine to carry out SCSI-device scanning */
977 struct us_data *us = container_of(work, struct us_data, in usb_stor_scan_dwork() local
979 struct device *dev = &us->pusb_intf->dev; in usb_stor_scan_dwork()
983 /* For bulk-only devices, determine the max LUN value */ in usb_stor_scan_dwork()
984 if (us->protocol == USB_PR_BULK && in usb_stor_scan_dwork()
985 !(us->fflags & US_FL_SINGLE_LUN) && in usb_stor_scan_dwork()
986 !(us->fflags & US_FL_SCM_MULT_TARG)) { in usb_stor_scan_dwork()
987 mutex_lock(&us->dev_mutex); in usb_stor_scan_dwork()
988 us->max_lun = usb_stor_Bulk_max_lun(us); in usb_stor_scan_dwork()
994 if (us->max_lun >= 8) in usb_stor_scan_dwork()
995 us_to_host(us)->max_lun = us->max_lun+1; in usb_stor_scan_dwork()
996 mutex_unlock(&us->dev_mutex); in usb_stor_scan_dwork()
998 scsi_scan_host(us_to_host(us)); in usb_stor_scan_dwork()
1003 usb_autopm_put_interface(us->pusb_intf); in usb_stor_scan_dwork()
1004 clear_bit(US_FLIDX_SCAN_PENDING, &us->dflags); in usb_stor_scan_dwork()
1011 if (usb_dev->bus->sg_tablesize) { in usb_stor_sg_tablesize()
1012 return usb_dev->bus->sg_tablesize; in usb_stor_sg_tablesize()
1017 /* First part of general USB mass-storage probing */
1025 struct us_data *us; in usb_stor_probe1() local
1028 dev_info(&intf->dev, "USB Mass Storage device detected\n"); in usb_stor_probe1()
1034 host = scsi_host_alloc(sht, sizeof(*us)); in usb_stor_probe1()
1036 dev_warn(&intf->dev, "Unable to allocate the scsi host\n"); in usb_stor_probe1()
1037 return -ENOMEM; in usb_stor_probe1()
1041 * Allow 16-byte CDBs and thus > 2TB in usb_stor_probe1()
1043 host->max_cmd_len = 16; in usb_stor_probe1()
1044 host->sg_tablesize = usb_stor_sg_tablesize(intf); in usb_stor_probe1()
1045 *pus = us = host_to_us(host); in usb_stor_probe1()
1046 mutex_init(&(us->dev_mutex)); in usb_stor_probe1()
1047 us_set_lock_class(&us->dev_mutex, intf); in usb_stor_probe1()
1048 init_completion(&us->cmnd_ready); in usb_stor_probe1()
1049 init_completion(&(us->notify)); in usb_stor_probe1()
1050 init_waitqueue_head(&us->delay_wait); in usb_stor_probe1()
1051 INIT_DELAYED_WORK(&us->scan_dwork, usb_stor_scan_dwork); in usb_stor_probe1()
1054 result = associate_dev(us, intf); in usb_stor_probe1()
1063 if (!hcd_uses_dma(bus_to_hcd(us->pusb_dev->bus)) || in usb_stor_probe1()
1064 bus_to_hcd(us->pusb_dev->bus)->localmem_pool) in usb_stor_probe1()
1065 host->no_highmem = true; in usb_stor_probe1()
1068 result = get_device_info(us, id, unusual_dev); in usb_stor_probe1()
1073 get_transport(us); in usb_stor_probe1()
1074 get_protocol(us); in usb_stor_probe1()
1083 usb_stor_dbg(us, "storage_probe() failed\n"); in usb_stor_probe1()
1084 release_everything(us); in usb_stor_probe1()
1089 /* Second part of general USB mass-storage probing */
1090 int usb_stor_probe2(struct us_data *us) in usb_stor_probe2() argument
1093 struct device *dev = &us->pusb_intf->dev; in usb_stor_probe2()
1096 if (!us->transport || !us->proto_handler) { in usb_stor_probe2()
1097 result = -ENXIO; in usb_stor_probe2()
1100 usb_stor_dbg(us, "Transport: %s\n", us->transport_name); in usb_stor_probe2()
1101 usb_stor_dbg(us, "Protocol: %s\n", us->protocol_name); in usb_stor_probe2()
1103 if (us->fflags & US_FL_SCM_MULT_TARG) { in usb_stor_probe2()
1108 us->max_lun = 7; in usb_stor_probe2()
1110 us_to_host(us)->this_id = 7; in usb_stor_probe2()
1114 us_to_host(us)->max_id = 1; in usb_stor_probe2()
1117 * SCSI-2 devices using the Bulk-Only transport (even though in usb_stor_probe2()
1120 if (us->transport == usb_stor_Bulk_transport) in usb_stor_probe2()
1121 us_to_host(us)->no_scsi2_lun_in_cdb = 1; in usb_stor_probe2()
1124 /* fix for single-lun devices */ in usb_stor_probe2()
1125 if (us->fflags & US_FL_SINGLE_LUN) in usb_stor_probe2()
1126 us->max_lun = 0; in usb_stor_probe2()
1129 result = get_pipes(us); in usb_stor_probe2()
1137 if (us->fflags & US_FL_INITIAL_READ10) in usb_stor_probe2()
1138 set_bit(US_FLIDX_REDO_READ10, &us->dflags); in usb_stor_probe2()
1141 result = usb_stor_acquire_resources(us); in usb_stor_probe2()
1144 usb_autopm_get_interface_no_resume(us->pusb_intf); in usb_stor_probe2()
1145 snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s", in usb_stor_probe2()
1146 dev_name(&us->pusb_intf->dev)); in usb_stor_probe2()
1147 result = scsi_add_host(us_to_host(us), dev); in usb_stor_probe2()
1154 /* Submit the delayed_work for SCSI-device scanning */ in usb_stor_probe2()
1155 set_bit(US_FLIDX_SCAN_PENDING, &us->dflags); in usb_stor_probe2()
1159 queue_delayed_work(system_freezable_wq, &us->scan_dwork, in usb_stor_probe2()
1165 usb_autopm_put_interface_no_suspend(us->pusb_intf); in usb_stor_probe2()
1167 usb_stor_dbg(us, "storage_probe() failed\n"); in usb_stor_probe2()
1168 release_everything(us); in usb_stor_probe2()
1173 /* Handle a USB mass-storage disconnect */
1176 struct us_data *us = usb_get_intfdata(intf); in usb_stor_disconnect() local
1178 quiesce_and_remove_host(us); in usb_stor_disconnect()
1179 release_everything(us); in usb_stor_disconnect()
1190 struct us_data *us; in storage_probe() local
1197 return -ENXIO; in storage_probe()
1205 return -ENXIO; in storage_probe()
1217 unusual_dev = (id - usb_storage_usb_ids) + us_unusual_dev_list; in storage_probe()
1221 …dev_dbg(&intf->dev, "Use Bulk-Only transport with the Transparent SCSI protocol for dynamic id: 0x… in storage_probe()
1222 id->idVendor, id->idProduct); in storage_probe()
1225 result = usb_stor_probe1(&us, intf, id, unusual_dev, in storage_probe()
1232 result = usb_stor_probe2(us); in storage_probe()