usb-storage: add new no_read_capacity_16 quirk
[pandora-kernel.git] / drivers / usb / storage / scsiglue.c
index d8d98cf..a688b1e 100644 (file)
@@ -113,7 +113,7 @@ static int slave_alloc (struct scsi_device *sdev)
         * Let the scanning code know if this target merely sets
         * Peripheral Device Type to 0x1f to indicate no LUN.
         */
-       if (us->subclass == US_SC_UFI)
+       if (us->subclass == USB_SC_UFI)
                sdev->sdev_target->pdt_1f_for_no_lun = 1;
 
        return 0;
@@ -176,7 +176,7 @@ static int slave_configure(struct scsi_device *sdev)
                /* Disk-type devices use MODE SENSE(6) if the protocol
                 * (SubClass) is Transparent SCSI, otherwise they use
                 * MODE SENSE(10). */
-               if (us->subclass != US_SC_SCSI && us->subclass != US_SC_CYP_ATACB)
+               if (us->subclass != USB_SC_SCSI && us->subclass != USB_SC_CYP_ATACB)
                        sdev->use_10_for_ms = 1;
 
                /* Many disks only accept MODE SENSE transfer lengths of
@@ -209,6 +209,10 @@ static int slave_configure(struct scsi_device *sdev)
                if (us->fflags & US_FL_CAPACITY_HEURISTICS)
                        sdev->guess_capacity = 1;
 
+               /* Some devices cannot handle READ_CAPACITY_16 */
+               if (us->fflags & US_FL_NO_READ_CAPACITY_16)
+                       sdev->no_read_capacity_16 = 1;
+
                /* assume SPC3 or latter devices support sense size > 18 */
                if (sdev->scsi_level > SCSI_SPC_2)
                        us->fflags |= US_FL_SANE_SENSE;
@@ -245,7 +249,7 @@ static int slave_configure(struct scsi_device *sdev)
                 * capacity will be decremented or is correct. */
                if (!(us->fflags & (US_FL_FIX_CAPACITY | US_FL_CAPACITY_OK |
                                        US_FL_SCM_MULT_TARG)) &&
-                               us->protocol == US_PR_BULK)
+                               us->protocol == USB_PR_BULK)
                        us->use_last_sector_hacks = 1;
        } else {
 
@@ -253,6 +257,10 @@ static int slave_configure(struct scsi_device *sdev)
                 * or to force 192-byte transfer lengths for MODE SENSE.
                 * But they do need to use MODE SENSE(10). */
                sdev->use_10_for_ms = 1;
+
+               /* Some (fake) usb cdrom devices don't like READ_DISC_INFO */
+               if (us->fflags & US_FL_NO_READ_DISC_INFO)
+                       sdev->no_read_disc_info = 1;
        }
 
        /* The CB and CBI transports have no way to pass LUN values
@@ -261,7 +269,7 @@ static int slave_configure(struct scsi_device *sdev)
         * scsi_level == 0 (UNKNOWN).  Hence such devices must necessarily
         * be single-LUN.
         */
-       if ((us->protocol == US_PR_CB || us->protocol == US_PR_CBI) &&
+       if ((us->protocol == USB_PR_CB || us->protocol == USB_PR_CBI) &&
                        sdev->scsi_level == SCSI_UNKNOWN)
                us->max_lun = 0;