diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-21 18:42:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-21 18:42:53 -0400 |
commit | 93ded9b8fd42abe2c3607097963d8de6ad9117eb (patch) | |
tree | 407a3adcf885ffd75a4d3299eaefd9b171b739be /drivers/usb/storage | |
parent | 6d52dcbe56ca8464bcad56d98a64bcd781596663 (diff) | |
parent | f756cbd458ab71c996a069cb3928fb1e2d7cd9cc (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (100 commits)
usb-storage: revert DMA-alignment change for Wireless USB
USB: use reset_resume when normal resume fails
usb_gadget: composite cdc gadget fault handling
usb gadget: minor USBCV fix for composite framework
USB: Fix bug with byte order in isp116x-hcd.c fio write/read
USB: fix double kfree in ipaq in error case
USB: fix build error in cdc-acm for CONFIG_PM=n
USB: remove board-specific UP2OCR configuration from pxa27x-udc
USB: EHCI: Reconciling USB register differences on MPC85xx vs MPC83xx
USB: Fix pointer/int cast in USB devio code
usb gadget: g_cdc dependso on NET
USB: Au1xxx-usb: suspend/resume support.
USB: Au1xxx-usb: clean up ohci/ehci bus glue sources.
usbfs: don't store bad pointers in registration
usbfs: fix race between open and unregister
usbfs: simplify the lookup-by-minor routines
usbfs: send disconnect signals when device is unregistered
USB: Force unbinding of drivers lacking reset_resume or other methods
USB: ohci-pnx4008: I2C cleanups and fixes
USB: debug port converter does not accept more than 8 byte packets
...
Diffstat (limited to 'drivers/usb/storage')
26 files changed, 145 insertions, 187 deletions
diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c index 579e9f52053a..17f1ae232919 100644 --- a/drivers/usb/storage/datafab.c +++ b/drivers/usb/storage/datafab.c | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Driver for Datafab USB Compact Flash reader | 1 | /* Driver for Datafab USB Compact Flash reader |
2 | * | 2 | * |
3 | * $Id: datafab.c,v 1.7 2002/02/25 00:40:13 mdharm Exp $ | ||
4 | * | ||
5 | * datafab driver v0.1: | 3 | * datafab driver v0.1: |
6 | * | 4 | * |
7 | * First release | 5 | * First release |
diff --git a/drivers/usb/storage/debug.c b/drivers/usb/storage/debug.c index 01e430654a13..a2b5526c9fa0 100644 --- a/drivers/usb/storage/debug.c +++ b/drivers/usb/storage/debug.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Driver for USB Mass Storage compliant devices | 1 | /* Driver for USB Mass Storage compliant devices |
2 | * Debugging Functions Source Code File | 2 | * Debugging Functions Source Code File |
3 | * | 3 | * |
4 | * $Id: debug.c,v 1.9 2002/04/22 03:39:43 mdharm Exp $ | ||
5 | * | ||
6 | * Current development and maintenance by: | 4 | * Current development and maintenance by: |
7 | * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 5 | * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
8 | * | 6 | * |
diff --git a/drivers/usb/storage/debug.h b/drivers/usb/storage/debug.h index 77e244a8c376..dbb985d52423 100644 --- a/drivers/usb/storage/debug.h +++ b/drivers/usb/storage/debug.h | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Driver for USB Mass Storage compliant devices | 1 | /* Driver for USB Mass Storage compliant devices |
2 | * Debugging Functions Header File | 2 | * Debugging Functions Header File |
3 | * | 3 | * |
4 | * $Id: debug.h,v 1.6 2001/01/12 23:51:04 mdharm Exp $ | ||
5 | * | ||
6 | * Current development and maintenance by: | 4 | * Current development and maintenance by: |
7 | * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 5 | * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
8 | * | 6 | * |
diff --git a/drivers/usb/storage/dpcm.c b/drivers/usb/storage/dpcm.c index 9a410b5a6e5b..939923471af4 100644 --- a/drivers/usb/storage/dpcm.c +++ b/drivers/usb/storage/dpcm.c | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Driver for Microtech DPCM-USB CompactFlash/SmartMedia reader | 1 | /* Driver for Microtech DPCM-USB CompactFlash/SmartMedia reader |
2 | * | 2 | * |
3 | * $Id: dpcm.c,v 1.4 2001/06/11 02:54:25 mdharm Exp $ | ||
4 | * | ||
5 | * DPCM driver v0.1: | 3 | * DPCM driver v0.1: |
6 | * | 4 | * |
7 | * First release | 5 | * First release |
diff --git a/drivers/usb/storage/dpcm.h b/drivers/usb/storage/dpcm.h index 81b464cfcc1e..e7b7b0f120d7 100644 --- a/drivers/usb/storage/dpcm.h +++ b/drivers/usb/storage/dpcm.h | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Driver for Microtech DPCM-USB CompactFlash/SmartMedia reader | 1 | /* Driver for Microtech DPCM-USB CompactFlash/SmartMedia reader |
2 | * | 2 | * |
3 | * $Id: dpcm.h,v 1.2 2000/08/25 00:13:51 mdharm Exp $ | ||
4 | * | ||
5 | * DPCM driver v0.1: | 3 | * DPCM driver v0.1: |
6 | * | 4 | * |
7 | * First release | 5 | * First release |
diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c index f5a4e8d6a3b1..7a4d45677227 100644 --- a/drivers/usb/storage/freecom.c +++ b/drivers/usb/storage/freecom.c | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Driver for Freecom USB/IDE adaptor | 1 | /* Driver for Freecom USB/IDE adaptor |
2 | * | 2 | * |
3 | * $Id: freecom.c,v 1.22 2002/04/22 03:39:43 mdharm Exp $ | ||
4 | * | ||
5 | * Freecom v0.1: | 3 | * Freecom v0.1: |
6 | * | 4 | * |
7 | * First release | 5 | * First release |
diff --git a/drivers/usb/storage/freecom.h b/drivers/usb/storage/freecom.h index 1b012d62d0a8..20d0fe6ba0c8 100644 --- a/drivers/usb/storage/freecom.h +++ b/drivers/usb/storage/freecom.h | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Driver for Freecom USB/IDE adaptor | 1 | /* Driver for Freecom USB/IDE adaptor |
2 | * | 2 | * |
3 | * $Id: freecom.h,v 1.4 2000/08/29 14:49:15 dlbrown Exp $ | ||
4 | * | ||
5 | * Freecom v0.1: | 3 | * Freecom v0.1: |
6 | * | 4 | * |
7 | * First release | 5 | * First release |
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c index 187dd1e01093..4995bb595aef 100644 --- a/drivers/usb/storage/initializers.c +++ b/drivers/usb/storage/initializers.c | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Special Initializers for certain USB Mass Storage devices | 1 | /* Special Initializers for certain USB Mass Storage devices |
2 | * | 2 | * |
3 | * $Id: initializers.c,v 1.2 2000/09/06 22:35:57 mdharm Exp $ | ||
4 | * | ||
5 | * Current development and maintenance by: | 3 | * Current development and maintenance by: |
6 | * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 4 | * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
7 | * | 5 | * |
diff --git a/drivers/usb/storage/initializers.h b/drivers/usb/storage/initializers.h index ad3ffd4236c2..529327fbb06b 100644 --- a/drivers/usb/storage/initializers.h +++ b/drivers/usb/storage/initializers.h | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Header file for Special Initializers for certain USB Mass Storage devices | 1 | /* Header file for Special Initializers for certain USB Mass Storage devices |
2 | * | 2 | * |
3 | * $Id: initializers.h,v 1.1 2000/08/29 23:07:02 mdharm Exp $ | ||
4 | * | ||
5 | * Current development and maintenance by: | 3 | * Current development and maintenance by: |
6 | * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 4 | * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
7 | * | 5 | * |
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index 3addcd8f827b..383abf2516a5 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Transport & Protocol Driver for In-System Design, Inc. ISD200 ASIC | 1 | /* Transport & Protocol Driver for In-System Design, Inc. ISD200 ASIC |
2 | * | 2 | * |
3 | * $Id: isd200.c,v 1.16 2002/04/22 03:39:43 mdharm Exp $ | ||
4 | * | ||
5 | * Current development and maintenance: | 3 | * Current development and maintenance: |
6 | * (C) 2001-2002 Björn Stenberg (bjorn@haxx.se) | 4 | * (C) 2001-2002 Björn Stenberg (bjorn@haxx.se) |
7 | * | 5 | * |
@@ -586,7 +584,7 @@ static void isd200_invoke_transport( struct us_data *us, | |||
586 | /* if the command gets aborted by the higher layers, we need to | 584 | /* if the command gets aborted by the higher layers, we need to |
587 | * short-circuit all other processing | 585 | * short-circuit all other processing |
588 | */ | 586 | */ |
589 | if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { | 587 | if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { |
590 | US_DEBUGP("-- command was aborted\n"); | 588 | US_DEBUGP("-- command was aborted\n"); |
591 | goto Handle_Abort; | 589 | goto Handle_Abort; |
592 | } | 590 | } |
@@ -633,7 +631,7 @@ static void isd200_invoke_transport( struct us_data *us, | |||
633 | 631 | ||
634 | if (need_auto_sense) { | 632 | if (need_auto_sense) { |
635 | result = isd200_read_regs(us); | 633 | result = isd200_read_regs(us); |
636 | if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { | 634 | if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { |
637 | US_DEBUGP("-- auto-sense aborted\n"); | 635 | US_DEBUGP("-- auto-sense aborted\n"); |
638 | goto Handle_Abort; | 636 | goto Handle_Abort; |
639 | } | 637 | } |
@@ -663,7 +661,7 @@ static void isd200_invoke_transport( struct us_data *us, | |||
663 | srb->result = DID_ABORT << 16; | 661 | srb->result = DID_ABORT << 16; |
664 | 662 | ||
665 | /* permit the reset transfer to take place */ | 663 | /* permit the reset transfer to take place */ |
666 | clear_bit(US_FLIDX_ABORTING, &us->flags); | 664 | clear_bit(US_FLIDX_ABORTING, &us->dflags); |
667 | /* Need reset here */ | 665 | /* Need reset here */ |
668 | } | 666 | } |
669 | 667 | ||
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c index 61097cbb1585..df67f13c9e73 100644 --- a/drivers/usb/storage/jumpshot.c +++ b/drivers/usb/storage/jumpshot.c | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Driver for Lexar "Jumpshot" Compact Flash reader | 1 | /* Driver for Lexar "Jumpshot" Compact Flash reader |
2 | * | 2 | * |
3 | * $Id: jumpshot.c,v 1.7 2002/02/25 00:40:13 mdharm Exp $ | ||
4 | * | ||
5 | * jumpshot driver v0.1: | 3 | * jumpshot driver v0.1: |
6 | * | 4 | * |
7 | * First release | 5 | * First release |
diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c index b9b8ede61fb3..3b3357e20ea7 100644 --- a/drivers/usb/storage/protocol.c +++ b/drivers/usb/storage/protocol.c | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Driver for USB Mass Storage compliant devices | 1 | /* Driver for USB Mass Storage compliant devices |
2 | * | 2 | * |
3 | * $Id: protocol.c,v 1.14 2002/04/22 03:39:43 mdharm Exp $ | ||
4 | * | ||
5 | * Current development and maintenance by: | 3 | * Current development and maintenance by: |
6 | * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 4 | * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
7 | * | 5 | * |
diff --git a/drivers/usb/storage/protocol.h b/drivers/usb/storage/protocol.h index 8737a36891ca..487056ffb516 100644 --- a/drivers/usb/storage/protocol.h +++ b/drivers/usb/storage/protocol.h | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Driver for USB Mass Storage compliant devices | 1 | /* Driver for USB Mass Storage compliant devices |
2 | * Protocol Functions Header File | 2 | * Protocol Functions Header File |
3 | * | 3 | * |
4 | * $Id: protocol.h,v 1.4 2001/02/13 07:10:03 mdharm Exp $ | ||
5 | * | ||
6 | * Current development and maintenance by: | 4 | * Current development and maintenance by: |
7 | * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 5 | * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
8 | * | 6 | * |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 3fcde9f0fa5f..09779f6a8179 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Driver for USB Mass Storage compliant devices | 1 | /* Driver for USB Mass Storage compliant devices |
2 | * SCSI layer glue code | 2 | * SCSI layer glue code |
3 | * | 3 | * |
4 | * $Id: scsiglue.c,v 1.26 2002/04/22 03:39:43 mdharm Exp $ | ||
5 | * | ||
6 | * Current development and maintenance by: | 4 | * Current development and maintenance by: |
7 | * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 5 | * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
8 | * | 6 | * |
@@ -73,7 +71,6 @@ static const char* host_info(struct Scsi_Host *host) | |||
73 | static int slave_alloc (struct scsi_device *sdev) | 71 | static int slave_alloc (struct scsi_device *sdev) |
74 | { | 72 | { |
75 | struct us_data *us = host_to_us(sdev->host); | 73 | struct us_data *us = host_to_us(sdev->host); |
76 | struct usb_host_endpoint *bulk_in_ep; | ||
77 | 74 | ||
78 | /* | 75 | /* |
79 | * Set the INQUIRY transfer length to 36. We don't use any of | 76 | * Set the INQUIRY transfer length to 36. We don't use any of |
@@ -82,16 +79,22 @@ static int slave_alloc (struct scsi_device *sdev) | |||
82 | */ | 79 | */ |
83 | sdev->inquiry_len = 36; | 80 | sdev->inquiry_len = 36; |
84 | 81 | ||
85 | /* Scatter-gather buffers (all but the last) must have a length | 82 | /* USB has unusual DMA-alignment requirements: Although the |
86 | * divisible by the bulk maxpacket size. Otherwise a data packet | 83 | * starting address of each scatter-gather element doesn't matter, |
87 | * would end up being short, causing a premature end to the data | 84 | * the length of each element except the last must be divisible |
88 | * transfer. We'll use the maxpacket value of the bulk-IN pipe | 85 | * by the Bulk maxpacket value. There's currently no way to |
89 | * to set the SCSI device queue's DMA alignment mask. | 86 | * express this by block-layer constraints, so we'll cop out |
87 | * and simply require addresses to be aligned at 512-byte | ||
88 | * boundaries. This is okay since most block I/O involves | ||
89 | * hardware sectors that are multiples of 512 bytes in length, | ||
90 | * and since host controllers up through USB 2.0 have maxpacket | ||
91 | * values no larger than 512. | ||
92 | * | ||
93 | * But it doesn't suffice for Wireless USB, where Bulk maxpacket | ||
94 | * values can be as large as 2048. To make that work properly | ||
95 | * will require changes to the block layer. | ||
90 | */ | 96 | */ |
91 | bulk_in_ep = us->pusb_dev->ep_in[usb_pipeendpoint(us->recv_bulk_pipe)]; | 97 | blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); |
92 | blk_queue_update_dma_alignment(sdev->request_queue, | ||
93 | le16_to_cpu(bulk_in_ep->desc.wMaxPacketSize) - 1); | ||
94 | /* wMaxPacketSize must be a power of 2 */ | ||
95 | 98 | ||
96 | /* | 99 | /* |
97 | * The UFI spec treates the Peripheral Qualifier bits in an | 100 | * The UFI spec treates the Peripheral Qualifier bits in an |
@@ -116,10 +119,10 @@ static int slave_configure(struct scsi_device *sdev) | |||
116 | * while others have trouble with more than 64K. At this time we | 119 | * while others have trouble with more than 64K. At this time we |
117 | * are limiting both to 32K (64 sectores). | 120 | * are limiting both to 32K (64 sectores). |
118 | */ | 121 | */ |
119 | if (us->flags & (US_FL_MAX_SECTORS_64 | US_FL_MAX_SECTORS_MIN)) { | 122 | if (us->fflags & (US_FL_MAX_SECTORS_64 | US_FL_MAX_SECTORS_MIN)) { |
120 | unsigned int max_sectors = 64; | 123 | unsigned int max_sectors = 64; |
121 | 124 | ||
122 | if (us->flags & US_FL_MAX_SECTORS_MIN) | 125 | if (us->fflags & US_FL_MAX_SECTORS_MIN) |
123 | max_sectors = PAGE_CACHE_SIZE >> 9; | 126 | max_sectors = PAGE_CACHE_SIZE >> 9; |
124 | if (sdev->request_queue->max_sectors > max_sectors) | 127 | if (sdev->request_queue->max_sectors > max_sectors) |
125 | blk_queue_max_sectors(sdev->request_queue, | 128 | blk_queue_max_sectors(sdev->request_queue, |
@@ -148,7 +151,7 @@ static int slave_configure(struct scsi_device *sdev) | |||
148 | * majority of devices work fine, but a few still can't | 151 | * majority of devices work fine, but a few still can't |
149 | * handle it. The sd driver will simply assume those | 152 | * handle it. The sd driver will simply assume those |
150 | * devices are write-enabled. */ | 153 | * devices are write-enabled. */ |
151 | if (us->flags & US_FL_NO_WP_DETECT) | 154 | if (us->fflags & US_FL_NO_WP_DETECT) |
152 | sdev->skip_ms_page_3f = 1; | 155 | sdev->skip_ms_page_3f = 1; |
153 | 156 | ||
154 | /* A number of devices have problems with MODE SENSE for | 157 | /* A number of devices have problems with MODE SENSE for |
@@ -158,13 +161,13 @@ static int slave_configure(struct scsi_device *sdev) | |||
158 | /* Some disks return the total number of blocks in response | 161 | /* Some disks return the total number of blocks in response |
159 | * to READ CAPACITY rather than the highest block number. | 162 | * to READ CAPACITY rather than the highest block number. |
160 | * If this device makes that mistake, tell the sd driver. */ | 163 | * If this device makes that mistake, tell the sd driver. */ |
161 | if (us->flags & US_FL_FIX_CAPACITY) | 164 | if (us->fflags & US_FL_FIX_CAPACITY) |
162 | sdev->fix_capacity = 1; | 165 | sdev->fix_capacity = 1; |
163 | 166 | ||
164 | /* A few disks have two indistinguishable version, one of | 167 | /* A few disks have two indistinguishable version, one of |
165 | * which reports the correct capacity and the other does not. | 168 | * which reports the correct capacity and the other does not. |
166 | * The sd driver has to guess which is the case. */ | 169 | * The sd driver has to guess which is the case. */ |
167 | if (us->flags & US_FL_CAPACITY_HEURISTICS) | 170 | if (us->fflags & US_FL_CAPACITY_HEURISTICS) |
168 | sdev->guess_capacity = 1; | 171 | sdev->guess_capacity = 1; |
169 | 172 | ||
170 | /* Some devices report a SCSI revision level above 2 but are | 173 | /* Some devices report a SCSI revision level above 2 but are |
@@ -213,7 +216,7 @@ static int slave_configure(struct scsi_device *sdev) | |||
213 | 216 | ||
214 | /* Some devices choke when they receive a PREVENT-ALLOW MEDIUM | 217 | /* Some devices choke when they receive a PREVENT-ALLOW MEDIUM |
215 | * REMOVAL command, so suppress those commands. */ | 218 | * REMOVAL command, so suppress those commands. */ |
216 | if (us->flags & US_FL_NOT_LOCKABLE) | 219 | if (us->fflags & US_FL_NOT_LOCKABLE) |
217 | sdev->lockable = 0; | 220 | sdev->lockable = 0; |
218 | 221 | ||
219 | /* this is to satisfy the compiler, tho I don't think the | 222 | /* this is to satisfy the compiler, tho I don't think the |
@@ -238,7 +241,7 @@ static int queuecommand(struct scsi_cmnd *srb, | |||
238 | } | 241 | } |
239 | 242 | ||
240 | /* fail the command if we are disconnecting */ | 243 | /* fail the command if we are disconnecting */ |
241 | if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { | 244 | if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { |
242 | US_DEBUGP("Fail command during disconnect\n"); | 245 | US_DEBUGP("Fail command during disconnect\n"); |
243 | srb->result = DID_NO_CONNECT << 16; | 246 | srb->result = DID_NO_CONNECT << 16; |
244 | done(srb); | 247 | done(srb); |
@@ -248,7 +251,7 @@ static int queuecommand(struct scsi_cmnd *srb, | |||
248 | /* enqueue the command and wake up the control thread */ | 251 | /* enqueue the command and wake up the control thread */ |
249 | srb->scsi_done = done; | 252 | srb->scsi_done = done; |
250 | us->srb = srb; | 253 | us->srb = srb; |
251 | up(&(us->sema)); | 254 | complete(&us->cmnd_ready); |
252 | 255 | ||
253 | return 0; | 256 | return 0; |
254 | } | 257 | } |
@@ -280,9 +283,9 @@ static int command_abort(struct scsi_cmnd *srb) | |||
280 | * with the reset). Note that we must retain the host lock while | 283 | * with the reset). Note that we must retain the host lock while |
281 | * calling usb_stor_stop_transport(); otherwise it might interfere | 284 | * calling usb_stor_stop_transport(); otherwise it might interfere |
282 | * with an auto-reset that begins as soon as we release the lock. */ | 285 | * with an auto-reset that begins as soon as we release the lock. */ |
283 | set_bit(US_FLIDX_TIMED_OUT, &us->flags); | 286 | set_bit(US_FLIDX_TIMED_OUT, &us->dflags); |
284 | if (!test_bit(US_FLIDX_RESETTING, &us->flags)) { | 287 | if (!test_bit(US_FLIDX_RESETTING, &us->dflags)) { |
285 | set_bit(US_FLIDX_ABORTING, &us->flags); | 288 | set_bit(US_FLIDX_ABORTING, &us->dflags); |
286 | usb_stor_stop_transport(us); | 289 | usb_stor_stop_transport(us); |
287 | } | 290 | } |
288 | scsi_unlock(us_to_host(us)); | 291 | scsi_unlock(us_to_host(us)); |
@@ -329,7 +332,7 @@ void usb_stor_report_device_reset(struct us_data *us) | |||
329 | struct Scsi_Host *host = us_to_host(us); | 332 | struct Scsi_Host *host = us_to_host(us); |
330 | 333 | ||
331 | scsi_report_device_reset(host, 0, 0); | 334 | scsi_report_device_reset(host, 0, 0); |
332 | if (us->flags & US_FL_SCM_MULT_TARG) { | 335 | if (us->fflags & US_FL_SCM_MULT_TARG) { |
333 | for (i = 1; i < host->max_id; ++i) | 336 | for (i = 1; i < host->max_id; ++i) |
334 | scsi_report_device_reset(host, 0, i); | 337 | scsi_report_device_reset(host, 0, i); |
335 | } | 338 | } |
@@ -400,7 +403,7 @@ static int proc_info (struct Scsi_Host *host, char *buffer, | |||
400 | pos += sprintf(pos, " Quirks:"); | 403 | pos += sprintf(pos, " Quirks:"); |
401 | 404 | ||
402 | #define US_FLAG(name, value) \ | 405 | #define US_FLAG(name, value) \ |
403 | if (us->flags & value) pos += sprintf(pos, " " #name); | 406 | if (us->fflags & value) pos += sprintf(pos, " " #name); |
404 | US_DO_ALL_FLAGS | 407 | US_DO_ALL_FLAGS |
405 | #undef US_FLAG | 408 | #undef US_FLAG |
406 | 409 | ||
diff --git a/drivers/usb/storage/scsiglue.h b/drivers/usb/storage/scsiglue.h index 737e4fa6045f..ffa1cca93d2c 100644 --- a/drivers/usb/storage/scsiglue.h +++ b/drivers/usb/storage/scsiglue.h | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Driver for USB Mass Storage compliant devices | 1 | /* Driver for USB Mass Storage compliant devices |
2 | * SCSI Connecting Glue Header File | 2 | * SCSI Connecting Glue Header File |
3 | * | 3 | * |
4 | * $Id: scsiglue.h,v 1.4 2000/08/25 00:13:51 mdharm Exp $ | ||
5 | * | ||
6 | * Current development and maintenance by: | 4 | * Current development and maintenance by: |
7 | * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 5 | * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
8 | * | 6 | * |
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c index 8972b17da843..c5a54b872c24 100644 --- a/drivers/usb/storage/sddr09.c +++ b/drivers/usb/storage/sddr09.c | |||
@@ -1,6 +1,5 @@ | |||
1 | /* Driver for SanDisk SDDR-09 SmartMedia reader | 1 | /* Driver for SanDisk SDDR-09 SmartMedia reader |
2 | * | 2 | * |
3 | * $Id: sddr09.c,v 1.24 2002/04/22 03:39:43 mdharm Exp $ | ||
4 | * (c) 2000, 2001 Robert Baruch (autophile@starband.net) | 3 | * (c) 2000, 2001 Robert Baruch (autophile@starband.net) |
5 | * (c) 2002 Andries Brouwer (aeb@cwi.nl) | 4 | * (c) 2002 Andries Brouwer (aeb@cwi.nl) |
6 | * Developed with the assistance of: | 5 | * Developed with the assistance of: |
diff --git a/drivers/usb/storage/sddr09.h b/drivers/usb/storage/sddr09.h index c03089a9ec38..e50033ad7b19 100644 --- a/drivers/usb/storage/sddr09.h +++ b/drivers/usb/storage/sddr09.h | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Driver for SanDisk SDDR-09 SmartMedia reader | 1 | /* Driver for SanDisk SDDR-09 SmartMedia reader |
2 | * Header File | 2 | * Header File |
3 | * | 3 | * |
4 | * $Id: sddr09.h,v 1.5 2000/08/25 00:13:51 mdharm Exp $ | ||
5 | * | ||
6 | * Current development and maintenance by: | 4 | * Current development and maintenance by: |
7 | * (c) 2000 Robert Baruch (autophile@dol.net) | 5 | * (c) 2000 Robert Baruch (autophile@dol.net) |
8 | * (c) 2002 Andries Brouwer (aeb@cwi.nl) | 6 | * (c) 2002 Andries Brouwer (aeb@cwi.nl) |
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c index 6d14327c921d..0d8df7577899 100644 --- a/drivers/usb/storage/sddr55.c +++ b/drivers/usb/storage/sddr55.c | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Driver for SanDisk SDDR-55 SmartMedia reader | 1 | /* Driver for SanDisk SDDR-55 SmartMedia reader |
2 | * | 2 | * |
3 | * $Id:$ | ||
4 | * | ||
5 | * SDDR55 driver v0.1: | 3 | * SDDR55 driver v0.1: |
6 | * | 4 | * |
7 | * First release | 5 | * First release |
diff --git a/drivers/usb/storage/sddr55.h b/drivers/usb/storage/sddr55.h index d6bd32f6c9f3..a815a0470c84 100644 --- a/drivers/usb/storage/sddr55.h +++ b/drivers/usb/storage/sddr55.h | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Driver for SanDisk SDDR-55 SmartMedia reader | 1 | /* Driver for SanDisk SDDR-55 SmartMedia reader |
2 | * Header File | 2 | * Header File |
3 | * | 3 | * |
4 | * $Id:$ | ||
5 | * | ||
6 | * Current development and maintenance by: | 4 | * Current development and maintenance by: |
7 | * (c) 2002 Simon Munton | 5 | * (c) 2002 Simon Munton |
8 | * | 6 | * |
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c index 570c1250f6f3..ae6d64810d2a 100644 --- a/drivers/usb/storage/shuttle_usbat.c +++ b/drivers/usb/storage/shuttle_usbat.c | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Driver for SCM Microsystems (a.k.a. Shuttle) USB-ATAPI cable | 1 | /* Driver for SCM Microsystems (a.k.a. Shuttle) USB-ATAPI cable |
2 | * | 2 | * |
3 | * $Id: shuttle_usbat.c,v 1.17 2002/04/22 03:39:43 mdharm Exp $ | ||
4 | * | ||
5 | * Current development and maintenance by: | 3 | * Current development and maintenance by: |
6 | * (c) 2000, 2001 Robert Baruch (autophile@starband.net) | 4 | * (c) 2000, 2001 Robert Baruch (autophile@starband.net) |
7 | * (c) 2004, 2005 Daniel Drake <dsd@gentoo.org> | 5 | * (c) 2004, 2005 Daniel Drake <dsd@gentoo.org> |
diff --git a/drivers/usb/storage/shuttle_usbat.h b/drivers/usb/storage/shuttle_usbat.h index 3ddf143a1dec..d8bfc43e9044 100644 --- a/drivers/usb/storage/shuttle_usbat.h +++ b/drivers/usb/storage/shuttle_usbat.h | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Driver for SCM Microsystems USB-ATAPI cable | 1 | /* Driver for SCM Microsystems USB-ATAPI cable |
2 | * Header File | 2 | * Header File |
3 | * | 3 | * |
4 | * $Id: shuttle_usbat.h,v 1.5 2000/09/17 14:44:52 groovyjava Exp $ | ||
5 | * | ||
6 | * Current development and maintenance by: | 4 | * Current development and maintenance by: |
7 | * (c) 2000 Robert Baruch (autophile@dol.net) | 5 | * (c) 2000 Robert Baruch (autophile@dol.net) |
8 | * (c) 2004, 2005 Daniel Drake <dsd@gentoo.org> | 6 | * (c) 2004, 2005 Daniel Drake <dsd@gentoo.org> |
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 6610d2dd1e7f..fcbbfdb7b2b0 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Driver for USB Mass Storage compliant devices | 1 | /* Driver for USB Mass Storage compliant devices |
2 | * | 2 | * |
3 | * $Id: transport.c,v 1.47 2002/04/22 03:39:43 mdharm Exp $ | ||
4 | * | ||
5 | * Current development and maintenance by: | 3 | * Current development and maintenance by: |
6 | * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 4 | * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
7 | * | 5 | * |
@@ -75,14 +73,14 @@ | |||
75 | * by a separate code path.) | 73 | * by a separate code path.) |
76 | * | 74 | * |
77 | * The abort function (usb_storage_command_abort() in scsiglue.c) first | 75 | * The abort function (usb_storage_command_abort() in scsiglue.c) first |
78 | * sets the machine state and the ABORTING bit in us->flags to prevent | 76 | * sets the machine state and the ABORTING bit in us->dflags to prevent |
79 | * new URBs from being submitted. It then calls usb_stor_stop_transport() | 77 | * new URBs from being submitted. It then calls usb_stor_stop_transport() |
80 | * below, which atomically tests-and-clears the URB_ACTIVE bit in us->flags | 78 | * below, which atomically tests-and-clears the URB_ACTIVE bit in us->dflags |
81 | * to see if the current_urb needs to be stopped. Likewise, the SG_ACTIVE | 79 | * to see if the current_urb needs to be stopped. Likewise, the SG_ACTIVE |
82 | * bit is tested to see if the current_sg scatter-gather request needs to be | 80 | * bit is tested to see if the current_sg scatter-gather request needs to be |
83 | * stopped. The timeout callback routine does much the same thing. | 81 | * stopped. The timeout callback routine does much the same thing. |
84 | * | 82 | * |
85 | * When a disconnect occurs, the DISCONNECTING bit in us->flags is set to | 83 | * When a disconnect occurs, the DISCONNECTING bit in us->dflags is set to |
86 | * prevent new URBs from being submitted, and usb_stor_stop_transport() is | 84 | * prevent new URBs from being submitted, and usb_stor_stop_transport() is |
87 | * called to stop any ongoing requests. | 85 | * called to stop any ongoing requests. |
88 | * | 86 | * |
@@ -127,8 +125,8 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) | |||
127 | long timeleft; | 125 | long timeleft; |
128 | int status; | 126 | int status; |
129 | 127 | ||
130 | /* don't submit URBs during abort/disconnect processing */ | 128 | /* don't submit URBs during abort processing */ |
131 | if (us->flags & ABORTING_OR_DISCONNECTING) | 129 | if (test_bit(US_FLIDX_ABORTING, &us->dflags)) |
132 | return -EIO; | 130 | return -EIO; |
133 | 131 | ||
134 | /* set up data structures for the wakeup system */ | 132 | /* set up data structures for the wakeup system */ |
@@ -159,13 +157,13 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) | |||
159 | 157 | ||
160 | /* since the URB has been submitted successfully, it's now okay | 158 | /* since the URB has been submitted successfully, it's now okay |
161 | * to cancel it */ | 159 | * to cancel it */ |
162 | set_bit(US_FLIDX_URB_ACTIVE, &us->flags); | 160 | set_bit(US_FLIDX_URB_ACTIVE, &us->dflags); |
163 | 161 | ||
164 | /* did an abort/disconnect occur during the submission? */ | 162 | /* did an abort occur during the submission? */ |
165 | if (us->flags & ABORTING_OR_DISCONNECTING) { | 163 | if (test_bit(US_FLIDX_ABORTING, &us->dflags)) { |
166 | 164 | ||
167 | /* cancel the URB, if it hasn't been cancelled already */ | 165 | /* cancel the URB, if it hasn't been cancelled already */ |
168 | if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->flags)) { | 166 | if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->dflags)) { |
169 | US_DEBUGP("-- cancelling URB\n"); | 167 | US_DEBUGP("-- cancelling URB\n"); |
170 | usb_unlink_urb(us->current_urb); | 168 | usb_unlink_urb(us->current_urb); |
171 | } | 169 | } |
@@ -175,7 +173,7 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) | |||
175 | timeleft = wait_for_completion_interruptible_timeout( | 173 | timeleft = wait_for_completion_interruptible_timeout( |
176 | &urb_done, timeout ? : MAX_SCHEDULE_TIMEOUT); | 174 | &urb_done, timeout ? : MAX_SCHEDULE_TIMEOUT); |
177 | 175 | ||
178 | clear_bit(US_FLIDX_URB_ACTIVE, &us->flags); | 176 | clear_bit(US_FLIDX_URB_ACTIVE, &us->dflags); |
179 | 177 | ||
180 | if (timeleft <= 0) { | 178 | if (timeleft <= 0) { |
181 | US_DEBUGP("%s -- cancelling URB\n", | 179 | US_DEBUGP("%s -- cancelling URB\n", |
@@ -419,8 +417,8 @@ static int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe, | |||
419 | { | 417 | { |
420 | int result; | 418 | int result; |
421 | 419 | ||
422 | /* don't submit s-g requests during abort/disconnect processing */ | 420 | /* don't submit s-g requests during abort processing */ |
423 | if (us->flags & ABORTING_OR_DISCONNECTING) | 421 | if (test_bit(US_FLIDX_ABORTING, &us->dflags)) |
424 | return USB_STOR_XFER_ERROR; | 422 | return USB_STOR_XFER_ERROR; |
425 | 423 | ||
426 | /* initialize the scatter-gather request block */ | 424 | /* initialize the scatter-gather request block */ |
@@ -435,13 +433,13 @@ static int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe, | |||
435 | 433 | ||
436 | /* since the block has been initialized successfully, it's now | 434 | /* since the block has been initialized successfully, it's now |
437 | * okay to cancel it */ | 435 | * okay to cancel it */ |
438 | set_bit(US_FLIDX_SG_ACTIVE, &us->flags); | 436 | set_bit(US_FLIDX_SG_ACTIVE, &us->dflags); |
439 | 437 | ||
440 | /* did an abort/disconnect occur during the submission? */ | 438 | /* did an abort occur during the submission? */ |
441 | if (us->flags & ABORTING_OR_DISCONNECTING) { | 439 | if (test_bit(US_FLIDX_ABORTING, &us->dflags)) { |
442 | 440 | ||
443 | /* cancel the request, if it hasn't been cancelled already */ | 441 | /* cancel the request, if it hasn't been cancelled already */ |
444 | if (test_and_clear_bit(US_FLIDX_SG_ACTIVE, &us->flags)) { | 442 | if (test_and_clear_bit(US_FLIDX_SG_ACTIVE, &us->dflags)) { |
445 | US_DEBUGP("-- cancelling sg request\n"); | 443 | US_DEBUGP("-- cancelling sg request\n"); |
446 | usb_sg_cancel(&us->current_sg); | 444 | usb_sg_cancel(&us->current_sg); |
447 | } | 445 | } |
@@ -449,7 +447,7 @@ static int usb_stor_bulk_transfer_sglist(struct us_data *us, unsigned int pipe, | |||
449 | 447 | ||
450 | /* wait for the completion of the transfer */ | 448 | /* wait for the completion of the transfer */ |
451 | usb_sg_wait(&us->current_sg); | 449 | usb_sg_wait(&us->current_sg); |
452 | clear_bit(US_FLIDX_SG_ACTIVE, &us->flags); | 450 | clear_bit(US_FLIDX_SG_ACTIVE, &us->dflags); |
453 | 451 | ||
454 | result = us->current_sg.status; | 452 | result = us->current_sg.status; |
455 | if (act_len) | 453 | if (act_len) |
@@ -530,7 +528,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
530 | /* if the command gets aborted by the higher layers, we need to | 528 | /* if the command gets aborted by the higher layers, we need to |
531 | * short-circuit all other processing | 529 | * short-circuit all other processing |
532 | */ | 530 | */ |
533 | if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { | 531 | if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { |
534 | US_DEBUGP("-- command was aborted\n"); | 532 | US_DEBUGP("-- command was aborted\n"); |
535 | srb->result = DID_ABORT << 16; | 533 | srb->result = DID_ABORT << 16; |
536 | goto Handle_Errors; | 534 | goto Handle_Errors; |
@@ -616,7 +614,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
616 | /* let's clean up right away */ | 614 | /* let's clean up right away */ |
617 | scsi_eh_restore_cmnd(srb, &ses); | 615 | scsi_eh_restore_cmnd(srb, &ses); |
618 | 616 | ||
619 | if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { | 617 | if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { |
620 | US_DEBUGP("-- auto-sense aborted\n"); | 618 | US_DEBUGP("-- auto-sense aborted\n"); |
621 | srb->result = DID_ABORT << 16; | 619 | srb->result = DID_ABORT << 16; |
622 | goto Handle_Errors; | 620 | goto Handle_Errors; |
@@ -629,7 +627,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
629 | * auto-sense is perfectly valid | 627 | * auto-sense is perfectly valid |
630 | */ | 628 | */ |
631 | srb->result = DID_ERROR << 16; | 629 | srb->result = DID_ERROR << 16; |
632 | if (!(us->flags & US_FL_SCM_MULT_TARG)) | 630 | if (!(us->fflags & US_FL_SCM_MULT_TARG)) |
633 | goto Handle_Errors; | 631 | goto Handle_Errors; |
634 | return; | 632 | return; |
635 | } | 633 | } |
@@ -679,8 +677,8 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
679 | /* Set the RESETTING bit, and clear the ABORTING bit so that | 677 | /* Set the RESETTING bit, and clear the ABORTING bit so that |
680 | * the reset may proceed. */ | 678 | * the reset may proceed. */ |
681 | scsi_lock(us_to_host(us)); | 679 | scsi_lock(us_to_host(us)); |
682 | set_bit(US_FLIDX_RESETTING, &us->flags); | 680 | set_bit(US_FLIDX_RESETTING, &us->dflags); |
683 | clear_bit(US_FLIDX_ABORTING, &us->flags); | 681 | clear_bit(US_FLIDX_ABORTING, &us->dflags); |
684 | scsi_unlock(us_to_host(us)); | 682 | scsi_unlock(us_to_host(us)); |
685 | 683 | ||
686 | /* We must release the device lock because the pre_reset routine | 684 | /* We must release the device lock because the pre_reset routine |
@@ -695,7 +693,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
695 | scsi_unlock(us_to_host(us)); | 693 | scsi_unlock(us_to_host(us)); |
696 | us->transport_reset(us); | 694 | us->transport_reset(us); |
697 | } | 695 | } |
698 | clear_bit(US_FLIDX_RESETTING, &us->flags); | 696 | clear_bit(US_FLIDX_RESETTING, &us->dflags); |
699 | } | 697 | } |
700 | 698 | ||
701 | /* Stop the current URB transfer */ | 699 | /* Stop the current URB transfer */ |
@@ -707,13 +705,13 @@ void usb_stor_stop_transport(struct us_data *us) | |||
707 | * let's wake it up. The test_and_clear_bit() call | 705 | * let's wake it up. The test_and_clear_bit() call |
708 | * guarantees that if a URB has just been submitted, | 706 | * guarantees that if a URB has just been submitted, |
709 | * it won't be cancelled more than once. */ | 707 | * it won't be cancelled more than once. */ |
710 | if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->flags)) { | 708 | if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->dflags)) { |
711 | US_DEBUGP("-- cancelling URB\n"); | 709 | US_DEBUGP("-- cancelling URB\n"); |
712 | usb_unlink_urb(us->current_urb); | 710 | usb_unlink_urb(us->current_urb); |
713 | } | 711 | } |
714 | 712 | ||
715 | /* If we are waiting for a scatter-gather operation, cancel it. */ | 713 | /* If we are waiting for a scatter-gather operation, cancel it. */ |
716 | if (test_and_clear_bit(US_FLIDX_SG_ACTIVE, &us->flags)) { | 714 | if (test_and_clear_bit(US_FLIDX_SG_ACTIVE, &us->dflags)) { |
717 | US_DEBUGP("-- cancelling sg request\n"); | 715 | US_DEBUGP("-- cancelling sg request\n"); |
718 | usb_sg_cancel(&us->current_sg); | 716 | usb_sg_cancel(&us->current_sg); |
719 | } | 717 | } |
@@ -914,7 +912,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
914 | unsigned int cbwlen = US_BULK_CB_WRAP_LEN; | 912 | unsigned int cbwlen = US_BULK_CB_WRAP_LEN; |
915 | 913 | ||
916 | /* Take care of BULK32 devices; set extra byte to 0 */ | 914 | /* Take care of BULK32 devices; set extra byte to 0 */ |
917 | if ( unlikely(us->flags & US_FL_BULK32)) { | 915 | if (unlikely(us->fflags & US_FL_BULK32)) { |
918 | cbwlen = 32; | 916 | cbwlen = 32; |
919 | us->iobuf[31] = 0; | 917 | us->iobuf[31] = 0; |
920 | } | 918 | } |
@@ -925,7 +923,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
925 | bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ? 1 << 7 : 0; | 923 | bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ? 1 << 7 : 0; |
926 | bcb->Tag = ++us->tag; | 924 | bcb->Tag = ++us->tag; |
927 | bcb->Lun = srb->device->lun; | 925 | bcb->Lun = srb->device->lun; |
928 | if (us->flags & US_FL_SCM_MULT_TARG) | 926 | if (us->fflags & US_FL_SCM_MULT_TARG) |
929 | bcb->Lun |= srb->device->id << 4; | 927 | bcb->Lun |= srb->device->id << 4; |
930 | bcb->Length = srb->cmd_len; | 928 | bcb->Length = srb->cmd_len; |
931 | 929 | ||
@@ -951,7 +949,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
951 | /* Some USB-IDE converter chips need a 100us delay between the | 949 | /* Some USB-IDE converter chips need a 100us delay between the |
952 | * command phase and the data phase. Some devices need a little | 950 | * command phase and the data phase. Some devices need a little |
953 | * more than that, probably because of clock rate inaccuracies. */ | 951 | * more than that, probably because of clock rate inaccuracies. */ |
954 | if (unlikely(us->flags & US_FL_GO_SLOW)) | 952 | if (unlikely(us->fflags & US_FL_GO_SLOW)) |
955 | udelay(125); | 953 | udelay(125); |
956 | 954 | ||
957 | if (transfer_length) { | 955 | if (transfer_length) { |
@@ -1010,7 +1008,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1010 | US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", | 1008 | US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", |
1011 | le32_to_cpu(bcs->Signature), bcs->Tag, | 1009 | le32_to_cpu(bcs->Signature), bcs->Tag, |
1012 | residue, bcs->Status); | 1010 | residue, bcs->Status); |
1013 | if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) || | 1011 | if (!(bcs->Tag == us->tag || (us->fflags & US_FL_BULK_IGNORE_TAG)) || |
1014 | bcs->Status > US_BULK_STAT_PHASE) { | 1012 | bcs->Status > US_BULK_STAT_PHASE) { |
1015 | US_DEBUGP("Bulk logical error\n"); | 1013 | US_DEBUGP("Bulk logical error\n"); |
1016 | return USB_STOR_TRANSPORT_ERROR; | 1014 | return USB_STOR_TRANSPORT_ERROR; |
@@ -1035,7 +1033,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1035 | /* try to compute the actual residue, based on how much data | 1033 | /* try to compute the actual residue, based on how much data |
1036 | * was really transferred and what the device tells us */ | 1034 | * was really transferred and what the device tells us */ |
1037 | if (residue) { | 1035 | if (residue) { |
1038 | if (!(us->flags & US_FL_IGNORE_RESIDUE)) { | 1036 | if (!(us->fflags & US_FL_IGNORE_RESIDUE)) { |
1039 | residue = min(residue, transfer_length); | 1037 | residue = min(residue, transfer_length); |
1040 | scsi_set_resid(srb, max(scsi_get_resid(srb), | 1038 | scsi_set_resid(srb, max(scsi_get_resid(srb), |
1041 | (int) residue)); | 1039 | (int) residue)); |
@@ -1090,7 +1088,7 @@ static int usb_stor_reset_common(struct us_data *us, | |||
1090 | int result; | 1088 | int result; |
1091 | int result2; | 1089 | int result2; |
1092 | 1090 | ||
1093 | if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { | 1091 | if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { |
1094 | US_DEBUGP("No reset during disconnect\n"); | 1092 | US_DEBUGP("No reset during disconnect\n"); |
1095 | return -EIO; | 1093 | return -EIO; |
1096 | } | 1094 | } |
@@ -1103,12 +1101,12 @@ static int usb_stor_reset_common(struct us_data *us, | |||
1103 | return result; | 1101 | return result; |
1104 | } | 1102 | } |
1105 | 1103 | ||
1106 | /* Give the device some time to recover from the reset, | 1104 | /* Give the device some time to recover from the reset, |
1107 | * but don't delay disconnect processing. */ | 1105 | * but don't delay disconnect processing. */ |
1108 | wait_event_interruptible_timeout(us->delay_wait, | 1106 | wait_event_interruptible_timeout(us->delay_wait, |
1109 | test_bit(US_FLIDX_DISCONNECTING, &us->flags), | 1107 | test_bit(US_FLIDX_DISCONNECTING, &us->dflags), |
1110 | HZ*6); | 1108 | HZ*6); |
1111 | if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { | 1109 | if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { |
1112 | US_DEBUGP("Reset interrupted by disconnect\n"); | 1110 | US_DEBUGP("Reset interrupted by disconnect\n"); |
1113 | return -EIO; | 1111 | return -EIO; |
1114 | } | 1112 | } |
@@ -1170,13 +1168,12 @@ int usb_stor_port_reset(struct us_data *us) | |||
1170 | US_DEBUGP("unable to lock device for reset: %d\n", result); | 1168 | US_DEBUGP("unable to lock device for reset: %d\n", result); |
1171 | else { | 1169 | else { |
1172 | /* Were we disconnected while waiting for the lock? */ | 1170 | /* Were we disconnected while waiting for the lock? */ |
1173 | if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { | 1171 | if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) { |
1174 | result = -EIO; | 1172 | result = -EIO; |
1175 | US_DEBUGP("No reset during disconnect\n"); | 1173 | US_DEBUGP("No reset during disconnect\n"); |
1176 | } else { | 1174 | } else { |
1177 | result = usb_reset_composite_device( | 1175 | result = usb_reset_device(us->pusb_dev); |
1178 | us->pusb_dev, us->pusb_intf); | 1176 | US_DEBUGP("usb_reset_device returns %d\n", |
1179 | US_DEBUGP("usb_reset_composite_device returns %d\n", | ||
1180 | result); | 1177 | result); |
1181 | } | 1178 | } |
1182 | if (rc_lock) | 1179 | if (rc_lock) |
diff --git a/drivers/usb/storage/transport.h b/drivers/usb/storage/transport.h index ada7c2f43f84..e70b88182f0e 100644 --- a/drivers/usb/storage/transport.h +++ b/drivers/usb/storage/transport.h | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Driver for USB Mass Storage compliant devices | 1 | /* Driver for USB Mass Storage compliant devices |
2 | * Transport Functions Header File | 2 | * Transport Functions Header File |
3 | * | 3 | * |
4 | * $Id: transport.h,v 1.18 2002/04/21 02:57:59 mdharm Exp $ | ||
5 | * | ||
6 | * Current development and maintenance by: | 4 | * Current development and maintenance by: |
7 | * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 5 | * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
8 | * | 6 | * |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 39a7c11795c4..7ae69f55aa96 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Driver for USB Mass Storage compliant devices | 1 | /* Driver for USB Mass Storage compliant devices |
2 | * Unusual Devices File | 2 | * Unusual Devices File |
3 | * | 3 | * |
4 | * $Id: unusual_devs.h,v 1.32 2002/02/25 02:41:24 mdharm Exp $ | ||
5 | * | ||
6 | * Current development and maintenance by: | 4 | * Current development and maintenance by: |
7 | * (c) 2000-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 5 | * (c) 2000-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
8 | * | 6 | * |
@@ -1234,6 +1232,17 @@ UNUSUAL_DEV( 0x0851, 0x1543, 0x0200, 0x0200, | |||
1234 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1232 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1235 | US_FL_NOT_LOCKABLE), | 1233 | US_FL_NOT_LOCKABLE), |
1236 | 1234 | ||
1235 | /* Andrew Lunn <andrew@lunn.ch> | ||
1236 | * PanDigital Digital Picture Frame. Does not like ALLOW_MEDIUM_REMOVAL | ||
1237 | * on LUN 4. | ||
1238 | * Note: Vend:Prod clash with "Ltd Maxell WS30 Slim Digital Camera" | ||
1239 | */ | ||
1240 | UNUSUAL_DEV( 0x0851, 0x1543, 0x0200, 0x0200, | ||
1241 | "PanDigital", | ||
1242 | "Photo Frame", | ||
1243 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1244 | US_FL_NOT_LOCKABLE), | ||
1245 | |||
1237 | /* Submitted by Jan De Luyck <lkml@kcore.org> */ | 1246 | /* Submitted by Jan De Luyck <lkml@kcore.org> */ |
1238 | UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000, | 1247 | UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000, |
1239 | "CITIZEN", | 1248 | "CITIZEN", |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index e268aacb773a..bfea851be985 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -1,7 +1,5 @@ | |||
1 | /* Driver for USB Mass Storage compliant devices | 1 | /* Driver for USB Mass Storage compliant devices |
2 | * | 2 | * |
3 | * $Id: usb.c,v 1.75 2002/04/22 03:39:43 mdharm Exp $ | ||
4 | * | ||
5 | * Current development and maintenance by: | 3 | * Current development and maintenance by: |
6 | * (c) 1999-2003 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 4 | * (c) 1999-2003 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
7 | * | 5 | * |
@@ -312,26 +310,27 @@ static int usb_stor_control_thread(void * __us) | |||
312 | 310 | ||
313 | for(;;) { | 311 | for(;;) { |
314 | US_DEBUGP("*** thread sleeping.\n"); | 312 | US_DEBUGP("*** thread sleeping.\n"); |
315 | if(down_interruptible(&us->sema)) | 313 | if (wait_for_completion_interruptible(&us->cmnd_ready)) |
316 | break; | 314 | break; |
317 | 315 | ||
318 | US_DEBUGP("*** thread awakened.\n"); | 316 | US_DEBUGP("*** thread awakened.\n"); |
319 | 317 | ||
320 | /* lock the device pointers */ | 318 | /* lock the device pointers */ |
321 | mutex_lock(&(us->dev_mutex)); | 319 | mutex_lock(&(us->dev_mutex)); |
322 | 320 | ||
323 | /* if the device has disconnected, we are free to exit */ | 321 | /* lock access to the state */ |
324 | if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { | 322 | scsi_lock(host); |
325 | US_DEBUGP("-- exiting\n"); | 323 | |
324 | /* When we are called with no command pending, we're done */ | ||
325 | if (us->srb == NULL) { | ||
326 | scsi_unlock(host); | ||
326 | mutex_unlock(&us->dev_mutex); | 327 | mutex_unlock(&us->dev_mutex); |
328 | US_DEBUGP("-- exiting\n"); | ||
327 | break; | 329 | break; |
328 | } | 330 | } |
329 | 331 | ||
330 | /* lock access to the state */ | ||
331 | scsi_lock(host); | ||
332 | |||
333 | /* has the command timed out *already* ? */ | 332 | /* has the command timed out *already* ? */ |
334 | if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { | 333 | if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { |
335 | us->srb->result = DID_ABORT << 16; | 334 | us->srb->result = DID_ABORT << 16; |
336 | goto SkipForAbort; | 335 | goto SkipForAbort; |
337 | } | 336 | } |
@@ -350,7 +349,7 @@ static int usb_stor_control_thread(void * __us) | |||
350 | * the maximum known LUN | 349 | * the maximum known LUN |
351 | */ | 350 | */ |
352 | else if (us->srb->device->id && | 351 | else if (us->srb->device->id && |
353 | !(us->flags & US_FL_SCM_MULT_TARG)) { | 352 | !(us->fflags & US_FL_SCM_MULT_TARG)) { |
354 | US_DEBUGP("Bad target number (%d:%d)\n", | 353 | US_DEBUGP("Bad target number (%d:%d)\n", |
355 | us->srb->device->id, us->srb->device->lun); | 354 | us->srb->device->id, us->srb->device->lun); |
356 | us->srb->result = DID_BAD_TARGET << 16; | 355 | us->srb->result = DID_BAD_TARGET << 16; |
@@ -365,7 +364,7 @@ static int usb_stor_control_thread(void * __us) | |||
365 | /* Handle those devices which need us to fake | 364 | /* Handle those devices which need us to fake |
366 | * their inquiry data */ | 365 | * their inquiry data */ |
367 | else if ((us->srb->cmnd[0] == INQUIRY) && | 366 | else if ((us->srb->cmnd[0] == INQUIRY) && |
368 | (us->flags & US_FL_FIX_INQUIRY)) { | 367 | (us->fflags & US_FL_FIX_INQUIRY)) { |
369 | unsigned char data_ptr[36] = { | 368 | unsigned char data_ptr[36] = { |
370 | 0x00, 0x80, 0x02, 0x02, | 369 | 0x00, 0x80, 0x02, 0x02, |
371 | 0x1F, 0x00, 0x00, 0x00}; | 370 | 0x1F, 0x00, 0x00, 0x00}; |
@@ -384,12 +383,8 @@ static int usb_stor_control_thread(void * __us) | |||
384 | /* lock access to the state */ | 383 | /* lock access to the state */ |
385 | scsi_lock(host); | 384 | scsi_lock(host); |
386 | 385 | ||
387 | /* did the command already complete because of a disconnect? */ | ||
388 | if (!us->srb) | ||
389 | ; /* nothing to do */ | ||
390 | |||
391 | /* indicate that the command is done */ | 386 | /* indicate that the command is done */ |
392 | else if (us->srb->result != DID_ABORT << 16) { | 387 | if (us->srb->result != DID_ABORT << 16) { |
393 | US_DEBUGP("scsi cmd done, result=0x%x\n", | 388 | US_DEBUGP("scsi cmd done, result=0x%x\n", |
394 | us->srb->result); | 389 | us->srb->result); |
395 | us->srb->scsi_done(us->srb); | 390 | us->srb->scsi_done(us->srb); |
@@ -403,12 +398,12 @@ SkipForAbort: | |||
403 | * the TIMED_OUT flag, not srb->result == DID_ABORT, because | 398 | * the TIMED_OUT flag, not srb->result == DID_ABORT, because |
404 | * the timeout might have occurred after the command had | 399 | * the timeout might have occurred after the command had |
405 | * already completed with a different result code. */ | 400 | * already completed with a different result code. */ |
406 | if (test_bit(US_FLIDX_TIMED_OUT, &us->flags)) { | 401 | if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { |
407 | complete(&(us->notify)); | 402 | complete(&(us->notify)); |
408 | 403 | ||
409 | /* Allow USB transfers to resume */ | 404 | /* Allow USB transfers to resume */ |
410 | clear_bit(US_FLIDX_ABORTING, &us->flags); | 405 | clear_bit(US_FLIDX_ABORTING, &us->dflags); |
411 | clear_bit(US_FLIDX_TIMED_OUT, &us->flags); | 406 | clear_bit(US_FLIDX_TIMED_OUT, &us->dflags); |
412 | } | 407 | } |
413 | 408 | ||
414 | /* finished working on this command */ | 409 | /* finished working on this command */ |
@@ -500,9 +495,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) ? | 495 | us->protocol = (unusual_dev->useTransport == US_PR_DEVICE) ? |
501 | idesc->bInterfaceProtocol : | 496 | idesc->bInterfaceProtocol : |
502 | unusual_dev->useTransport; | 497 | unusual_dev->useTransport; |
503 | us->flags = USB_US_ORIG_FLAGS(id->driver_info); | 498 | us->fflags = USB_US_ORIG_FLAGS(id->driver_info); |
504 | 499 | ||
505 | if (us->flags & US_FL_IGNORE_DEVICE) { | 500 | if (us->fflags & US_FL_IGNORE_DEVICE) { |
506 | printk(KERN_INFO USB_STORAGE "device ignored\n"); | 501 | printk(KERN_INFO USB_STORAGE "device ignored\n"); |
507 | return -ENODEV; | 502 | return -ENODEV; |
508 | } | 503 | } |
@@ -512,7 +507,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 | 507 | * disable it if we're in full-speed |
513 | */ | 508 | */ |
514 | if (dev->speed != USB_SPEED_HIGH) | 509 | if (dev->speed != USB_SPEED_HIGH) |
515 | us->flags &= ~US_FL_GO_SLOW; | 510 | us->fflags &= ~US_FL_GO_SLOW; |
516 | 511 | ||
517 | /* Log a message if a non-generic unusual_dev entry contains an | 512 | /* Log a message if a non-generic unusual_dev entry contains an |
518 | * unnecessary subclass or protocol override. This may stimulate | 513 | * unnecessary subclass or protocol override. This may stimulate |
@@ -533,7 +528,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id) | |||
533 | if (unusual_dev->useTransport != US_PR_DEVICE && | 528 | if (unusual_dev->useTransport != US_PR_DEVICE && |
534 | us->protocol == idesc->bInterfaceProtocol) | 529 | us->protocol == idesc->bInterfaceProtocol) |
535 | msg += 2; | 530 | msg += 2; |
536 | if (msg >= 0 && !(us->flags & US_FL_NEED_OVERRIDE)) | 531 | if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE)) |
537 | printk(KERN_NOTICE USB_STORAGE "This device " | 532 | printk(KERN_NOTICE USB_STORAGE "This device " |
538 | "(%04x,%04x,%04x S %02x P %02x)" | 533 | "(%04x,%04x,%04x S %02x P %02x)" |
539 | " has %s in unusual_devs.h (kernel" | 534 | " has %s in unusual_devs.h (kernel" |
@@ -663,7 +658,7 @@ static int get_transport(struct us_data *us) | |||
663 | US_DEBUGP("Transport: %s\n", us->transport_name); | 658 | US_DEBUGP("Transport: %s\n", us->transport_name); |
664 | 659 | ||
665 | /* fix for single-lun devices */ | 660 | /* fix for single-lun devices */ |
666 | if (us->flags & US_FL_SINGLE_LUN) | 661 | if (us->fflags & US_FL_SINGLE_LUN) |
667 | us->max_lun = 0; | 662 | us->max_lun = 0; |
668 | return 0; | 663 | return 0; |
669 | } | 664 | } |
@@ -820,12 +815,11 @@ static void usb_stor_release_resources(struct us_data *us) | |||
820 | US_DEBUGP("-- %s\n", __func__); | 815 | US_DEBUGP("-- %s\n", __func__); |
821 | 816 | ||
822 | /* Tell the control thread to exit. The SCSI host must | 817 | /* Tell the control thread to exit. The SCSI host must |
823 | * already have been removed so it won't try to queue | 818 | * already have been removed and the DISCONNECTING flag set |
824 | * any more commands. | 819 | * so that we won't accept any more commands. |
825 | */ | 820 | */ |
826 | US_DEBUGP("-- sending exit command to thread\n"); | 821 | US_DEBUGP("-- sending exit command to thread\n"); |
827 | set_bit(US_FLIDX_DISCONNECTING, &us->flags); | 822 | complete(&us->cmnd_ready); |
828 | up(&us->sema); | ||
829 | if (us->ctl_thread) | 823 | if (us->ctl_thread) |
830 | kthread_stop(us->ctl_thread); | 824 | kthread_stop(us->ctl_thread); |
831 | 825 | ||
@@ -859,39 +853,36 @@ static void dissociate_dev(struct us_data *us) | |||
859 | usb_set_intfdata(us->pusb_intf, NULL); | 853 | usb_set_intfdata(us->pusb_intf, NULL); |
860 | } | 854 | } |
861 | 855 | ||
862 | /* First stage of disconnect processing: stop all commands and remove | 856 | /* First stage of disconnect processing: stop SCSI scanning, |
863 | * the host */ | 857 | * remove the host, and stop accepting new commands |
858 | */ | ||
864 | static void quiesce_and_remove_host(struct us_data *us) | 859 | static void quiesce_and_remove_host(struct us_data *us) |
865 | { | 860 | { |
866 | struct Scsi_Host *host = us_to_host(us); | 861 | struct Scsi_Host *host = us_to_host(us); |
867 | 862 | ||
868 | /* Prevent new USB transfers, stop the current command, and | 863 | /* If the device is really gone, cut short reset delays */ |
869 | * interrupt a SCSI-scan or device-reset delay */ | 864 | if (us->pusb_dev->state == USB_STATE_NOTATTACHED) |
870 | scsi_lock(host); | 865 | set_bit(US_FLIDX_DISCONNECTING, &us->dflags); |
871 | set_bit(US_FLIDX_DISCONNECTING, &us->flags); | ||
872 | scsi_unlock(host); | ||
873 | usb_stor_stop_transport(us); | ||
874 | wake_up(&us->delay_wait); | ||
875 | 866 | ||
876 | /* queuecommand won't accept any new commands and the control | 867 | /* Prevent SCSI-scanning (if it hasn't started yet) |
877 | * thread won't execute a previously-queued command. If there | 868 | * and wait for the SCSI-scanning thread to stop. |
878 | * is such a command pending, complete it with an error. */ | 869 | */ |
879 | mutex_lock(&us->dev_mutex); | 870 | set_bit(US_FLIDX_DONT_SCAN, &us->dflags); |
880 | if (us->srb) { | 871 | wake_up(&us->delay_wait); |
881 | us->srb->result = DID_NO_CONNECT << 16; | 872 | wait_for_completion(&us->scanning_done); |
882 | scsi_lock(host); | ||
883 | us->srb->scsi_done(us->srb); | ||
884 | us->srb = NULL; | ||
885 | complete(&us->notify); /* in case of an abort */ | ||
886 | scsi_unlock(host); | ||
887 | } | ||
888 | mutex_unlock(&us->dev_mutex); | ||
889 | 873 | ||
890 | /* Now we own no commands so it's safe to remove the SCSI host */ | 874 | /* Removing the host will perform an orderly shutdown: caches |
875 | * synchronized, disks spun down, etc. | ||
876 | */ | ||
891 | scsi_remove_host(host); | 877 | scsi_remove_host(host); |
892 | 878 | ||
893 | /* Wait for the SCSI-scanning thread to stop */ | 879 | /* Prevent any new commands from being accepted and cut short |
894 | wait_for_completion(&us->scanning_done); | 880 | * reset delays. |
881 | */ | ||
882 | scsi_lock(host); | ||
883 | set_bit(US_FLIDX_DISCONNECTING, &us->dflags); | ||
884 | scsi_unlock(host); | ||
885 | wake_up(&us->delay_wait); | ||
895 | } | 886 | } |
896 | 887 | ||
897 | /* Second stage of disconnect processing: deallocate all resources */ | 888 | /* Second stage of disconnect processing: deallocate all resources */ |
@@ -919,16 +910,16 @@ static int usb_stor_scan_thread(void * __us) | |||
919 | printk(KERN_DEBUG "usb-storage: waiting for device " | 910 | printk(KERN_DEBUG "usb-storage: waiting for device " |
920 | "to settle before scanning\n"); | 911 | "to settle before scanning\n"); |
921 | wait_event_freezable_timeout(us->delay_wait, | 912 | wait_event_freezable_timeout(us->delay_wait, |
922 | test_bit(US_FLIDX_DISCONNECTING, &us->flags), | 913 | test_bit(US_FLIDX_DONT_SCAN, &us->dflags), |
923 | delay_use * HZ); | 914 | delay_use * HZ); |
924 | } | 915 | } |
925 | 916 | ||
926 | /* If the device is still connected, perform the scanning */ | 917 | /* If the device is still connected, perform the scanning */ |
927 | if (!test_bit(US_FLIDX_DISCONNECTING, &us->flags)) { | 918 | if (!test_bit(US_FLIDX_DONT_SCAN, &us->dflags)) { |
928 | 919 | ||
929 | /* For bulk-only devices, determine the max LUN value */ | 920 | /* For bulk-only devices, determine the max LUN value */ |
930 | if (us->protocol == US_PR_BULK && | 921 | if (us->protocol == US_PR_BULK && |
931 | !(us->flags & US_FL_SINGLE_LUN)) { | 922 | !(us->fflags & US_FL_SINGLE_LUN)) { |
932 | mutex_lock(&us->dev_mutex); | 923 | mutex_lock(&us->dev_mutex); |
933 | us->max_lun = usb_stor_Bulk_max_lun(us); | 924 | us->max_lun = usb_stor_Bulk_max_lun(us); |
934 | mutex_unlock(&us->dev_mutex); | 925 | mutex_unlock(&us->dev_mutex); |
@@ -975,7 +966,7 @@ static int storage_probe(struct usb_interface *intf, | |||
975 | us = host_to_us(host); | 966 | us = host_to_us(host); |
976 | memset(us, 0, sizeof(struct us_data)); | 967 | memset(us, 0, sizeof(struct us_data)); |
977 | mutex_init(&(us->dev_mutex)); | 968 | mutex_init(&(us->dev_mutex)); |
978 | init_MUTEX_LOCKED(&(us->sema)); | 969 | init_completion(&us->cmnd_ready); |
979 | init_completion(&(us->notify)); | 970 | init_completion(&(us->notify)); |
980 | init_waitqueue_head(&us->delay_wait); | 971 | init_waitqueue_head(&us->delay_wait); |
981 | init_completion(&us->scanning_done); | 972 | init_completion(&us->scanning_done); |
@@ -1023,6 +1014,7 @@ static int storage_probe(struct usb_interface *intf, | |||
1023 | if (IS_ERR(th)) { | 1014 | if (IS_ERR(th)) { |
1024 | printk(KERN_WARNING USB_STORAGE | 1015 | printk(KERN_WARNING USB_STORAGE |
1025 | "Unable to start the device-scanning thread\n"); | 1016 | "Unable to start the device-scanning thread\n"); |
1017 | complete(&us->scanning_done); | ||
1026 | quiesce_and_remove_host(us); | 1018 | quiesce_and_remove_host(us); |
1027 | result = PTR_ERR(th); | 1019 | result = PTR_ERR(th); |
1028 | goto BadDevice; | 1020 | goto BadDevice; |
@@ -1065,6 +1057,7 @@ static struct usb_driver usb_storage_driver = { | |||
1065 | .pre_reset = storage_pre_reset, | 1057 | .pre_reset = storage_pre_reset, |
1066 | .post_reset = storage_post_reset, | 1058 | .post_reset = storage_post_reset, |
1067 | .id_table = storage_usb_ids, | 1059 | .id_table = storage_usb_ids, |
1060 | .soft_unbind = 1, | ||
1068 | }; | 1061 | }; |
1069 | 1062 | ||
1070 | static int __init usb_stor_init(void) | 1063 | static int __init usb_stor_init(void) |
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h index 8d87503e2560..a4ad73bd832d 100644 --- a/drivers/usb/storage/usb.h +++ b/drivers/usb/storage/usb.h | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Driver for USB Mass Storage compliant devices | 1 | /* Driver for USB Mass Storage compliant devices |
2 | * Main Header File | 2 | * Main Header File |
3 | * | 3 | * |
4 | * $Id: usb.h,v 1.21 2002/04/21 02:57:59 mdharm Exp $ | ||
5 | * | ||
6 | * Current development and maintenance by: | 4 | * Current development and maintenance by: |
7 | * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) | 5 | * (c) 1999-2002 Matthew Dharm (mdharm-usb@one-eyed-alien.net) |
8 | * | 6 | * |
@@ -67,16 +65,14 @@ struct us_unusual_dev { | |||
67 | }; | 65 | }; |
68 | 66 | ||
69 | 67 | ||
70 | /* Dynamic flag definitions: used in set_bit() etc. */ | 68 | /* Dynamic bitflag definitions (us->dflags): used in set_bit() etc. */ |
71 | #define US_FLIDX_URB_ACTIVE 18 /* 0x00040000 current_urb is in use */ | 69 | #define US_FLIDX_URB_ACTIVE 0 /* current_urb is in use */ |
72 | #define US_FLIDX_SG_ACTIVE 19 /* 0x00080000 current_sg is in use */ | 70 | #define US_FLIDX_SG_ACTIVE 1 /* current_sg is in use */ |
73 | #define US_FLIDX_ABORTING 20 /* 0x00100000 abort is in progress */ | 71 | #define US_FLIDX_ABORTING 2 /* abort is in progress */ |
74 | #define US_FLIDX_DISCONNECTING 21 /* 0x00200000 disconnect in progress */ | 72 | #define US_FLIDX_DISCONNECTING 3 /* disconnect in progress */ |
75 | #define ABORTING_OR_DISCONNECTING ((1UL << US_FLIDX_ABORTING) | \ | 73 | #define US_FLIDX_RESETTING 4 /* device reset in progress */ |
76 | (1UL << US_FLIDX_DISCONNECTING)) | 74 | #define US_FLIDX_TIMED_OUT 5 /* SCSI midlayer timed out */ |
77 | #define US_FLIDX_RESETTING 22 /* 0x00400000 device reset in progress */ | 75 | #define US_FLIDX_DONT_SCAN 6 /* don't scan (disconnect) */ |
78 | #define US_FLIDX_TIMED_OUT 23 /* 0x00800000 SCSI midlayer timed out */ | ||
79 | |||
80 | 76 | ||
81 | #define USB_STOR_STRING_LEN 32 | 77 | #define USB_STOR_STRING_LEN 32 |
82 | 78 | ||
@@ -109,7 +105,8 @@ struct us_data { | |||
109 | struct usb_device *pusb_dev; /* this usb_device */ | 105 | struct usb_device *pusb_dev; /* this usb_device */ |
110 | struct usb_interface *pusb_intf; /* this interface */ | 106 | struct usb_interface *pusb_intf; /* this interface */ |
111 | struct us_unusual_dev *unusual_dev; /* device-filter entry */ | 107 | struct us_unusual_dev *unusual_dev; /* device-filter entry */ |
112 | unsigned long flags; /* from filter initially */ | 108 | unsigned long fflags; /* fixed flags from filter */ |
109 | unsigned long dflags; /* dynamic atomic bitflags */ | ||
113 | unsigned int send_bulk_pipe; /* cached pipe values */ | 110 | unsigned int send_bulk_pipe; /* cached pipe values */ |
114 | unsigned int recv_bulk_pipe; | 111 | unsigned int recv_bulk_pipe; |
115 | unsigned int send_ctrl_pipe; | 112 | unsigned int send_ctrl_pipe; |
@@ -147,7 +144,7 @@ struct us_data { | |||
147 | struct task_struct *ctl_thread; /* the control thread */ | 144 | struct task_struct *ctl_thread; /* the control thread */ |
148 | 145 | ||
149 | /* mutual exclusion and synchronization structures */ | 146 | /* mutual exclusion and synchronization structures */ |
150 | struct semaphore sema; /* to sleep thread on */ | 147 | struct completion cmnd_ready; /* to sleep thread on */ |
151 | struct completion notify; /* thread begin/end */ | 148 | struct completion notify; /* thread begin/end */ |
152 | wait_queue_head_t delay_wait; /* wait during scan, reset */ | 149 | wait_queue_head_t delay_wait; /* wait during scan, reset */ |
153 | struct completion scanning_done; /* wait for scan thread */ | 150 | struct completion scanning_done; /* wait for scan thread */ |