Lines 736-761
Link Here
|
736 |
return -ENOMEM; |
736 |
return -ENOMEM; |
737 |
} |
737 |
} |
738 |
|
738 |
|
739 |
/* Lock the device while we carry out the next two operations */ |
|
|
740 |
down(&us->dev_semaphore); |
741 |
|
742 |
/* For bulk-only devices, determine the max LUN value */ |
743 |
if (us->protocol == US_PR_BULK) { |
744 |
p = usb_stor_Bulk_max_lun(us); |
745 |
if (p < 0) { |
746 |
up(&us->dev_semaphore); |
747 |
return p; |
748 |
} |
749 |
us->max_lun = p; |
750 |
} |
751 |
|
752 |
/* Just before we start our control thread, initialize |
739 |
/* Just before we start our control thread, initialize |
753 |
* the device if it needs initialization */ |
740 |
* the device if it needs initialization */ |
754 |
if (us->unusual_dev->initFunction) |
741 |
if (us->unusual_dev->initFunction) |
755 |
us->unusual_dev->initFunction(us); |
742 |
us->unusual_dev->initFunction(us); |
756 |
|
743 |
|
757 |
up(&us->dev_semaphore); |
|
|
758 |
|
759 |
/* Start up our control thread */ |
744 |
/* Start up our control thread */ |
760 |
p = kernel_thread(usb_stor_control_thread, us, CLONE_VM); |
745 |
p = kernel_thread(usb_stor_control_thread, us, CLONE_VM); |
761 |
if (p < 0) { |
746 |
if (p < 0) { |
Lines 865-870
Link Here
|
865 |
|
850 |
|
866 |
/* If the device is still connected, perform the scanning */ |
851 |
/* If the device is still connected, perform the scanning */ |
867 |
if (!test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { |
852 |
if (!test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { |
|
|
853 |
|
854 |
/* For bulk-only devices, determine the max LUN value */ |
855 |
if (us->protocol == US_PR_BULK && |
856 |
!(us->flags & US_FL_SINGLE_LUN)) { |
857 |
down(&us->dev_semaphore); |
858 |
us->max_lun = usb_stor_Bulk_max_lun(us); |
859 |
up(&us->dev_semaphore); |
860 |
} |
868 |
scsi_scan_host(us_to_host(us)); |
861 |
scsi_scan_host(us_to_host(us)); |
869 |
printk(KERN_DEBUG "usb-storage: device scan complete\n"); |
862 |
printk(KERN_DEBUG "usb-storage: device scan complete\n"); |
870 |
} |
863 |
} |