[SCSI] aacraid: ignore adapter reset check polarity
[sfrench/cifs-2.6.git] / drivers / scsi / aacraid / linit.c
index fb0886140dd788efa31f220558247e16439fab98..fdfbad0903fdf30945175719574109dcea12f8dd 100644 (file)
@@ -275,9 +275,9 @@ static const char *aac_info(struct Scsi_Host *shost)
 
 /**
  *     aac_get_driver_ident
- *     @devtype: index into lookup table
+ *     @devtype: index into lookup table
  *
- *     Returns a pointer to the entry in the driver lookup table.
+ *     Returns a pointer to the entry in the driver lookup table.
  */
 
 struct aac_driver_ident* aac_get_driver_ident(int devtype)
@@ -641,7 +641,7 @@ static int aac_eh_reset(struct scsi_cmnd* cmd)
           AAC_OPTION_MU_RESET) &&
          aac_check_reset &&
          ((aac_check_reset != 1) ||
-          (aac->supplement_adapter_info.SupportedOptions2 &
+          !(aac->supplement_adapter_info.SupportedOptions2 &
            AAC_OPTION_IGNORE_RESET)))
                aac_reset_adapter(aac, 2); /* Bypass wait for command quiesce */
        return SUCCESS; /* Cause an immediate retry of the command with a ten second delay after successful tur */
@@ -1004,32 +1004,32 @@ static const struct file_operations aac_cfg_fops = {
 
 static struct scsi_host_template aac_driver_template = {
        .module                         = THIS_MODULE,
-       .name                           = "AAC",
+       .name                           = "AAC",
        .proc_name                      = AAC_DRIVERNAME,
-       .info                           = aac_info,
-       .ioctl                          = aac_ioctl,
+       .info                           = aac_info,
+       .ioctl                          = aac_ioctl,
 #ifdef CONFIG_COMPAT
        .compat_ioctl                   = aac_compat_ioctl,
 #endif
-       .queuecommand                   = aac_queuecommand,
-       .bios_param                     = aac_biosparm,
+       .queuecommand                   = aac_queuecommand,
+       .bios_param                     = aac_biosparm,
        .shost_attrs                    = aac_attrs,
        .slave_configure                = aac_slave_configure,
        .change_queue_depth             = aac_change_queue_depth,
        .sdev_attrs                     = aac_dev_attrs,
        .eh_abort_handler               = aac_eh_abort,
        .eh_host_reset_handler          = aac_eh_reset,
-       .can_queue                      = AAC_NUM_IO_FIB,
-       .this_id                        = MAXIMUM_NUM_CONTAINERS,
-       .sg_tablesize                   = 16,
-       .max_sectors                    = 128,
+       .can_queue                      = AAC_NUM_IO_FIB,
+       .this_id                        = MAXIMUM_NUM_CONTAINERS,
+       .sg_tablesize                   = 16,
+       .max_sectors                    = 128,
 #if (AAC_NUM_IO_FIB > 256)
        .cmd_per_lun                    = 256,
 #else
-       .cmd_per_lun                    = AAC_NUM_IO_FIB,
+       .cmd_per_lun                    = AAC_NUM_IO_FIB,
 #endif
        .use_clustering                 = ENABLE_CLUSTERING,
-       .emulated                       = 1,
+       .emulated                       = 1,
 };
 
 static void __aac_shutdown(struct aac_dev * aac)
@@ -1039,6 +1039,8 @@ static void __aac_shutdown(struct aac_dev * aac)
        aac_send_shutdown(aac);
        aac_adapter_disable_int(aac);
        free_irq(aac->pdev->irq, aac);
+       if (aac->msi)
+               pci_disable_msi(aac->pdev);
 }
 
 static int __devinit aac_probe_one(struct pci_dev *pdev,
@@ -1130,31 +1132,29 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
        if (error < 0)
                goto out_deinit;
 
-       if (!(aac->adapter_info.options & AAC_OPT_NEW_COMM)) {
-               error = pci_set_dma_max_seg_size(pdev, 65536);
-               if (error)
-                       goto out_deinit;
-       }
-
        /*
         * Lets override negotiations and drop the maximum SG limit to 34
         */
        if ((aac_drivers[index].quirks & AAC_QUIRK_34SG) &&
-                       (aac->scsi_host_ptr->sg_tablesize > 34)) {
-               aac->scsi_host_ptr->sg_tablesize = 34;
-               aac->scsi_host_ptr->max_sectors
-                 = (aac->scsi_host_ptr->sg_tablesize * 8) + 112;
+                       (shost->sg_tablesize > 34)) {
+               shost->sg_tablesize = 34;
+               shost->max_sectors = (shost->sg_tablesize * 8) + 112;
        }
 
        if ((aac_drivers[index].quirks & AAC_QUIRK_17SG) &&
-                       (aac->scsi_host_ptr->sg_tablesize > 17)) {
-               aac->scsi_host_ptr->sg_tablesize = 17;
-               aac->scsi_host_ptr->max_sectors
-                 = (aac->scsi_host_ptr->sg_tablesize * 8) + 112;
+                       (shost->sg_tablesize > 17)) {
+               shost->sg_tablesize = 17;
+               shost->max_sectors = (shost->sg_tablesize * 8) + 112;
        }
 
+       error = pci_set_dma_max_seg_size(pdev,
+               (aac->adapter_info.options & AAC_OPT_NEW_COMM) ?
+                       (shost->max_sectors << 9) : 65536);
+       if (error)
+               goto out_deinit;
+
        /*
-        * Firware printf works only with older firmware.
+        * Firmware printf works only with older firmware.
         */
        if (aac_drivers[index].quirks & AAC_QUIRK_34SG)
                aac->printf_enabled = 1;
@@ -1256,7 +1256,7 @@ static struct pci_driver aac_pci_driver = {
        .id_table       = aac_pci_tbl,
        .probe          = aac_probe_one,
        .remove         = __devexit_p(aac_remove_one),
-       .shutdown       = aac_shutdown,
+       .shutdown       = aac_shutdown,
 };
 
 static int __init aac_init(void)
@@ -1273,7 +1273,7 @@ static int __init aac_init(void)
        aac_cfg_major = register_chrdev( 0, "aac", &aac_cfg_fops);
        if (aac_cfg_major < 0) {
                printk(KERN_WARNING
-                      "aacraid: unable to register \"aac\" device.\n");
+                       "aacraid: unable to register \"aac\" device.\n");
        }
 
        return 0;