aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/scsiglue.c12
-rw-r--r--drivers/usb/storage/transport.c2
-rw-r--r--drivers/usb/storage/unusual_devs.h125
-rw-r--r--drivers/usb/storage/usb.c42
-rw-r--r--drivers/usb/storage/usb.h4
5 files changed, 132 insertions, 53 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 5715291ba54..a4b7df9ff8c 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -112,13 +112,11 @@ static int slave_configure(struct scsi_device *sdev)
112 if (sdev->scsi_level < SCSI_2) 112 if (sdev->scsi_level < SCSI_2)
113 sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2; 113 sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2;
114 114
115 /* According to the technical support people at Genesys Logic, 115 /* Many devices have trouble transfering more than 32KB at a time,
116 * devices using their chips have problems transferring more than 116 * while others have trouble with more than 64K. At this time we
117 * 32 KB at a time. In practice people have found that 64 KB 117 * are limiting both to 32K (64 sectores).
118 * works okay and that's what Windows does. But we'll be 118 */
119 * conservative; people can always use the sysfs interface to 119 if ((us->flags & US_FL_MAX_SECTORS_64) &&
120 * increase max_sectors. */
121 if (le16_to_cpu(us->pusb_dev->descriptor.idVendor) == USB_VENDOR_ID_GENESYS &&
122 sdev->request_queue->max_sectors > 64) 120 sdev->request_queue->max_sectors > 64)
123 blk_queue_max_sectors(sdev->request_queue, 64); 121 blk_queue_max_sectors(sdev->request_queue, 64);
124 122
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index eb7188b3565..d6acc92a4ae 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -180,7 +180,7 @@ static int usb_stor_msg_common(struct us_data *us, int timeout)
180 if (timeleft <= 0) { 180 if (timeleft <= 0) {
181 US_DEBUGP("%s -- cancelling URB\n", 181 US_DEBUGP("%s -- cancelling URB\n",
182 timeleft == 0 ? "Timeout" : "Signal"); 182 timeleft == 0 ? "Timeout" : "Signal");
183 usb_unlink_urb(us->current_urb); 183 usb_kill_urb(us->current_urb);
184 } 184 }
185 185
186 /* return the URB status */ 186 /* return the URB status */
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index c7e84e653df..b130e170b4a 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -112,6 +112,19 @@ UNUSUAL_DEV( 0x0411, 0x001c, 0x0113, 0x0113,
112 US_SC_DEVICE, US_PR_DEVICE, NULL, 112 US_SC_DEVICE, US_PR_DEVICE, NULL,
113 US_FL_FIX_INQUIRY ), 113 US_FL_FIX_INQUIRY ),
114 114
115/* Submitted by Ernestas Vaiciukevicius <ernisv@gmail.com> */
116UNUSUAL_DEV( 0x0419, 0x0100, 0x0100, 0x0100,
117 "Samsung Info. Systems America, Inc.",
118 "MP3 Player",
119 US_SC_DEVICE, US_PR_DEVICE, NULL,
120 US_FL_IGNORE_RESIDUE ),
121
122/* Reported by Orgad Shaneh <orgads@gmail.com> */
123UNUSUAL_DEV( 0x0419, 0xaace, 0x0100, 0x0100,
124 "Samsung", "MP3 Player",
125 US_SC_DEVICE, US_PR_DEVICE, NULL,
126 US_FL_IGNORE_RESIDUE ),
127
115/* Reported by Christian Leber <christian@leber.de> */ 128/* Reported by Christian Leber <christian@leber.de> */
116UNUSUAL_DEV( 0x0419, 0xaaf5, 0x0100, 0x0100, 129UNUSUAL_DEV( 0x0419, 0xaaf5, 0x0100, 0x0100,
117 "TrekStor", 130 "TrekStor",
@@ -132,6 +145,21 @@ UNUSUAL_DEV( 0x0420, 0x0001, 0x0100, 0x0100,
132 US_SC_DEVICE, US_PR_DEVICE, NULL, 145 US_SC_DEVICE, US_PR_DEVICE, NULL,
133 US_FL_IGNORE_RESIDUE ), 146 US_FL_IGNORE_RESIDUE ),
134 147
148/* Reported by Mario Rettig <mariorettig@web.de> */
149UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100,
150 "Nokia",
151 "Nokia 3250",
152 US_SC_DEVICE, US_PR_DEVICE, NULL,
153 US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ),
154
155/* Reported by Sumedha Swamy <sumedhaswamy@gmail.com> and
156 * Einar Th. Einarsson <einarthered@gmail.com> */
157UNUSUAL_DEV( 0x0421, 0x0444, 0x0100, 0x0100,
158 "Nokia",
159 "N91",
160 US_SC_DEVICE, US_PR_DEVICE, NULL,
161 US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ),
162
135/* Reported by Jiri Slaby <jirislaby@gmail.com> and 163/* Reported by Jiri Slaby <jirislaby@gmail.com> and
136 * Rene C. Castberg <Rene@Castberg.org> */ 164 * Rene C. Castberg <Rene@Castberg.org> */
137UNUSUAL_DEV( 0x0421, 0x0446, 0x0100, 0x0100, 165UNUSUAL_DEV( 0x0421, 0x0446, 0x0100, 0x0100,
@@ -140,6 +168,13 @@ UNUSUAL_DEV( 0x0421, 0x0446, 0x0100, 0x0100,
140 US_SC_DEVICE, US_PR_DEVICE, NULL, 168 US_SC_DEVICE, US_PR_DEVICE, NULL,
141 US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), 169 US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ),
142 170
171/* Reported by Matthew Bloch <matthew@bytemark.co.uk> */
172UNUSUAL_DEV( 0x0421, 0x044e, 0x0100, 0x0100,
173 "Nokia",
174 "E61",
175 US_SC_DEVICE, US_PR_DEVICE, NULL,
176 US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ),
177
143/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ 178/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */
144UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, 179UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210,
145 "SMSC", 180 "SMSC",
@@ -206,16 +241,6 @@ UNUSUAL_DEV( 0x0482, 0x0103, 0x0100, 0x0100,
206 "Finecam S5", 241 "Finecam S5",
207 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY), 242 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY),
208 243
209/* Patch for Kyocera Finecam L3
210 * Submitted by Michael Krauth <michael.krauth@web.de>
211 * and Alessandro Fracchetti <al.fracchetti@tin.it>
212 */
213UNUSUAL_DEV( 0x0482, 0x0105, 0x0100, 0x0100,
214 "Kyocera",
215 "Finecam L3",
216 US_SC_SCSI, US_PR_BULK, NULL,
217 US_FL_FIX_INQUIRY),
218
219/* Reported by Paul Stewart <stewart@wetlogic.net> 244/* Reported by Paul Stewart <stewart@wetlogic.net>
220 * This entry is needed because the device reports Sub=ff */ 245 * This entry is needed because the device reports Sub=ff */
221UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001, 246UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001,
@@ -473,10 +498,11 @@ UNUSUAL_DEV( 0x054c, 0x0010, 0x0106, 0x0450,
473 US_SC_SCSI, US_PR_DEVICE, NULL, 498 US_SC_SCSI, US_PR_DEVICE, NULL,
474 US_FL_SINGLE_LUN | US_FL_NOT_LOCKABLE | US_FL_NO_WP_DETECT ), 499 US_FL_SINGLE_LUN | US_FL_NOT_LOCKABLE | US_FL_NO_WP_DETECT ),
475 500
476/* This entry is needed because the device reports Sub=ff */ 501/* Submitted by Lars Jacob <jacob.lars@googlemail.com>
477UNUSUAL_DEV( 0x054c, 0x0010, 0x0500, 0x0600, 502 * This entry is needed because the device reports Sub=ff */
503UNUSUAL_DEV( 0x054c, 0x0010, 0x0500, 0x0610,
478 "Sony", 504 "Sony",
479 "DSC-T1/T5", 505 "DSC-T1/T5/H5",
480 US_SC_8070, US_PR_DEVICE, NULL, 506 US_SC_8070, US_PR_DEVICE, NULL,
481 US_FL_SINGLE_LUN ), 507 US_FL_SINGLE_LUN ),
482 508
@@ -563,6 +589,13 @@ UNUSUAL_DEV( 0x054c, 0x0099, 0x0000, 0x9999,
563 US_SC_DEVICE, US_PR_DEVICE, NULL, 589 US_SC_DEVICE, US_PR_DEVICE, NULL,
564 US_FL_FIX_INQUIRY ), 590 US_FL_FIX_INQUIRY ),
565 591
592/* floppy reports multiple luns */
593UNUSUAL_DEV( 0x055d, 0x2020, 0x0000, 0x0210,
594 "SAMSUNG",
595 "SFD-321U [FW 0C]",
596 US_SC_DEVICE, US_PR_DEVICE, NULL,
597 US_FL_SINGLE_LUN ),
598
566 599
567UNUSUAL_DEV( 0x057b, 0x0000, 0x0000, 0x0299, 600UNUSUAL_DEV( 0x057b, 0x0000, 0x0000, 0x0299,
568 "Y-E Data", 601 "Y-E Data",
@@ -598,18 +631,6 @@ UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210,
598 "Digital Camera EX-20 DSC", 631 "Digital Camera EX-20 DSC",
599 US_SC_8070, US_PR_DEVICE, NULL, 0 ), 632 US_SC_8070, US_PR_DEVICE, NULL, 0 ),
600 633
601/* The entry was here before I took over, and had US_SC_RBC. It turns
602 * out that isn't needed. Additionally, Torsten Eriksson
603 * <Torsten.Eriksson@bergianska.se> is able to use his device fine
604 * without this entry at all - but I don't suspect that will be true
605 * for all users (the protocol is likely needed), so is staying at
606 * this time. - Phil Dibowitz <phil@ipom.com>
607 */
608UNUSUAL_DEV( 0x059f, 0xa601, 0x0200, 0x0200,
609 "LaCie",
610 "USB Hard Disk",
611 US_SC_DEVICE, US_PR_CB, NULL, 0 ),
612
613/* Submitted by Joel Bourquard <numlock@freesurf.ch> 634/* Submitted by Joel Bourquard <numlock@freesurf.ch>
614 * Some versions of this device need the SubClass and Protocol overrides 635 * Some versions of this device need the SubClass and Protocol overrides
615 * while others don't. 636 * while others don't.
@@ -708,18 +729,22 @@ UNUSUAL_DEV( 0x05dc, 0xb002, 0x0000, 0x0113,
708 * They were originally reported by Alexander Oltu 729 * They were originally reported by Alexander Oltu
709 * <alexander@all-2.com> and Peter Marks <peter.marks@turner.com> 730 * <alexander@all-2.com> and Peter Marks <peter.marks@turner.com>
710 * respectively. 731 * respectively.
732 *
733 * US_FL_GO_SLOW and US_FL_MAX_SECTORS_64 added by Phil Dibowitz
734 * <phil@ipom.com> as these flags were made and hard-coded
735 * special-cases were pulled from scsiglue.c.
711 */ 736 */
712UNUSUAL_DEV( 0x05e3, 0x0701, 0x0000, 0xffff, 737UNUSUAL_DEV( 0x05e3, 0x0701, 0x0000, 0xffff,
713 "Genesys Logic", 738 "Genesys Logic",
714 "USB to IDE Optical", 739 "USB to IDE Optical",
715 US_SC_DEVICE, US_PR_DEVICE, NULL, 740 US_SC_DEVICE, US_PR_DEVICE, NULL,
716 US_FL_GO_SLOW ), 741 US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ),
717 742
718UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff, 743UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff,
719 "Genesys Logic", 744 "Genesys Logic",
720 "USB to IDE Disk", 745 "USB to IDE Disk",
721 US_SC_DEVICE, US_PR_DEVICE, NULL, 746 US_SC_DEVICE, US_PR_DEVICE, NULL,
722 US_FL_GO_SLOW ), 747 US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ),
723 748
724/* Reported by Hanno Boeck <hanno@gmx.de> 749/* Reported by Hanno Boeck <hanno@gmx.de>
725 * Taken from the Lycoris Kernel */ 750 * Taken from the Lycoris Kernel */
@@ -1073,7 +1098,15 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff,
1073 "Optio S/S4", 1098 "Optio S/S4",
1074 US_SC_DEVICE, US_PR_DEVICE, NULL, 1099 US_SC_DEVICE, US_PR_DEVICE, NULL,
1075 US_FL_FIX_INQUIRY ), 1100 US_FL_FIX_INQUIRY ),
1076 1101
1102/* This is a virtual windows driver CD, which the zd1211rw driver automatically
1103 * converts into a WLAN device. */
1104UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101,
1105 "ZyXEL",
1106 "G-220F USB-WLAN Install",
1107 US_SC_DEVICE, US_PR_DEVICE, NULL,
1108 US_FL_IGNORE_DEVICE ),
1109
1077#ifdef CONFIG_USB_STORAGE_ISD200 1110#ifdef CONFIG_USB_STORAGE_ISD200
1078UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, 1111UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110,
1079 "ATI", 1112 "ATI",
@@ -1196,6 +1229,24 @@ UNUSUAL_DEV( 0x0ea0, 0x6828, 0x0110, 0x0110,
1196 US_SC_DEVICE, US_PR_DEVICE, NULL, 1229 US_SC_DEVICE, US_PR_DEVICE, NULL,
1197 US_FL_IGNORE_RESIDUE ), 1230 US_FL_IGNORE_RESIDUE ),
1198 1231
1232/* Reported by Benjamin Schiller <sbenni@gmx.de>
1233 * It is also sold by Easylite as DJ 20 */
1234UNUSUAL_DEV( 0x0ed1, 0x7636, 0x0103, 0x0103,
1235 "Typhoon",
1236 "My DJ 1820",
1237 US_SC_DEVICE, US_PR_DEVICE, NULL,
1238 US_FL_IGNORE_RESIDUE | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64),
1239
1240/* David Kuehling <dvdkhlng@gmx.de>:
1241 * for MP3-Player AVOX WSX-300ER (bought in Japan). Reports lots of SCSI
1242 * errors when trying to write.
1243 */
1244UNUSUAL_DEV( 0x0f19, 0x0105, 0x0100, 0x0100,
1245 "C-MEX",
1246 "A-VOX",
1247 US_SC_DEVICE, US_PR_DEVICE, NULL,
1248 US_FL_IGNORE_RESIDUE ),
1249
1199/* Reported by Michael Stattmann <michael@stattmann.com> */ 1250/* Reported by Michael Stattmann <michael@stattmann.com> */
1200UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, 1251UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000,
1201 "Sony Ericsson", 1252 "Sony Ericsson",
@@ -1203,11 +1254,18 @@ UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000,
1203 US_SC_DEVICE, US_PR_DEVICE, NULL, 1254 US_SC_DEVICE, US_PR_DEVICE, NULL,
1204 US_FL_NO_WP_DETECT ), 1255 US_FL_NO_WP_DETECT ),
1205 1256
1257/* Reported by Emmanuel Vasilakis <evas@forthnet.gr> */
1258UNUSUAL_DEV( 0x0fce, 0xe031, 0x0000, 0x0000,
1259 "Sony Ericsson",
1260 "M600i",
1261 US_SC_DEVICE, US_PR_DEVICE, NULL,
1262 US_FL_FIX_CAPACITY ),
1263
1206/* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu> 1264/* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu>
1207 * Tested on hardware version 1.10. 1265 * Tested on hardware version 1.10.
1208 * Entry is needed only for the initializer function override. 1266 * Entry is needed only for the initializer function override.
1209 */ 1267 */
1210UNUSUAL_DEV( 0x1019, 0x0c55, 0x0000, 0x9999, 1268UNUSUAL_DEV( 0x1019, 0x0c55, 0x0110, 0x0110,
1211 "Desknote", 1269 "Desknote",
1212 "UCR-61S2B", 1270 "UCR-61S2B",
1213 US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init, 1271 US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init,
@@ -1227,6 +1285,15 @@ UNUSUAL_DEV( 0x1370, 0x6828, 0x0110, 0x0110,
1227 US_SC_DEVICE, US_PR_DEVICE, NULL, 1285 US_SC_DEVICE, US_PR_DEVICE, NULL,
1228 US_FL_IGNORE_RESIDUE ), 1286 US_FL_IGNORE_RESIDUE ),
1229 1287
1288/* patch submitted by Davide Perini <perini.davide@dpsoftware.org>
1289 * and Renato Perini <rperini@email.it>
1290 */
1291UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001,
1292 "Motorola",
1293 "RAZR V3x",
1294 US_SC_DEVICE, US_PR_DEVICE, NULL,
1295 US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ),
1296
1230/* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ 1297/* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */
1231UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, 1298UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
1232 "MPIO", 1299 "MPIO",
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 1185acac4b2..8d7bdcb5924 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -55,6 +55,7 @@
55#include <linux/slab.h> 55#include <linux/slab.h>
56#include <linux/kthread.h> 56#include <linux/kthread.h>
57#include <linux/mutex.h> 57#include <linux/mutex.h>
58#include <linux/utsrelease.h>
58 59
59#include <scsi/scsi.h> 60#include <scsi/scsi.h>
60#include <scsi/scsi_cmnd.h> 61#include <scsi/scsi_cmnd.h>
@@ -373,8 +374,12 @@ static int usb_stor_control_thread(void * __us)
373 /* lock access to the state */ 374 /* lock access to the state */
374 scsi_lock(host); 375 scsi_lock(host);
375 376
377 /* did the command already complete because of a disconnect? */
378 if (!us->srb)
379 ; /* nothing to do */
380
376 /* indicate that the command is done */ 381 /* indicate that the command is done */
377 if (us->srb->result != DID_ABORT << 16) { 382 else if (us->srb->result != DID_ABORT << 16) {
378 US_DEBUGP("scsi cmd done, result=0x%x\n", 383 US_DEBUGP("scsi cmd done, result=0x%x\n",
379 us->srb->result); 384 us->srb->result);
380 us->srb->scsi_done(us->srb); 385 us->srb->scsi_done(us->srb);
@@ -478,7 +483,7 @@ static struct us_unusual_dev *find_unusual(const struct usb_device_id *id)
478} 483}
479 484
480/* Get the unusual_devs entries and the string descriptors */ 485/* Get the unusual_devs entries and the string descriptors */
481static void get_device_info(struct us_data *us, const struct usb_device_id *id) 486static int get_device_info(struct us_data *us, const struct usb_device_id *id)
482{ 487{
483 struct usb_device *dev = us->pusb_dev; 488 struct usb_device *dev = us->pusb_dev;
484 struct usb_interface_descriptor *idesc = 489 struct usb_interface_descriptor *idesc =
@@ -495,6 +500,11 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id)
495 unusual_dev->useTransport; 500 unusual_dev->useTransport;
496 us->flags = USB_US_ORIG_FLAGS(id->driver_info); 501 us->flags = USB_US_ORIG_FLAGS(id->driver_info);
497 502
503 if (us->flags & US_FL_IGNORE_DEVICE) {
504 printk(KERN_INFO USB_STORAGE "device ignored\n");
505 return -ENODEV;
506 }
507
498 /* 508 /*
499 * This flag is only needed when we're in high-speed, so let's 509 * This flag is only needed when we're in high-speed, so let's
500 * disable it if we're in full-speed 510 * disable it if we're in full-speed
@@ -524,7 +534,8 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id)
524 if (msg >= 0 && !(us->flags & US_FL_NEED_OVERRIDE)) 534 if (msg >= 0 && !(us->flags & US_FL_NEED_OVERRIDE))
525 printk(KERN_NOTICE USB_STORAGE "This device " 535 printk(KERN_NOTICE USB_STORAGE "This device "
526 "(%04x,%04x,%04x S %02x P %02x)" 536 "(%04x,%04x,%04x S %02x P %02x)"
527 " has %s in unusual_devs.h\n" 537 " has %s in unusual_devs.h (kernel"
538 " %s)\n"
528 " Please send a copy of this message to " 539 " Please send a copy of this message to "
529 "<linux-usb-devel@lists.sourceforge.net>\n", 540 "<linux-usb-devel@lists.sourceforge.net>\n",
530 le16_to_cpu(ddesc->idVendor), 541 le16_to_cpu(ddesc->idVendor),
@@ -532,8 +543,11 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id)
532 le16_to_cpu(ddesc->bcdDevice), 543 le16_to_cpu(ddesc->bcdDevice),
533 idesc->bInterfaceSubClass, 544 idesc->bInterfaceSubClass,
534 idesc->bInterfaceProtocol, 545 idesc->bInterfaceProtocol,
535 msgs[msg]); 546 msgs[msg],
547 UTS_RELEASE);
536 } 548 }
549
550 return 0;
537} 551}
538 552
539/* Get the transport settings */ 553/* Get the transport settings */
@@ -836,32 +850,34 @@ static void dissociate_dev(struct us_data *us)
836 * the host */ 850 * the host */
837static void quiesce_and_remove_host(struct us_data *us) 851static void quiesce_and_remove_host(struct us_data *us)
838{ 852{
853 struct Scsi_Host *host = us_to_host(us);
854
839 /* Prevent new USB transfers, stop the current command, and 855 /* Prevent new USB transfers, stop the current command, and
840 * interrupt a SCSI-scan or device-reset delay */ 856 * interrupt a SCSI-scan or device-reset delay */
857 scsi_lock(host);
841 set_bit(US_FLIDX_DISCONNECTING, &us->flags); 858 set_bit(US_FLIDX_DISCONNECTING, &us->flags);
859 scsi_unlock(host);
842 usb_stor_stop_transport(us); 860 usb_stor_stop_transport(us);
843 wake_up(&us->delay_wait); 861 wake_up(&us->delay_wait);
844 862
845 /* It doesn't matter if the SCSI-scanning thread is still running. 863 /* It doesn't matter if the SCSI-scanning thread is still running.
846 * The thread will exit when it sees the DISCONNECTING flag. */ 864 * The thread will exit when it sees the DISCONNECTING flag. */
847 865
848 /* Wait for the current command to finish, then remove the host */
849 mutex_lock(&us->dev_mutex);
850 mutex_unlock(&us->dev_mutex);
851
852 /* queuecommand won't accept any new commands and the control 866 /* queuecommand won't accept any new commands and the control
853 * thread won't execute a previously-queued command. If there 867 * thread won't execute a previously-queued command. If there
854 * is such a command pending, complete it with an error. */ 868 * is such a command pending, complete it with an error. */
869 mutex_lock(&us->dev_mutex);
855 if (us->srb) { 870 if (us->srb) {
856 us->srb->result = DID_NO_CONNECT << 16; 871 us->srb->result = DID_NO_CONNECT << 16;
857 scsi_lock(us_to_host(us)); 872 scsi_lock(host);
858 us->srb->scsi_done(us->srb); 873 us->srb->scsi_done(us->srb);
859 us->srb = NULL; 874 us->srb = NULL;
860 scsi_unlock(us_to_host(us)); 875 scsi_unlock(host);
861 } 876 }
877 mutex_unlock(&us->dev_mutex);
862 878
863 /* Now we own no commands so it's safe to remove the SCSI host */ 879 /* Now we own no commands so it's safe to remove the SCSI host */
864 scsi_remove_host(us_to_host(us)); 880 scsi_remove_host(host);
865} 881}
866 882
867/* Second stage of disconnect processing: deallocate all resources */ 883/* Second stage of disconnect processing: deallocate all resources */
@@ -960,7 +976,9 @@ static int storage_probe(struct usb_interface *intf,
960 * of the match from the usb_device_id table, so we can find the 976 * of the match from the usb_device_id table, so we can find the
961 * corresponding entry in the private table. 977 * corresponding entry in the private table.
962 */ 978 */
963 get_device_info(us, id); 979 result = get_device_info(us, id);
980 if (result)
981 goto BadDevice;
964 982
965 /* Get the transport, protocol, and pipe settings */ 983 /* Get the transport, protocol, and pipe settings */
966 result = get_transport(us); 984 result = get_transport(us);
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
index 5284abe1b5e..21f3ddbc908 100644
--- a/drivers/usb/storage/usb.h
+++ b/drivers/usb/storage/usb.h
@@ -176,8 +176,4 @@ extern void fill_inquiry_response(struct us_data *us,
176#define scsi_unlock(host) spin_unlock_irq(host->host_lock) 176#define scsi_unlock(host) spin_unlock_irq(host->host_lock)
177#define scsi_lock(host) spin_lock_irq(host->host_lock) 177#define scsi_lock(host) spin_lock_irq(host->host_lock)
178 178
179
180/* Vendor ID list for devices that require special handling */
181#define USB_VENDOR_ID_GENESYS 0x05e3 /* Genesys Logic */
182
183#endif 179#endif