Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 10824
b: refs/heads/master
c: b876aef
h: refs/heads/master
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Oct 28, 2005
1 parent c70fd78 commit 597ed03
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 423e489d704d05c6e8c2927fb1854db85914912a
refs/heads/master: b876aef7f890d8c59a45b78858a36cf60fddf522
1 change: 1 addition & 0 deletions trunk/drivers/usb/storage/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ int usb_stor_Bulk_max_lun(struct us_data *us)
int result;

/* issue the command */
us->iobuf[0] = 0;
result = usb_stor_control_msg(us, us->recv_ctrl_pipe,
US_BULK_GET_MAX_LUN,
USB_DIR_IN | USB_TYPE_CLASS |
Expand Down
30 changes: 13 additions & 17 deletions trunk/drivers/usb/storage/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,25 +747,13 @@ static int usb_stor_acquire_resources(struct us_data *us)
return -ENOMEM;
}

/* Lock the device while we carry out the next two operations */
down(&us->dev_semaphore);

/* For bulk-only devices, determine the max LUN value */
if (us->protocol == US_PR_BULK) {
p = usb_stor_Bulk_max_lun(us);
if (p < 0) {
up(&us->dev_semaphore);
return p;
}
us->max_lun = p;
}

/* Just before we start our control thread, initialize
* the device if it needs initialization */
if (us->unusual_dev->initFunction)
us->unusual_dev->initFunction(us);

up(&us->dev_semaphore);
if (us->unusual_dev->initFunction) {
p = us->unusual_dev->initFunction(us);
if (p)
return p;
}

/* Start up our control thread */
p = kernel_thread(usb_stor_control_thread, us, CLONE_VM);
Expand Down Expand Up @@ -904,6 +892,14 @@ static int usb_stor_scan_thread(void * __us)

/* If the device is still connected, perform the scanning */
if (!test_bit(US_FLIDX_DISCONNECTING, &us->flags)) {

/* For bulk-only devices, determine the max LUN value */
if (us->protocol == US_PR_BULK &&
!(us->flags & US_FL_SINGLE_LUN)) {
down(&us->dev_semaphore);
us->max_lun = usb_stor_Bulk_max_lun(us);
up(&us->dev_semaphore);
}
scsi_scan_host(us_to_host(us));
printk(KERN_DEBUG "usb-storage: device scan complete\n");

Expand Down

0 comments on commit 597ed03

Please sign in to comment.