Greg et al. --

Attached is a patch for usb-storage against 2.4.17.  Please apply.

This patch does the following:
(o) Changes all memory allocations to use GFP_NOIO
(o) Fixes Freecom driver to work with FW921 units as well as the FW930
        units.
(o) More unusual device entires, including a typo fix.

At this point, I'm looking for people to help me track down the reported
problem with long delays at shutdown for certain configurations.  Some
configuration option causes more SCSI commands to be sent just before
shutdown, and I don't know what option that is.  If anyone has a clue,
please let me know.  Until I figure out what option it is, I won't be able
to reproduce the problem.

Matt

-- 
Matthew Dharm                              Home: [EMAIL PROTECTED] 
Maintainer, Linux USB Mass Storage Driver

Your lips are twitching.  You're playing Quake aren't you.
                                        -- Stef to Greg
User Friendly, 8/11/1998
diff -u -X /home/mdharm/projects/dontdiff storage.old/datafab.c storage/datafab.c
--- storage.old/datafab.c       Tue Oct  9 15:15:02 2001
+++ storage/datafab.c   Sat Dec  8 15:32:48 2001
@@ -208,7 +208,7 @@
 
                if (use_sg) {
                        sg = (struct scatterlist *) dest;
-                       buffer = kmalloc(len, GFP_KERNEL);
+                       buffer = kmalloc(len, GFP_NOIO);
                        if (buffer == NULL)
                                return USB_STOR_TRANSPORT_ERROR;
                        ptr = buffer;
@@ -333,7 +333,7 @@
 
                if (use_sg) {
                        sg = (struct scatterlist *) src;
-                       buffer = kmalloc(len, GFP_KERNEL);
+                       buffer = kmalloc(len, GFP_NOIO);
                        if (buffer == NULL)
                                return USB_STOR_TRANSPORT_ERROR;
                        ptr = buffer;
@@ -665,7 +665,7 @@
        };
 
        if (!us->extra) {
-               us->extra = kmalloc(sizeof(struct datafab_info), GFP_KERNEL);
+               us->extra = kmalloc(sizeof(struct datafab_info), GFP_NOIO);
                if (!us->extra) {
                        US_DEBUGP("datafab_transport:  Gah! Can't allocate storage for 
Datafab info struct!\n");
                        return USB_STOR_TRANSPORT_ERROR;
diff -u -X /home/mdharm/projects/dontdiff storage.old/freecom.c storage/freecom.c
--- storage.old/freecom.c       Tue Nov 13 09:19:41 2001
+++ storage/freecom.c   Fri Dec 28 19:47:33 2001
@@ -1,6 +1,6 @@
 /* Driver for Freecom USB/IDE adaptor
  *
- * $Id: freecom.c,v 1.19 2001/11/11 05:42:34 mdharm Exp $
+ * $Id: freecom.c,v 1.21 2001/12/29 03:47:33 mdharm Exp $
  *
  * Freecom v0.1:
  *
@@ -206,9 +206,7 @@
 
         return USB_STOR_TRANSPORT_GOOD;
 }
-#endif
 
-#if 0 /* Unused at this time */
 /* Read a value from an ide register. */
 static int
 freecom_ide_read (struct us_data *us, int reg, int *value)
@@ -435,7 +433,7 @@
                /* Get the status again */
                fcb->Type = FCM_PACKET_STATUS;
                fcb->Timeout = 0;
-               memset (fcb->Atapi, 0, sizeof(fcb->Filler));
+               memset (fcb->Atapi, 0, sizeof(fcb->Atapi));
                memset (fcb->Filler, 0, sizeof (fcb->Filler));
 
                /* Send it out. */
@@ -487,10 +485,19 @@
          * and such will hang. */
         US_DEBUGP("Device indicates that it has %d bytes available\n",
                         le16_to_cpu (fst->Count));
+        US_DEBUGP("SCSI requested %d\n", usb_stor_transfer_length(srb));
 
         /* Find the length we desire to read. */
-        length = usb_stor_transfer_length (srb);
-        US_DEBUGP("SCSI requested %d\n", length);
+       switch (srb->cmnd[0]) {
+               case INQUIRY:
+               case REQUEST_SENSE:             /* 16 or 18 bytes? spec says 18, lots 
+of devices only have 16 */
+               case MODE_SENSE:
+               case MODE_SENSE_10:
+                       length = fst->Count;
+                       break;
+               default:
+                       length = usb_stor_transfer_length (srb);
+       }
 
        /* verify that this amount is legal */
        if (length > srb->request_bufflen) {
diff -u -X /home/mdharm/projects/dontdiff storage.old/jumpshot.c storage/jumpshot.c
--- storage.old/jumpshot.c      Fri Sep 14 14:04:07 2001
+++ storage/jumpshot.c  Sat Dec  8 15:32:48 2001
@@ -284,7 +284,7 @@
 
                 if (use_sg) {
                         sg = (struct scatterlist *) dest;
-                        buffer = kmalloc(len, GFP_KERNEL);
+                        buffer = kmalloc(len, GFP_NOIO);
                         if (buffer == NULL)
                                 return USB_STOR_TRANSPORT_ERROR;
                         ptr = buffer;
@@ -399,7 +399,7 @@
 
                 if (use_sg) {
                         sg = (struct scatterlist *) src;
-                        buffer = kmalloc(len, GFP_KERNEL);
+                        buffer = kmalloc(len, GFP_NOIO);
                         if (buffer == NULL)
                                 return USB_STOR_TRANSPORT_ERROR;
                         ptr = buffer;
@@ -665,7 +665,7 @@
 
 
        if (!us->extra) {
-               us->extra = kmalloc(sizeof(struct jumpshot_info), GFP_KERNEL);
+               us->extra = kmalloc(sizeof(struct jumpshot_info), GFP_NOIO);
                if (!us->extra) {
                        US_DEBUGP("jumpshot_transport:  Gah! Can't allocate storage 
for jumpshot info struct!\n");
                        return USB_STOR_TRANSPORT_ERROR;
diff -u -X /home/mdharm/projects/dontdiff storage.old/sddr09.c storage/sddr09.c
--- storage.old/sddr09.c        Fri Nov  9 14:37:14 2001
+++ storage/sddr09.c    Sat Dec  8 15:32:48 2001
@@ -1,6 +1,6 @@
 /* Driver for SanDisk SDDR-09 SmartMedia reader
  *
- * $Id: sddr09.c,v 1.21 2001/11/06 03:18:36 mdharm Exp $
+ * $Id: sddr09.c,v 1.22 2001/12/08 23:32:48 mdharm Exp $
  *
  * SDDR09 driver v0.1:
  *
@@ -79,7 +79,7 @@
        // copy the data into the buffer.
 /*
        if (xfer_len > 0) {
-               buffer = kmalloc(xfer_len, GFP_KERNEL);
+               buffer = kmalloc(xfer_len, GFP_NOIO);
                if (!(command[0] & USB_DIR_IN))
                        memcpy(buffer, xfer_data, xfer_len);
        }
@@ -303,7 +303,7 @@
 
        if (use_sg) {
                sg = (struct scatterlist *)content;
-               buffer = kmalloc(len, GFP_KERNEL);
+               buffer = kmalloc(len, GFP_NOIO);
                if (buffer == NULL)
                        return USB_STOR_TRANSPORT_ERROR;
                ptr = buffer;
@@ -630,17 +630,17 @@
 
        alloc_blocks = (alloc_len + (1<<17) - 1) >> 17;
        sg = kmalloc(alloc_blocks*sizeof(struct scatterlist),
-               GFP_KERNEL);
+               GFP_NOIO);
        if (sg == NULL)
                return 0;
 
        for (i=0; i<alloc_blocks; i++) {
                if (i<alloc_blocks-1) {
-                       sg[i].address = kmalloc( (1<<17), GFP_KERNEL );
+                       sg[i].address = kmalloc( (1<<17), GFP_NOIO );
                        sg[i].page = NULL;
                        sg[i].length = (1<<17);
                } else {
-                       sg[i].address = kmalloc(alloc_len, GFP_KERNEL);
+                       sg[i].address = kmalloc(alloc_len, GFP_NOIO);
                        sg[i].page = NULL;
                        sg[i].length = alloc_len;
                }
@@ -672,8 +672,8 @@
                kfree(info->lba_to_pba);
        if (info->pba_to_lba)
                kfree(info->pba_to_lba);
-       info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_KERNEL);
-       info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_KERNEL);
+       info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
+       info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
 
        if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) {
                if (info->lba_to_pba != NULL)
@@ -842,7 +842,7 @@
 
        if (!us->extra) {
                us->extra = kmalloc(
-                       sizeof(struct sddr09_card_info), GFP_KERNEL);
+                       sizeof(struct sddr09_card_info), GFP_NOIO);
                if (!us->extra)
                        return USB_STOR_TRANSPORT_ERROR;
                memset(us->extra, 0, sizeof(struct sddr09_card_info));
diff -u -X /home/mdharm/projects/dontdiff storage.old/shuttle_usbat.c 
storage/shuttle_usbat.c
--- storage.old/shuttle_usbat.c Sun Jul 29 21:11:50 2001
+++ storage/shuttle_usbat.c     Sat Dec  8 15:32:48 2001
@@ -1,6 +1,6 @@
 /* Driver for SCM Microsystems USB-ATAPI cable
  *
- * $Id: shuttle_usbat.c,v 1.14 2001/03/28 01:02:06 groovyjava Exp $
+ * $Id: shuttle_usbat.c,v 1.15 2001/12/08 23:32:48 mdharm Exp $
  *
  * Current development and maintenance by:
  *   (c) 2000, 2001 Robert Baruch ([EMAIL PROTECTED])
@@ -681,7 +681,7 @@
 
        len = (65535/srb->transfersize) * srb->transfersize;
        US_DEBUGP("Max read is %d bytes\n", len);
-       buffer = kmalloc(len, GFP_KERNEL);
+       buffer = kmalloc(len, GFP_NOIO);
        if (buffer == NULL) // bloody hell!
                return USB_STOR_TRANSPORT_FAILED;
        sector = short_pack(data[7+3], data[7+2]);
diff -u -X /home/mdharm/projects/dontdiff storage.old/transport.c storage/transport.c
--- storage.old/transport.c     Fri Nov  9 14:37:14 2001
+++ storage/transport.c Sat Dec  8 15:32:48 2001
@@ -1,6 +1,6 @@
 /* Driver for USB Mass Storage compliant devices
  *
- * $Id: transport.c,v 1.41 2001/10/15 07:02:32 mdharm Exp $
+ * $Id: transport.c,v 1.42 2001/12/08 23:32:48 mdharm Exp $
  *
  * Current development and maintenance by:
  *   (c) 1999, 2000 Matthew Dharm ([EMAIL PROTECTED])
@@ -388,7 +388,7 @@
        devrequest *dr;
 
        /* allocate the device request structure */
-       dr = kmalloc(sizeof(devrequest), GFP_KERNEL);
+       dr = kmalloc(sizeof(devrequest), GFP_NOIO);
        if (!dr)
                return -ENOMEM;
 
diff -u -X /home/mdharm/projects/dontdiff storage.old/unusual_devs.h 
storage/unusual_devs.h
--- storage.old/unusual_devs.h  Thu Nov 22 11:49:34 2001
+++ storage/unusual_devs.h      Fri Dec 28 19:38:21 2001
@@ -1,7 +1,7 @@
 /* Driver for USB Mass Storage compliant devices
  * Ununsual Devices File
  *
- * $Id: unusual_devs.h,v 1.20 2001/09/02 05:12:57 mdharm Exp $
+ * $Id: unusual_devs.h,v 1.24 2001/12/29 03:12:45 mdharm Exp $
  *
  * Current development and maintenance by:
  *   (c) 2000 Matthew Dharm ([EMAIL PROTECTED])
@@ -58,6 +58,11 @@
                "HP",
                "CD-Writer+ 8200e",
                US_SC_8070, US_PR_SCM_ATAPI, init_8200e, 0), 
+
+UNUSUAL_DEV(  0x03f0, 0x0307, 0x0001, 0x0001, 
+               "HP",
+               "CD-Writer+ CD-4e",
+               US_SC_8070, US_PR_SCM_ATAPI, init_8200e, 0), 
 #endif
 
 #ifdef CONFIG_USB_STORAGE_DPCM
@@ -86,6 +91,25 @@
                "FinePix 1400Zoom",
                US_SC_8070, US_PR_CBI, NULL, US_FL_FIX_INQUIRY),
 
+/* Reported by Peter W�chtler <[EMAIL PROTECTED]>
+ * The device needs the flags only.
+ */
+UNUSUAL_DEV(  0x04ce, 0x0002, 0x0074, 0x0074,
+               "ScanLogic",
+               "SL11R-IDE",
+               US_SC_SCSI, US_PR_BULK, NULL,
+               US_FL_FIX_INQUIRY),
+
+/* Reported by Kriston Fincher <[EMAIL PROTECTED]>
+ * Patch submitted by Sean Millichamp <[EMAIL PROTECTED]>
+ * This is to support the Panasonic PalmCam PV-SD4090
+ * This entry is needed because the device reports Sub=ff 
+ */
+UNUSUAL_DEV(  0x04da, 0x0901, 0x0100, 0x0200,
+               "Panasonic",
+               "LS-120 Camera",
+               US_SC_UFI, US_PR_CBI, NULL, 0),
+
 /* Most of the following entries were developed with the help of
  * Shuttle/SCM directly.
  */
@@ -161,14 +185,24 @@
                US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init,
                US_FL_SCM_MULT_TARG ),
 
+/* Iomega Clik! Drive 
+ * Reported by David Chatenay <[EMAIL PROTECTED]>
+ * The reason this is needed is not fully known.
+ */
+UNUSUAL_DEV(  0x0525, 0xa140, 0x0100, 0x0100,
+               "Iomega",
+               "USB Clik! 40",
+               US_SC_8070, US_PR_BULK, NULL,
+               US_FL_FIX_INQUIRY | US_FL_START_STOP ),
+
 /* This entry is needed because the device reports Sub=ff */
-UNUSUAL_DEV(  0x054c, 0x0010, 0x0106, 0x0322, 
+UNUSUAL_DEV(  0x054c, 0x0010, 0x0106, 0x0422, 
                "Sony",
                "DSC-S30/S70/S75/505V/F505", 
                US_SC_SCSI, US_PR_CB, NULL,
                US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_MODE_XLATE ),
 
-/* Reported by [EMAIL PROTECTED] */
+/* Reported by [EMAIL PROTECTED] */
 UNUSUAL_DEV(  0x054c, 0x0025, 0x0100, 0x0100, 
                "Sony",
                "Memorystick NW-MS7",
@@ -194,6 +228,13 @@
                US_SC_UFI, US_PR_CB, NULL,
                US_FL_SINGLE_LUN | US_FL_START_STOP ),
                
+/* Submitted by Nathan Babb <[EMAIL PROTECTED]> */
+UNUSUAL_DEV(  0x054c, 0x006d, 0x0000, 0x9999,
+                "Sony",
+               "PEG Mass Storage",
+               US_SC_8070, US_PR_CBI, NULL,
+               US_FL_FIX_INQUIRY ),
+               
 UNUSUAL_DEV(  0x057b, 0x0000, 0x0000, 0x0299, 
                "Y-E Data",
                "Flashbuster-U",
@@ -264,6 +305,14 @@
                US_FL_SINGLE_LUN | US_FL_START_STOP ),
 #endif
 
+/* Submitted by [EMAIL PROTECTED]
+ * Needed for START_STOP flag */
+UNUSUAL_DEV( 0x0686, 0x4007, 0x0001, 0x0001,
+                "Minolta",
+                "Dimage S304",
+                US_SC_SCSI, US_PR_BULK, NULL,
+                US_FL_START_STOP ),
+
 UNUSUAL_DEV(  0x0693, 0x0002, 0x0100, 0x0100, 
                "Hagiwara",
                "FlashGate SmartMedia",
@@ -307,7 +356,7 @@
                 US_SC_QIC, US_PR_FREECOM, freecom_init, 0),
 #endif
 
-UNUSUAL_DEV(  0x07af, 0x0004, 0x0100, 0x0100, 
+UNUSUAL_DEV(  0x07af, 0x0004, 0x0100, 0x0133, 
                "Microtech",
                "USB-SCSI-DB25",
                US_SC_SCSI, US_PR_BULK, usb_stor_euscsi_init,
@@ -374,16 +423,23 @@
                "Simple Tech/Datafab CF+SM Reader",
                US_SC_SCSI, US_PR_DATAFAB, NULL,
                US_FL_MODE_XLATE | US_FL_START_STOP ),
+
+/* Submitted by Olaf Hering <[EMAIL PROTECTED]> */
+UNUSUAL_DEV(  0x07c4, 0xa109, 0x0000, 0xffff,
+               "Datafab Systems, Inc.",
+               "USB to CF + SM Combo (LC1)",
+               US_SC_SCSI, US_PR_DATAFAB, NULL,
+               US_FL_MODE_XLATE | US_FL_START_STOP ),
 #endif
 
-/* Casio QV 2x00/3x00/8000 digital still cameras are not conformant
+/* Casio QV 2x00/3x00/4000/8000 digital still cameras are not conformant
  * to the USB storage specification in two ways:
  * - They tell us they are using transport protocol CBI. In reality they
  *   are using transport protocol CB.
  * - They don't like the INQUIRY command. So we must handle this command
  *   of the SCSI layer ourselves.
  */
-UNUSUAL_DEV( 0x07cf, 0x1001, 0x9009, 0x9009,
+UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9009,
                 "Casio",
                 "QV DigitalCamera",
                 US_SC_8070, US_PR_CB, NULL,
@@ -402,3 +458,12 @@
                 US_SC_ISD200, US_PR_BULK, isd200_Initialization,
                 0 ),
 #endif
+
+/* Reported by Dan Pilone <[EMAIL PROTECTED]>
+ * The device needs the flags only.
+ */
+UNUSUAL_DEV(  0x1065, 0x2136, 0x0000, 0x9999,
+               "CCYU TECHNOLOGY",
+               "EasyDisk Portable Device",
+               US_SC_SCSI, US_PR_BULK, NULL,
+               US_FL_MODE_XLATE | US_FL_START_STOP),

Attachment: msg02086/pgp00000.pgp
Description: PGP signature

Reply via email to