aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/usb.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-05-01 15:35:18 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-21 18:15:53 -0400
commit7e4d6c387994294ac8198b624ee71e75de60dfd2 (patch)
tree09c8c519a6284f79c38f49347eb7fdf44d8de13e /drivers/usb/storage/usb.c
parent2742fd8899328345d97a3443fb787b051b79ebae (diff)
usb-storage: separate dynamic flags from fixed flags
This patch (as1089) separates out the dynamic atomic bitflags and the static bitfields in usb-storage. Until now the two sorts of flags have been sharing the same word; this has always been awkward. To help prevent possible confusion, the two new fields each have a different name from the original. us->fflags contains the fixed bitfields (mostly taken from the USB ID table in unusual_devs.h), and us->dflags contains the dynamic atomic bitflags (used with set_bit, test_bit, and so on). Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage/usb.c')
-rw-r--r--drivers/usb/storage/usb.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index e268aacb773..78c0c7ee6b9 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -321,7 +321,7 @@ static int usb_stor_control_thread(void * __us)
321 mutex_lock(&(us->dev_mutex)); 321 mutex_lock(&(us->dev_mutex));
322 322
323 /* if the device has disconnected, we are free to exit */ 323 /* if the device has disconnected, we are free to exit */
324 if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { 324 if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) {
325 US_DEBUGP("-- exiting\n"); 325 US_DEBUGP("-- exiting\n");
326 mutex_unlock(&us->dev_mutex); 326 mutex_unlock(&us->dev_mutex);
327 break; 327 break;
@@ -331,7 +331,7 @@ static int usb_stor_control_thread(void * __us)
331 scsi_lock(host); 331 scsi_lock(host);
332 332
333 /* has the command timed out *already* ? */ 333 /* has the command timed out *already* ? */
334 if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { 334 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
335 us->srb->result = DID_ABORT << 16; 335 us->srb->result = DID_ABORT << 16;
336 goto SkipForAbort; 336 goto SkipForAbort;
337 } 337 }
@@ -350,7 +350,7 @@ static int usb_stor_control_thread(void * __us)
350 * the maximum known LUN 350 * the maximum known LUN
351 */ 351 */
352 else if (us->srb->device->id && 352 else if (us->srb->device->id &&
353 !(us->flags & US_FL_SCM_MULT_TARG)) { 353 !(us->fflags & US_FL_SCM_MULT_TARG)) {
354 US_DEBUGP("Bad target number (%d:%d)\n", 354 US_DEBUGP("Bad target number (%d:%d)\n",
355 us->srb->device->id, us->srb->device->lun); 355 us->srb->device->id, us->srb->device->lun);
356 us->srb->result = DID_BAD_TARGET << 16; 356 us->srb->result = DID_BAD_TARGET << 16;
@@ -365,7 +365,7 @@ static int usb_stor_control_thread(void * __us)
365 /* Handle those devices which need us to fake 365 /* Handle those devices which need us to fake
366 * their inquiry data */ 366 * their inquiry data */
367 else if ((us->srb->cmnd[0] == INQUIRY) && 367 else if ((us->srb->cmnd[0] == INQUIRY) &&
368 (us->flags & US_FL_FIX_INQUIRY)) { 368 (us->fflags & US_FL_FIX_INQUIRY)) {
369 unsigned char data_ptr[36] = { 369 unsigned char data_ptr[36] = {
370 0x00, 0x80, 0x02, 0x02, 370 0x00, 0x80, 0x02, 0x02,
371 0x1F, 0x00, 0x00, 0x00}; 371 0x1F, 0x00, 0x00, 0x00};
@@ -403,12 +403,12 @@ SkipForAbort:
403 * the TIMED_OUT flag, not srb->result == DID_ABORT, because 403 * the TIMED_OUT flag, not srb->result == DID_ABORT, because
404 * the timeout might have occurred after the command had 404 * the timeout might have occurred after the command had
405 * already completed with a different result code. */ 405 * already completed with a different result code. */
406 if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { 406 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
407 complete(&(us->notify)); 407 complete(&(us->notify));
408 408
409 /* Allow USB transfers to resume */ 409 /* Allow USB transfers to resume */
410 clear_bit(US_FLIDX_ABORTING, &us->flags); 410 clear_bit(US_FLIDX_ABORTING, &us->dflags);
411 clear_bit(US_FLIDX_TIMED_OUT, &us->flags); 411 clear_bit(US_FLIDX_TIMED_OUT, &us->dflags);
412 } 412 }
413 413
414 /* finished working on this command */ 414 /* finished working on this command */
@@ -500,9 +500,9 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id)
500 us->protocol = (unusual_dev->useTransport == US_PR_DEVICE) ? 500 us->protocol = (unusual_dev->useTransport == US_PR_DEVICE) ?
501 idesc->bInterfaceProtocol : 501 idesc->bInterfaceProtocol :
502 unusual_dev->useTransport; 502 unusual_dev->useTransport;
503 us->flags = USB_US_ORIG_FLAGS(id->driver_info); 503 us->fflags = USB_US_ORIG_FLAGS(id->driver_info);
504 504
505 if (us->flags & US_FL_IGNORE_DEVICE) { 505 if (us->fflags & US_FL_IGNORE_DEVICE) {
506 printk(KERN_INFO USB_STORAGE "device ignored\n"); 506 printk(KERN_INFO USB_STORAGE "device ignored\n");
507 return -ENODEV; 507 return -ENODEV;
508 } 508 }
@@ -512,7 +512,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id)
512 * disable it if we're in full-speed 512 * disable it if we're in full-speed
513 */ 513 */
514 if (dev->speed != USB_SPEED_HIGH) 514 if (dev->speed != USB_SPEED_HIGH)
515 us->flags &= ~US_FL_GO_SLOW; 515 us->fflags &= ~US_FL_GO_SLOW;
516 516
517 /* Log a message if a non-generic unusual_dev entry contains an 517 /* Log a message if a non-generic unusual_dev entry contains an
518 * unnecessary subclass or protocol override. This may stimulate 518 * unnecessary subclass or protocol override. This may stimulate
@@ -533,7 +533,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id)
533 if (unusual_dev->useTransport != US_PR_DEVICE && 533 if (unusual_dev->useTransport != US_PR_DEVICE &&
534 us->protocol == idesc->bInterfaceProtocol) 534 us->protocol == idesc->bInterfaceProtocol)
535 msg += 2; 535 msg += 2;
536 if (msg >= 0 && !(us->flags & US_FL_NEED_OVERRIDE)) 536 if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE))
537 printk(KERN_NOTICE USB_STORAGE "This device " 537 printk(KERN_NOTICE USB_STORAGE "This device "
538 "(%04x,%04x,%04x S %02x P %02x)" 538 "(%04x,%04x,%04x S %02x P %02x)"
539 " has %s in unusual_devs.h (kernel" 539 " has %s in unusual_devs.h (kernel"
@@ -663,7 +663,7 @@ static int get_transport(struct us_data *us)
663 US_DEBUGP("Transport: %s\n", us->transport_name); 663 US_DEBUGP("Transport: %s\n", us->transport_name);
664 664
665 /* fix for single-lun devices */ 665 /* fix for single-lun devices */
666 if (us->flags & US_FL_SINGLE_LUN) 666 if (us->fflags & US_FL_SINGLE_LUN)
667 us->max_lun = 0; 667 us->max_lun = 0;
668 return 0; 668 return 0;
669} 669}
@@ -824,7 +824,7 @@ static void usb_stor_release_resources(struct us_data *us)
824 * any more commands. 824 * any more commands.
825 */ 825 */
826 US_DEBUGP("-- sending exit command to thread\n"); 826 US_DEBUGP("-- sending exit command to thread\n");
827 set_bit(US_FLIDX_DISCONNECTING, &us->flags); 827 set_bit(US_FLIDX_DISCONNECTING, &us->dflags);
828 up(&us->sema); 828 up(&us->sema);
829 if (us->ctl_thread) 829 if (us->ctl_thread)
830 kthread_stop(us->ctl_thread); 830 kthread_stop(us->ctl_thread);
@@ -868,7 +868,7 @@ static void quiesce_and_remove_host(struct us_data *us)
868 /* Prevent new USB transfers, stop the current command, and 868 /* Prevent new USB transfers, stop the current command, and
869 * interrupt a SCSI-scan or device-reset delay */ 869 * interrupt a SCSI-scan or device-reset delay */
870 scsi_lock(host); 870 scsi_lock(host);
871 set_bit(US_FLIDX_DISCONNECTING, &us->flags); 871 set_bit(US_FLIDX_DISCONNECTING, &us->dflags);
872 scsi_unlock(host); 872 scsi_unlock(host);
873 usb_stor_stop_transport(us); 873 usb_stor_stop_transport(us);
874 wake_up(&us->delay_wait); 874 wake_up(&us->delay_wait);
@@ -919,16 +919,16 @@ static int usb_stor_scan_thread(void * __us)
919 printk(KERN_DEBUG "usb-storage: waiting for device " 919 printk(KERN_DEBUG "usb-storage: waiting for device "
920 "to settle before scanning\n"); 920 "to settle before scanning\n");
921 wait_event_freezable_timeout(us->delay_wait, 921 wait_event_freezable_timeout(us->delay_wait,
922 test_bit(US_FLIDX_DISCONNECTING, &us->flags), 922 test_bit(US_FLIDX_DISCONNECTING, &us->dflags),
923 delay_use * HZ); 923 delay_use * HZ);
924 } 924 }
925 925
926 /* If the device is still connected, perform the scanning */ 926 /* If the device is still connected, perform the scanning */
927 if (!test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { 927 if (!test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) {
928 928
929 /* For bulk-only devices, determine the max LUN value */ 929 /* For bulk-only devices, determine the max LUN value */
930 if (us->protocol == US_PR_BULK && 930 if (us->protocol == US_PR_BULK &&
931 !(us->flags & US_FL_SINGLE_LUN)) { 931 !(us->fflags & US_FL_SINGLE_LUN)) {
932 mutex_lock(&us->dev_mutex); 932 mutex_lock(&us->dev_mutex);
933 us->max_lun = usb_stor_Bulk_max_lun(us); 933 us->max_lun = usb_stor_Bulk_max_lun(us);
934 mutex_unlock(&us->dev_mutex); 934 mutex_unlock(&us->dev_mutex);