]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Oct 2008 20:02:03 +0000 (13:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Oct 2008 20:02:03 +0000 (13:02 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (21 commits)
  [SCSI] sd: fix computation of the full size of the device
  [SCSI] lib: string_get_size(): don't hang on zero; no decimals on exact
  [SCSI] sun3x_esp: Convert && to ||
  [SCSI] sd: remove command-size switching code
  [SCSI] 3w-9xxx: remove unnecessary local_irq_save/restore for scsi sg copy API
  [SCSI] 3w-xxxx: remove unnecessary local_irq_save/restore for scsi sg copy API
  [SCSI] fix netlink kernel-doc
  [SCSI] sd: Fix handling of NO_SENSE check condition
  [SCSI] export busy state via q->lld_busy_fn()
  [SCSI] refactor sdev/starget/shost busy checking
  [SCSI] mptfusion: Increase scsi-timeouts, similariy to the LSI 4.x driver.
  [SCSI] aic7xxx: Take the LED out of diagnostic mode on PM resume
  [SCSI] aic79xx: user visible misuse wrong SI units (not disk size!)
  [SCSI] ipr: use memory_read_from_buffer()
  [SCSI] aic79xx: fix shadowed variables
  [SCSI] aic79xx: fix shadowed variables, add statics
  [SCSI] aic7xxx: update *_shipped files
  [SCSI] aic7xxx: update .reg files
  [SCSI] aic7xxx: introduce "dont_generate_debug_code" keyword in aicasm parser
  [SCSI] scsi_dh: Initialize path state to be passive when path is not owned
  ...

1  2 
drivers/scsi/ipr.c
drivers/scsi/sd.c

diff --combined drivers/scsi/ipr.c
index 098739deb02e1394dc466f51061284a484245cf8,de62f4dfeb0e067415a504873557432b99ebdca6..ded854a6dd35bd0d916f630090fc87990cd59182
@@@ -2456,20 -2456,14 +2456,14 @@@ static ssize_t ipr_read_trace(struct ko
        struct Scsi_Host *shost = class_to_shost(dev);
        struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
        unsigned long lock_flags = 0;
-       int size = IPR_TRACE_SIZE;
-       char *src = (char *)ioa_cfg->trace;
-       if (off > size)
-               return 0;
-       if (off + count > size) {
-               size -= off;
-               count = size;
-       }
+       ssize_t ret;
  
        spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
-       memcpy(buf, &src[off], count);
+       ret = memory_read_from_buffer(buf, count, &off, ioa_cfg->trace,
+                               IPR_TRACE_SIZE);
        spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
-       return count;
+       return ret;
  }
  
  static struct bin_attribute ipr_trace_attr = {
@@@ -7859,6 -7853,7 +7853,6 @@@ static struct pci_driver ipr_driver = 
        .remove = ipr_remove,
        .shutdown = ipr_shutdown,
        .err_handler = &ipr_err_handler,
 -      .dynids.use_driver_data = 1
  };
  
  /**
diff --combined drivers/scsi/sd.c
index 43f34c73df126b3e93a98ab819921fe50999d612,7ba70bef8b5d03e8f5cd41ab35e2906123381e56..c9e1242eaf2511067e122e89b331d438823a0a69
@@@ -609,15 -609,17 +609,15 @@@ static int sd_prep_fn(struct request_qu
   *    In the latter case @inode and @filp carry an abridged amount
   *    of information as noted above.
   **/
 -static int sd_open(struct inode *inode, struct file *filp)
 +static int sd_open(struct block_device *bdev, fmode_t mode)
  {
 -      struct gendisk *disk = inode->i_bdev->bd_disk;
 -      struct scsi_disk *sdkp;
 +      struct scsi_disk *sdkp = scsi_disk_get(bdev->bd_disk);
        struct scsi_device *sdev;
        int retval;
  
 -      if (!(sdkp = scsi_disk_get(disk)))
 +      if (!sdkp)
                return -ENXIO;
  
 -
        SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_open\n"));
  
        sdev = sdkp->device;
                goto error_out;
  
        if (sdev->removable || sdkp->write_prot)
 -              check_disk_change(inode->i_bdev);
 +              check_disk_change(bdev);
  
        /*
         * If the drive is empty, just let the open fail.
         */
        retval = -ENOMEDIUM;
 -      if (sdev->removable && !sdkp->media_present &&
 -          !(filp->f_flags & O_NDELAY))
 +      if (sdev->removable && !sdkp->media_present && !(mode & FMODE_NDELAY))
                goto error_out;
  
        /*
         * if the user expects to be able to write to the thing.
         */
        retval = -EROFS;
 -      if (sdkp->write_prot && (filp->f_mode & FMODE_WRITE))
 +      if (sdkp->write_prot && (mode & FMODE_WRITE))
                goto error_out;
  
        /*
@@@ -681,8 -684,9 +681,8 @@@ error_out
   *    Note: may block (uninterruptible) if error recovery is underway
   *    on this disk.
   **/
 -static int sd_release(struct inode *inode, struct file *filp)
 +static int sd_release(struct gendisk *disk, fmode_t mode)
  {
 -      struct gendisk *disk = inode->i_bdev->bd_disk;
        struct scsi_disk *sdkp = scsi_disk(disk);
        struct scsi_device *sdev = sdkp->device;
  
@@@ -739,9 -743,10 +739,9 @@@ static int sd_getgeo(struct block_devic
   *    Note: most ioctls are forward onto the block subsystem or further
   *    down in the scsi subsystem.
   **/
 -static int sd_ioctl(struct inode * inode, struct file * filp, 
 +static int sd_ioctl(struct block_device *bdev, fmode_t mode,
                    unsigned int cmd, unsigned long arg)
  {
 -      struct block_device *bdev = inode->i_bdev;
        struct gendisk *disk = bdev->bd_disk;
        struct scsi_device *sdp = scsi_disk(disk)->device;
        void __user *p = (void __user *)arg;
         * may try and take the device offline, in which case all further
         * access to the device is prohibited.
         */
 -      error = scsi_nonblockable_ioctl(sdp, cmd, p, filp);
 +      error = scsi_nonblockable_ioctl(sdp, cmd, p,
 +                                      (mode & FMODE_NDELAY_NOW) != 0);
        if (!scsi_block_when_processing_errors(sdp) || !error)
                return error;
  
                case SCSI_IOCTL_GET_BUS_NUMBER:
                        return scsi_ioctl(sdp, cmd, p);
                default:
 -                      error = scsi_cmd_ioctl(filp, disk->queue, disk, cmd, p);
 +                      error = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, p);
                        if (error != -ENOTTY)
                                return error;
        }
@@@ -924,10 -928,11 +924,10 @@@ static void sd_rescan(struct device *de
   * This gets directly called from VFS. When the ioctl 
   * is not recognized we go back to the other translation paths. 
   */
 -static long sd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 +static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode,
 +                         unsigned int cmd, unsigned long arg)
  {
 -      struct block_device *bdev = file->f_path.dentry->d_inode->i_bdev;
 -      struct gendisk *disk = bdev->bd_disk;
 -      struct scsi_device *sdev = scsi_disk(disk)->device;
 +      struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device;
  
        /*
         * If we are in the middle of error recovery, don't let anyone
@@@ -957,7 -962,7 +957,7 @@@ static struct block_device_operations s
        .owner                  = THIS_MODULE,
        .open                   = sd_open,
        .release                = sd_release,
 -      .ioctl                  = sd_ioctl,
 +      .locked_ioctl           = sd_ioctl,
        .getgeo                 = sd_getgeo,
  #ifdef CONFIG_COMPAT
        .compat_ioctl           = sd_compat_ioctl,
@@@ -1049,7 -1054,6 +1049,6 @@@ static int sd_done(struct scsi_cmnd *SC
                good_bytes = sd_completed_bytes(SCpnt);
                break;
        case RECOVERED_ERROR:
-       case NO_SENSE:
                /* Inform the user, but make sure that it's not treated
                 * as a hard error.
                 */
                memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
                good_bytes = scsi_bufflen(SCpnt);
                break;
+       case NO_SENSE:
+               /* This indicates a false check condition, so ignore it.  An
+                * unknown amount of data was transferred so treat it as an
+                * error.
+                */
+               scsi_print_sense("sd", SCpnt);
+               SCpnt->result = 0;
+               memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
+               break;
        case ABORTED_COMMAND:
                if (sshdr.asc == 0x10) { /* DIF: Disk detected corruption */
                        scsi_print_result(SCpnt);
                        scsi_print_sense("sd", SCpnt);
                        good_bytes = sd_completed_bytes(SCpnt);
                }
-               if (!scsi_device_protection(SCpnt->device) &&
-                   SCpnt->device->use_10_for_rw &&
-                   (SCpnt->cmnd[0] == READ_10 ||
-                    SCpnt->cmnd[0] == WRITE_10))
-                       SCpnt->device->use_10_for_rw = 0;
-               if (SCpnt->device->use_10_for_ms &&
-                   (SCpnt->cmnd[0] == MODE_SENSE_10 ||
-                    SCpnt->cmnd[0] == MODE_SELECT_10))
-                       SCpnt->device->use_10_for_ms = 0;
                break;
        default:
                break;
@@@ -1432,7 -1436,7 +1431,7 @@@ got_data
  
        {
                char cap_str_2[10], cap_str_10[10];
-               u64 sz = sdkp->capacity << ffz(~sector_size);
+               u64 sz = (u64)sdkp->capacity << ilog2(sector_size);
  
                string_get_size(sz, STRING_UNITS_2, cap_str_2,
                                sizeof(cap_str_2));