Update to 3.4-final.
[linux-flexiantxendom0-3.2.10.git] / drivers / block / DAC960.c
index da0f6dd..9a13e88 100644 (file)
@@ -140,13 +140,14 @@ static int DAC960_getgeo(struct block_device *bdev, struct hd_geometry *geo)
        return 0;
 }
 
-static int DAC960_media_changed(struct gendisk *disk)
+static unsigned int DAC960_check_events(struct gendisk *disk,
+                                       unsigned int clearing)
 {
        DAC960_Controller_T *p = disk->queue->queuedata;
        int drive_nr = (long)disk->private_data;
 
        if (!p->LogicalDriveInitiallyAccessible[drive_nr])
-               return 1;
+               return DISK_EVENT_MEDIA_CHANGE;
        return 0;
 }
 
@@ -163,7 +164,7 @@ static const struct block_device_operations DAC960_BlockDeviceOperations = {
        .owner                  = THIS_MODULE,
        .open                   = DAC960_open,
        .getgeo                 = DAC960_getgeo,
-       .media_changed          = DAC960_media_changed,
+       .check_events           = DAC960_check_events,
        .revalidate_disk        = DAC960_revalidate_disk,
 };
 
@@ -1176,7 +1177,8 @@ static bool DAC960_V1_EnableMemoryMailboxInterface(DAC960_Controller_T
   int TimeoutCounter;
   int i;
 
-  
+  memset(&CommandMailbox, 0, sizeof(DAC960_V1_CommandMailbox_T));
+
   if (pci_set_dma_mask(Controller->PCIDevice, DMA_BIT_MASK(32)))
        return DAC960_Failure(Controller, "DMA mask out of range");
   Controller->BounceBufferLimit = DMA_BIT_MASK(32);
@@ -1789,7 +1791,7 @@ static bool DAC960_V2_ReadControllerConfiguration(DAC960_Controller_T
   unsigned short LogicalDeviceNumber = 0;
   int ModelNameLength;
 
-  /* Get data into dma-able area, then copy into permanant location */
+  /* Get data into dma-able area, then copy into permanent location */
   if (!DAC960_V2_NewControllerInfo(Controller))
     return DAC960_Failure(Controller, "GET CONTROLLER INFO");
   memcpy(ControllerInfo, Controller->V2.NewControllerInformation,
@@ -4626,7 +4628,8 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command)
   DAC960_Controller_T *Controller = Command->Controller;
   DAC960_CommandType_T CommandType = Command->CommandType;
   DAC960_V2_CommandMailbox_T *CommandMailbox = &Command->V2.CommandMailbox;
-  DAC960_V2_IOCTL_Opcode_T CommandOpcode = CommandMailbox->Common.IOCTL_Opcode;
+  DAC960_V2_IOCTL_Opcode_T IOCTLOpcode = CommandMailbox->Common.IOCTL_Opcode;
+  DAC960_V2_CommandOpcode_T CommandOpcode = CommandMailbox->SCSI_10.CommandOpcode;
   DAC960_V2_CommandStatus_T CommandStatus = Command->V2.CommandStatus;
 
   if (CommandType == DAC960_ReadCommand ||
@@ -4698,7 +4701,7 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command)
     {
       if (Controller->ShutdownMonitoringTimer)
              return;
-      if (CommandOpcode == DAC960_V2_GetControllerInfo)
+      if (IOCTLOpcode == DAC960_V2_GetControllerInfo)
        {
          DAC960_V2_ControllerInfo_T *NewControllerInfo =
            Controller->V2.NewControllerInformation;
@@ -4718,14 +4721,14 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command)
          memcpy(ControllerInfo, NewControllerInfo,
                 sizeof(DAC960_V2_ControllerInfo_T));
        }
-      else if (CommandOpcode == DAC960_V2_GetEvent)
+      else if (IOCTLOpcode == DAC960_V2_GetEvent)
        {
          if (CommandStatus == DAC960_V2_NormalCompletion) {
            DAC960_V2_ReportEvent(Controller, Controller->V2.Event);
          }
          Controller->V2.NextEventSequenceNumber++;
        }
-      else if (CommandOpcode == DAC960_V2_GetPhysicalDeviceInfoValid &&
+      else if (IOCTLOpcode == DAC960_V2_GetPhysicalDeviceInfoValid &&
               CommandStatus == DAC960_V2_NormalCompletion)
        {
          DAC960_V2_PhysicalDeviceInfo_T *NewPhysicalDeviceInfo =
@@ -4914,7 +4917,7 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command)
          NewPhysicalDeviceInfo->LogicalUnit++;
          Controller->V2.PhysicalDeviceIndex++;
        }
-      else if (CommandOpcode == DAC960_V2_GetPhysicalDeviceInfoValid)
+      else if (IOCTLOpcode == DAC960_V2_GetPhysicalDeviceInfoValid)
        {
          unsigned int DeviceIndex;
          for (DeviceIndex = Controller->V2.PhysicalDeviceIndex;
@@ -4937,7 +4940,7 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command)
            }
          Controller->V2.NeedPhysicalDeviceInformation = false;
        }
-      else if (CommandOpcode == DAC960_V2_GetLogicalDeviceInfoValid &&
+      else if (IOCTLOpcode == DAC960_V2_GetLogicalDeviceInfoValid &&
               CommandStatus == DAC960_V2_NormalCompletion)
        {
          DAC960_V2_LogicalDeviceInfo_T *NewLogicalDeviceInfo =
@@ -5064,7 +5067,7 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command)
                         [LogicalDeviceNumber] = true;
          NewLogicalDeviceInfo->LogicalDeviceNumber++;
        }
-      else if (CommandOpcode == DAC960_V2_GetLogicalDeviceInfoValid)
+      else if (IOCTLOpcode == DAC960_V2_GetLogicalDeviceInfoValid)
        {
          int LogicalDriveNumber;
          for (LogicalDriveNumber = 0;
@@ -6577,24 +6580,21 @@ static const struct file_operations dac960_user_command_proc_fops = {
 
 static void DAC960_CreateProcEntries(DAC960_Controller_T *Controller)
 {
-       struct proc_dir_entry *StatusProcEntry;
        struct proc_dir_entry *ControllerProcEntry;
-       struct proc_dir_entry *UserCommandProcEntry;
 
        if (DAC960_ProcDirectoryEntry == NULL) {
-               DAC960_ProcDirectoryEntry = proc_mkdir("rd", NULL);
-               StatusProcEntry = proc_create("status", 0,
-                                          DAC960_ProcDirectoryEntry,
-                                          &dac960_proc_fops);
+               DAC960_ProcDirectoryEntry = proc_mkdir("rd", NULL);
+               proc_create("status", 0, DAC960_ProcDirectoryEntry,
+                           &dac960_proc_fops);
        }
 
-      sprintf(Controller->ControllerName, "c%d", Controller->ControllerNumber);
-      ControllerProcEntry = proc_mkdir(Controller->ControllerName,
-                                      DAC960_ProcDirectoryEntry);
-      proc_create_data("initial_status", 0, ControllerProcEntry, &dac960_initial_status_proc_fops, Controller);
-      proc_create_data("current_status", 0, ControllerProcEntry, &dac960_current_status_proc_fops, Controller);
-      UserCommandProcEntry = proc_create_data("user_command", S_IWUSR | S_IRUSR, ControllerProcEntry, &dac960_user_command_proc_fops, Controller);
-      Controller->ControllerProcEntry = ControllerProcEntry;
+       sprintf(Controller->ControllerName, "c%d", Controller->ControllerNumber);
+       ControllerProcEntry = proc_mkdir(Controller->ControllerName,
+                                        DAC960_ProcDirectoryEntry);
+       proc_create_data("initial_status", 0, ControllerProcEntry, &dac960_initial_status_proc_fops, Controller);
+       proc_create_data("current_status", 0, ControllerProcEntry, &dac960_current_status_proc_fops, Controller);
+       proc_create_data("user_command", S_IWUSR | S_IRUSR, ControllerProcEntry, &dac960_user_command_proc_fops, Controller);
+       Controller->ControllerProcEntry = ControllerProcEntry;
 }
 
 
@@ -7063,7 +7063,8 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request,
 
 static const struct file_operations DAC960_gam_fops = {
        .owner          = THIS_MODULE,
-       .unlocked_ioctl = DAC960_gam_ioctl
+       .unlocked_ioctl = DAC960_gam_ioctl,
+       .llseek         = noop_llseek,
 };
 
 static struct miscdevice DAC960_gam_dev = {