[SCSI] aacraid: forced reset override

Some of our vendors have requested that our adapters ignore the hardware
reset attempts during recovery and have enforced this with changes in
Adapter Firmware. Some of our customers have requested the option to be
able to reset the adapter under adverse adapter failure, we even had a
few defects reported here considering it a regression that the Adapter
could not be reset. This patch addresses this dichotomy. The user can
force the adapter to be reset if it supports the IOP_RESET_ALWAYS
command, in cases where the adapter has been programmed to ignore the
reset, by setting the aacraid.check_reset parameter to a value of -1.

The driver will not reset an Adapter that does not support the reset
command(s).

This patch also fixes and cleans up some of the logic associated with
resetting the adapter.

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James <James.Bottomley@HansenPartnership.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index a77ab8d..ad8912c 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -179,7 +179,7 @@
 
 int aac_check_reset = 1;
 module_param_named(check_reset, aac_check_reset, int, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(aac_check_reset, "If adapter fails health check, reset the adapter.");
+MODULE_PARM_DESC(aac_check_reset, "If adapter fails health check, reset the adapter. a value of -1 forces the reset to adapters programmed to ignore it.");
 
 int expose_physicals = -1;
 module_param(expose_physicals, int, S_IRUGO|S_IWUSR);
@@ -1305,9 +1305,9 @@
 			  (int)sizeof(dev->supplement_adapter_info.VpdInfo.Tsid),
 			  dev->supplement_adapter_info.VpdInfo.Tsid);
 		}
-		if (!aac_check_reset ||
+		if (!aac_check_reset || ((aac_check_reset != 1) &&
 		  (dev->supplement_adapter_info.SupportedOptions2 &
-		  le32_to_cpu(AAC_OPTION_IGNORE_RESET))) {
+		  le32_to_cpu(AAC_OPTION_IGNORE_RESET)))) {
 			printk(KERN_INFO "%s%d: Reset Adapter Ignored\n",
 			  dev->name, dev->id);
 		}
@@ -1798,7 +1798,7 @@
 	if (active)
 		return SCSI_MLQUEUE_DEVICE_BUSY;
 
-	aac = (struct aac_dev *)scsicmd->device->host->hostdata;
+	aac = (struct aac_dev *)sdev->host->hostdata;
 	if (aac->in_reset)
 		return SCSI_MLQUEUE_HOST_BUSY;