diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2008-05-01 23:35:18 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-22 02:15:53 +0400 |
commit | 7e4d6c387994294ac8198b624ee71e75de60dfd2 (patch) | |
tree | 09c8c519a6284f79c38f49347eb7fdf44d8de13e /drivers/usb/storage | |
parent | 2742fd8899328345d97a3443fb787b051b79ebae (diff) | |
download | linux-7e4d6c387994294ac8198b624ee71e75de60dfd2.tar.xz |
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')
-rw-r--r-- | drivers/usb/storage/isd200.c | 6 | ||||
-rw-r--r-- | drivers/usb/storage/scsiglue.c | 24 | ||||
-rw-r--r-- | drivers/usb/storage/transport.c | 68 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 34 | ||||
-rw-r--r-- | drivers/usb/storage/usb.h | 17 |
5 files changed, 75 insertions, 74 deletions
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index 3addcd8f827b..a153335f3648 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c @@ -586,7 +586,7 @@ static void isd200_invoke_transport( struct us_data *us, /* if the command gets aborted by the higher layers, we need to * short-circuit all other processing */ - if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { + if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { US_DEBUGP("-- command was aborted\n"); goto Handle_Abort; } @@ -633,7 +633,7 @@ static void isd200_invoke_transport( struct us_data *us, if (need_auto_sense) { result = isd200_read_regs(us); - if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { + if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { US_DEBUGP("-- auto-sense aborted\n"); goto Handle_Abort; } @@ -663,7 +663,7 @@ static void isd200_invoke_transport( struct us_data *us, srb->result = DID_ABORT << 16; /* permit the reset transfer to take place */ - clear_bit(US_FLIDX_ABORTING, &us->flags); + clear_bit(US_FLIDX_ABORTING, &us->dflags); /* Need reset here */ } diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 3fcde9f0fa5f..1caf3f7af349 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -116,10 +116,10 @@ static int slave_configure(struct scsi_device *sdev) * while others have trouble with more than 64K. At this time we * are limiting both to 32K (64 sectores). */ - if (us->flags & (US_FL_MAX_SECTORS_64 | US_FL_MAX_SECTORS_MIN)) { + if (us->fflags & (US_FL_MAX_SECTORS_64 | US_FL_MAX_SECTORS_MIN)) { unsigned int max_sectors = 64; - if (us->flags & US_FL_MAX_SECTORS_MIN) + if (us->fflags & US_FL_MAX_SECTORS_MIN) max_sectors = PAGE_CACHE_SIZE >> 9; if (sdev->request_queue->max_sectors > max_sectors) blk_queue_max_sectors(sdev->request_queue, @@ -148,7 +148,7 @@ static int slave_configure(struct scsi_device *sdev) * majority of devices work fine, but a few still can't * handle it. The sd driver will simply assume those * devices are write-enabled. */ - if (us->flags & US_FL_NO_WP_DETECT) + if (us->fflags & US_FL_NO_WP_DETECT) sdev->skip_ms_page_3f = 1; /* A number of devices have problems with MODE SENSE for @@ -158,13 +158,13 @@ static int slave_configure(struct scsi_device *sdev) /* Some disks return the total number of blocks in response * to READ CAPACITY rather than the highest block number. * If this device makes that mistake, tell the sd driver. */ - if (us->flags & US_FL_FIX_CAPACITY) + if (us->fflags & US_FL_FIX_CAPACITY) sdev->fix_capacity = 1; /* A few disks have two indistinguishable version, one of * which reports the correct capacity and the other does not. * The sd driver has to guess which is the case. */ - if (us->flags & US_FL_CAPACITY_HEURISTICS) + if (us->fflags & US_FL_CAPACITY_HEURISTICS) sdev->guess_capacity = 1; /* Some devices report a SCSI revision level above 2 but are @@ -213,7 +213,7 @@ static int slave_configure(struct scsi_device *sdev) /* Some devices choke when they receive a PREVENT-ALLOW MEDIUM * REMOVAL command, so suppress those commands. */ - if (us->flags & US_FL_NOT_LOCKABLE) + if (us->fflags & US_FL_NOT_LOCKABLE) sdev->lockable = 0; /* this is to satisfy the compiler, tho I don't think the @@ -238,7 +238,7 @@ static int queuecommand(struct scsi_cmnd *srb, } /* fail the command if we are disconnecting */ - if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { + if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { US_DEBUGP("Fail command during disconnect\n"); srb->result = DID_NO_CONNECT << 16; done(srb); @@ -280,9 +280,9 @@ static int command_abort(struct scsi_cmnd *srb) * with the reset). Note that we must retain the host lock while * calling usb_stor_stop_transport(); otherwise it might interfere * with an auto-reset that begins as soon as we release the lock. */ - set_bit(US_FLIDX_TIMED_OUT, &us->flags); - if (!test_bit(US_FLIDX_RESETTING, &us->flags)) { - set_bit(US_FLIDX_ABORTING, &us->flags); + set_bit(US_FLIDX_TIMED_OUT, &us->dflags); + if (!test_bit(US_FLIDX_RESETTING, &us->dflags)) { + set_bit(US_FLIDX_ABORTING, &us->dflags); usb_stor_stop_transport(us); } scsi_unlock(us_to_host(us)); @@ -329,7 +329,7 @@ void usb_stor_report_device_reset(struct us_data *us) struct Scsi_Host *host = us_to_host(us); scsi_report_device_reset(host, 0, 0); - if (us->flags & US_FL_SCM_MULT_TARG) { + if (us->fflags & US_FL_SCM_MULT_TARG) { for (i = 1; i < host->max_id; ++i) scsi_report_device_reset(host, 0, i); } @@ -400,7 +400,7 @@ static int proc_info (struct Scsi_Host *host, char *buffer, pos += sprintf(pos, " Quirks:"); #define US_FLAG(name, value) \ - if (us->flags & value) pos += sprintf(pos, " " #name); + if (us->fflags & value) pos += sprintf(pos, " " #name); US_DO_ALL_FLAGS #undef US_FLAG diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 6610d2dd1e7f..2f88bb958bad 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c @@ -75,14 +75,14 @@ * by a separate code path.) * * The abort function (usb_storage_command_abort() in scsiglue.c) first - * sets the machine state and the ABORTING bit in us->flags to prevent + * sets the machine state and the ABORTING bit in us->dflags to prevent * new URBs from being submitted. It then calls usb_stor_stop_transport() - * below, which atomically tests-and-clears the URB_ACTIVE bit in us->flags + * below, which atomically tests-and-clears the URB_ACTIVE bit in us->dflags * to see if the current_urb needs to be stopped. Likewise, the SG_ACTIVE * bit is tested to see if the current_sg scatter-gather request needs to be * stopped. The timeout callback routine does much the same thing. * - * When a disconnect occurs, the DISCONNECTING bit in us->flags is set to + * When a disconnect occurs, the DISCONNECTING bit in us->dflags is set to * prevent new URBs from being submitted, and usb_stor_stop_transport() is * called to stop any ongoing requests. * @@ -128,7 +128,7 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) int status; /* don't submit URBs during abort/disconnect processing */ - if (us->flags & ABORTING_OR_DISCONNECTING) + if (us->dflags & ABORTING_OR_DISCONNECTING) return -EIO; /* set up data structures for the wakeup system */ @@ -159,13 +159,13 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) /* since the URB has been submitted successfully, it's now okay * to cancel it */ - set_bit(US_FLIDX_URB_ACTIVE, &us->flags); + set_bit(US_FLIDX_URB_ACTIVE, &us->dflags); /* did an abort/disconnect occur during the submission? */ - if (us->flags & ABORTING_OR_DISCONNECTING) { + if (us->dflags & ABORTING_OR_DISCONNECTING) { /* cancel the URB, if it hasn't been cancelled already */ - if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->flags)) { + if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->dflags)) { US_DEBUGP("-- cancelling URB\n"); usb_unlink_urb(us->current_urb); } @@ -175,7 +175,7 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) timeleft = wait_for_completion_interruptible_timeout( &urb_done, timeout ? : MAX_SCHEDULE_TIMEOUT); - clear_bit(US_FLIDX_URB_ACTIVE, &us->flags); + clear_bit(US_FLIDX_URB_ACTIVE, &us->dflags); if (timeleft <= 0) { US_DEBUGP("%s -- cancelling URB\n", @@ -420,7 +420,7 @@ static int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe, int result; /* don't submit s-g requests during abort/disconnect processing */ - if (us->flags & ABORTING_OR_DISCONNECTING) + if (us->dflags & ABORTING_OR_DISCONNECTING) return USB_STOR_XFER_ERROR; /* initialize the scatter-gather request block */ @@ -435,13 +435,13 @@ static int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe, /* since the block has been initialized successfully, it's now * okay to cancel it */ - set_bit(US_FLIDX_SG_ACTIVE, &us->flags); + set_bit(US_FLIDX_SG_ACTIVE, &us->dflags); /* did an abort/disconnect occur during the submission? */ - if (us->flags & ABORTING_OR_DISCONNECTING) { + if (us->dflags & ABORTING_OR_DISCONNECTING) { /* cancel the request, if it hasn't been cancelled already */ - if (test_and_clear_bit(US_FLIDX_SG_ACTIVE, &us->flags)) { + if (test_and_clear_bit(US_FLIDX_SG_ACTIVE, &us->dflags)) { US_DEBUGP("-- cancelling sg request\n"); usb_sg_cancel(&us->current_sg); } @@ -449,7 +449,7 @@ static int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe, /* wait for the completion of the transfer */ usb_sg_wait(&us->current_sg); - clear_bit(US_FLIDX_SG_ACTIVE, &us->flags); + clear_bit(US_FLIDX_SG_ACTIVE, &us->dflags); result = us->current_sg.status; if (act_len) @@ -530,7 +530,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) /* if the command gets aborted by the higher layers, we need to * short-circuit all other processing */ - if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { + if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { US_DEBUGP("-- command was aborted\n"); srb->result = DID_ABORT << 16; goto Handle_Errors; @@ -616,7 +616,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) /* let's clean up right away */ scsi_eh_restore_cmnd(srb, &ses); - if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { + if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { US_DEBUGP("-- auto-sense aborted\n"); srb->result = DID_ABORT << 16; goto Handle_Errors; @@ -629,7 +629,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) * auto-sense is perfectly valid */ srb->result = DID_ERROR << 16; - if (!(us->flags & US_FL_SCM_MULT_TARG)) + if (!(us->fflags & US_FL_SCM_MULT_TARG)) goto Handle_Errors; return; } @@ -679,8 +679,8 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) /* Set the RESETTING bit, and clear the ABORTING bit so that * the reset may proceed. */ scsi_lock(us_to_host(us)); - set_bit(US_FLIDX_RESETTING, &us->flags); - clear_bit(US_FLIDX_ABORTING, &us->flags); + set_bit(US_FLIDX_RESETTING, &us->dflags); + clear_bit(US_FLIDX_ABORTING, &us->dflags); scsi_unlock(us_to_host(us)); /* We must release the device lock because the pre_reset routine @@ -695,7 +695,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) scsi_unlock(us_to_host(us)); us->transport_reset(us); } - clear_bit(US_FLIDX_RESETTING, &us->flags); + clear_bit(US_FLIDX_RESETTING, &us->dflags); } /* Stop the current URB transfer */ @@ -707,13 +707,13 @@ void usb_stor_stop_transport(struct us_data *us) * let's wake it up. The test_and_clear_bit() call * guarantees that if a URB has just been submitted, * it won't be cancelled more than once. */ - if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->flags)) { + if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->dflags)) { US_DEBUGP("-- cancelling URB\n"); usb_unlink_urb(us->current_urb); } /* If we are waiting for a scatter-gather operation, cancel it. */ - if (test_and_clear_bit(US_FLIDX_SG_ACTIVE, &us->flags)) { + if (test_and_clear_bit(US_FLIDX_SG_ACTIVE, &us->dflags)) { US_DEBUGP("-- cancelling sg request\n"); usb_sg_cancel(&us->current_sg); } @@ -914,7 +914,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) unsigned int cbwlen = US_BULK_CB_WRAP_LEN; /* Take care of BULK32 devices; set extra byte to 0 */ - if ( unlikely(us->flags & US_FL_BULK32)) { + if (unlikely(us->fflags & US_FL_BULK32)) { cbwlen = 32; us->iobuf[31] = 0; } @@ -925,7 +925,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ? 1 << 7 : 0; bcb->Tag = ++us->tag; bcb->Lun = srb->device->lun; - if (us->flags & US_FL_SCM_MULT_TARG) + if (us->fflags & US_FL_SCM_MULT_TARG) bcb->Lun |= srb->device->id << 4; bcb->Length = srb->cmd_len; @@ -951,7 +951,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) /* Some USB-IDE converter chips need a 100us delay between the * command phase and the data phase. Some devices need a little * more than that, probably because of clock rate inaccuracies. */ - if (unlikely(us->flags & US_FL_GO_SLOW)) + if (unlikely(us->fflags & US_FL_GO_SLOW)) udelay(125); if (transfer_length) { @@ -1010,7 +1010,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", le32_to_cpu(bcs->Signature), bcs->Tag, residue, bcs->Status); - if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) || + if (!(bcs->Tag == us->tag || (us->fflags & US_FL_BULK_IGNORE_TAG)) || bcs->Status > US_BULK_STAT_PHASE) { US_DEBUGP("Bulk logical error\n"); return USB_STOR_TRANSPORT_ERROR; @@ -1035,7 +1035,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) /* try to compute the actual residue, based on how much data * was really transferred and what the device tells us */ if (residue) { - if (!(us->flags & US_FL_IGNORE_RESIDUE)) { + if (!(us->fflags & US_FL_IGNORE_RESIDUE)) { residue = min(residue, transfer_length); scsi_set_resid(srb, max(scsi_get_resid(srb), (int) residue)); @@ -1090,7 +1090,7 @@ static int usb_stor_reset_common(struct us_data *us, int result; int result2; - if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { + if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { US_DEBUGP("No reset during disconnect\n"); return -EIO; } @@ -1103,12 +1103,12 @@ static int usb_stor_reset_common(struct us_data *us, return result; } - /* Give the device some time to recover from the reset, - * but don't delay disconnect processing. */ - wait_event_interruptible_timeout(us->delay_wait, - test_bit(US_FLIDX_DISCONNECTING, &us->flags), - HZ*6); - if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { + /* Give the device some time to recover from the reset, + * but don't delay disconnect processing. */ + wait_event_interruptible_timeout(us->delay_wait, + test_bit(US_FLIDX_DISCONNECTING, &us->dflags), + HZ*6); + if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { US_DEBUGP("Reset interrupted by disconnect\n"); return -EIO; } @@ -1170,7 +1170,7 @@ int usb_stor_port_reset(struct us_data *us) US_DEBUGP("unable to lock device for reset: %d\n", result); else { /* Were we disconnected while waiting for the lock? */ - if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { + if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { result = -EIO; US_DEBUGP("No reset during disconnect\n"); } else { diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index e268aacb773a..78c0c7ee6b99 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) mutex_lock(&(us->dev_mutex)); /* if the device has disconnected, we are free to exit */ - if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { + if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { US_DEBUGP("-- exiting\n"); mutex_unlock(&us->dev_mutex); break; @@ -331,7 +331,7 @@ static int usb_stor_control_thread(void * __us) scsi_lock(host); /* has the command timed out *already* ? */ - if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { + if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { us->srb->result = DID_ABORT << 16; goto SkipForAbort; } @@ -350,7 +350,7 @@ static int usb_stor_control_thread(void * __us) * the maximum known LUN */ else if (us->srb->device->id && - !(us->flags & US_FL_SCM_MULT_TARG)) { + !(us->fflags & US_FL_SCM_MULT_TARG)) { US_DEBUGP("Bad target number (%d:%d)\n", us->srb->device->id, us->srb->device->lun); us->srb->result = DID_BAD_TARGET << 16; @@ -365,7 +365,7 @@ static int usb_stor_control_thread(void * __us) /* Handle those devices which need us to fake * their inquiry data */ else if ((us->srb->cmnd[0] == INQUIRY) && - (us->flags & US_FL_FIX_INQUIRY)) { + (us->fflags & US_FL_FIX_INQUIRY)) { unsigned char data_ptr[36] = { 0x00, 0x80, 0x02, 0x02, 0x1F, 0x00, 0x00, 0x00}; @@ -403,12 +403,12 @@ SkipForAbort: * the TIMED_OUT flag, not srb->result == DID_ABORT, because * the timeout might have occurred after the command had * already completed with a different result code. */ - if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { + if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { complete(&(us->notify)); /* Allow USB transfers to resume */ - clear_bit(US_FLIDX_ABORTING, &us->flags); - clear_bit(US_FLIDX_TIMED_OUT, &us->flags); + clear_bit(US_FLIDX_ABORTING, &us->dflags); + clear_bit(US_FLIDX_TIMED_OUT, &us->dflags); } /* finished working on this command */ @@ -500,9 +500,9 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id) us->protocol = (unusual_dev->useTransport == US_PR_DEVICE) ? idesc->bInterfaceProtocol : unusual_dev->useTransport; - us->flags = USB_US_ORIG_FLAGS(id->driver_info); + us->fflags = USB_US_ORIG_FLAGS(id->driver_info); - if (us->flags & US_FL_IGNORE_DEVICE) { + if (us->fflags & US_FL_IGNORE_DEVICE) { printk(KERN_INFO USB_STORAGE "device ignored\n"); return -ENODEV; } @@ -512,7 +512,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id) * disable it if we're in full-speed */ if (dev->speed != USB_SPEED_HIGH) - us->flags &= ~US_FL_GO_SLOW; + us->fflags &= ~US_FL_GO_SLOW; /* Log a message if a non-generic unusual_dev entry contains an * 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) if (unusual_dev->useTransport != US_PR_DEVICE && us->protocol == idesc->bInterfaceProtocol) msg += 2; - if (msg >= 0 && !(us->flags & US_FL_NEED_OVERRIDE)) + if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE)) printk(KERN_NOTICE USB_STORAGE "This device " "(%04x,%04x,%04x S %02x P %02x)" " has %s in unusual_devs.h (kernel" @@ -663,7 +663,7 @@ static int get_transport(struct us_data *us) US_DEBUGP("Transport: %s\n", us->transport_name); /* fix for single-lun devices */ - if (us->flags & US_FL_SINGLE_LUN) + if (us->fflags & US_FL_SINGLE_LUN) us->max_lun = 0; return 0; } @@ -824,7 +824,7 @@ static void usb_stor_release_resources(struct us_data *us) * any more commands. */ US_DEBUGP("-- sending exit command to thread\n"); - set_bit(US_FLIDX_DISCONNECTING, &us->flags); + set_bit(US_FLIDX_DISCONNECTING, &us->dflags); up(&us->sema); if (us->ctl_thread) kthread_stop(us->ctl_thread); @@ -868,7 +868,7 @@ static void quiesce_and_remove_host(struct us_data *us) /* Prevent new USB transfers, stop the current command, and * interrupt a SCSI-scan or device-reset delay */ scsi_lock(host); - set_bit(US_FLIDX_DISCONNECTING, &us->flags); + set_bit(US_FLIDX_DISCONNECTING, &us->dflags); scsi_unlock(host); usb_stor_stop_transport(us); wake_up(&us->delay_wait); @@ -919,16 +919,16 @@ static int usb_stor_scan_thread(void * __us) printk(KERN_DEBUG "usb-storage: waiting for device " "to settle before scanning\n"); wait_event_freezable_timeout(us->delay_wait, - test_bit(US_FLIDX_DISCONNECTING, &us->flags), + test_bit(US_FLIDX_DISCONNECTING, &us->dflags), delay_use * HZ); } /* If the device is still connected, perform the scanning */ - if (!test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { + if (!test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { /* For bulk-only devices, determine the max LUN value */ if (us->protocol == US_PR_BULK && - !(us->flags & US_FL_SINGLE_LUN)) { + !(us->fflags & US_FL_SINGLE_LUN)) { mutex_lock(&us->dev_mutex); us->max_lun = usb_stor_Bulk_max_lun(us); mutex_unlock(&us->dev_mutex); diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h index 8d87503e2560..b169132f021b 100644 --- a/drivers/usb/storage/usb.h +++ b/drivers/usb/storage/usb.h @@ -67,15 +67,15 @@ struct us_unusual_dev { }; -/* Dynamic flag definitions: used in set_bit() etc. */ -#define US_FLIDX_URB_ACTIVE 18 /* 0x00040000 current_urb is in use */ -#define US_FLIDX_SG_ACTIVE 19 /* 0x00080000 current_sg is in use */ -#define US_FLIDX_ABORTING 20 /* 0x00100000 abort is in progress */ -#define US_FLIDX_DISCONNECTING 21 /* 0x00200000 disconnect in progress */ +/* Dynamic bitflag definitions (us->dflags): used in set_bit() etc. */ +#define US_FLIDX_URB_ACTIVE 0 /* current_urb is in use */ +#define US_FLIDX_SG_ACTIVE 1 /* current_sg is in use */ +#define US_FLIDX_ABORTING 2 /* abort is in progress */ +#define US_FLIDX_DISCONNECTING 3 /* disconnect in progress */ #define ABORTING_OR_DISCONNECTING ((1UL << US_FLIDX_ABORTING) | \ (1UL << US_FLIDX_DISCONNECTING)) -#define US_FLIDX_RESETTING 22 /* 0x00400000 device reset in progress */ -#define US_FLIDX_TIMED_OUT 23 /* 0x00800000 SCSI midlayer timed out */ +#define US_FLIDX_RESETTING 4 /* device reset in progress */ +#define US_FLIDX_TIMED_OUT 5 /* SCSI midlayer timed out */ #define USB_STOR_STRING_LEN 32 @@ -109,7 +109,8 @@ struct us_data { struct usb_device *pusb_dev; /* this usb_device */ struct usb_interface *pusb_intf; /* this interface */ struct us_unusual_dev *unusual_dev; /* device-filter entry */ - unsigned long flags; /* from filter initially */ + unsigned long fflags; /* fixed flags from filter */ + unsigned long dflags; /* dynamic atomic bitflags */ unsigned int send_bulk_pipe; /* cached pipe values */ unsigned int recv_bulk_pipe; unsigned int send_ctrl_pipe; |