Merge branch 'master' into upstream
[sfrench/cifs-2.6.git] / drivers / block / DAC960.c
index 9bdea2a5cf0e4605e33116529013006da84e8786..2568640430fb06e927d41f67918eb29a46d7163d 100644 (file)
@@ -17,8 +17,8 @@
 */
 
 
-#define DAC960_DriverVersion                   "2.5.47"
-#define DAC960_DriverDate                      "14 November 2002"
+#define DAC960_DriverVersion                   "2.5.48"
+#define DAC960_DriverDate                      "14 May 2006"
 
 
 #include <linux/module.h>
@@ -41,6 +41,7 @@
 #include <linux/timer.h>
 #include <linux/pci.h>
 #include <linux/init.h>
+#include <linux/jiffies.h>
 #include <linux/random.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -311,11 +312,10 @@ static boolean DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
                CommandsRemaining = CommandAllocationGroupSize;
          CommandGroupByteCount =
                CommandsRemaining * CommandAllocationLength;
-         AllocationPointer = kmalloc(CommandGroupByteCount, GFP_ATOMIC);
+         AllocationPointer = kzalloc(CommandGroupByteCount, GFP_ATOMIC);
          if (AllocationPointer == NULL)
                return DAC960_Failure(Controller,
                                        "AUXILIARY STRUCTURE CREATION");
-         memset(AllocationPointer, 0, CommandGroupByteCount);
         }
       Command = (DAC960_Command_T *) AllocationPointer;
       AllocationPointer += CommandAllocationLength;
@@ -2530,7 +2530,6 @@ static boolean DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller)
        blk_queue_max_sectors(RequestQueue, Controller->MaxBlocksPerCommand);
        disk->queue = RequestQueue;
        sprintf(disk->disk_name, "rd/c%dd%d", Controller->ControllerNumber, n);
-       sprintf(disk->devfs_name, "rd/host%d/target%d", Controller->ControllerNumber, n);
        disk->major = MajorNumber;
        disk->first_minor = n << DAC960_MaxPartitionsBits;
        disk->fops = &DAC960_BlockDeviceOperations;
@@ -2709,14 +2708,12 @@ DAC960_DetectController(struct pci_dev *PCI_Device,
   void __iomem *BaseAddress;
   int i;
 
-  Controller = (DAC960_Controller_T *)
-       kmalloc(sizeof(DAC960_Controller_T), GFP_ATOMIC);
+  Controller = kzalloc(sizeof(DAC960_Controller_T), GFP_ATOMIC);
   if (Controller == NULL) {
        DAC960_Error("Unable to allocate Controller structure for "
                        "Controller at\n", NULL);
        return NULL;
   }
-  memset(Controller, 0, sizeof(DAC960_Controller_T));
   Controller->ControllerNumber = DAC960_ControllerCount;
   DAC960_Controllers[DAC960_ControllerCount++] = Controller;
   Controller->Bus = PCI_Device->bus->number;
@@ -3017,7 +3014,7 @@ DAC960_DetectController(struct pci_dev *PCI_Device,
      Acquire shared access to the IRQ Channel.
   */
   IRQ_Channel = PCI_Device->irq;
-  if (request_irq(IRQ_Channel, InterruptHandler, SA_SHIRQ,
+  if (request_irq(IRQ_Channel, InterruptHandler, IRQF_SHARED,
                      Controller->FullModelName, Controller) < 0)
   {
        DAC960_Error("Unable to acquire IRQ Channel %d for Controller at\n",
@@ -3334,7 +3331,7 @@ static int DAC960_process_queue(DAC960_Controller_T *Controller, struct request_
                Command->DmaDirection = PCI_DMA_TODEVICE;
                Command->CommandType = DAC960_WriteCommand;
        }
-       Command->Completion = Request->waiting;
+       Command->Completion = Request->end_io_data;
        Command->LogicalDriveNumber = (long)Request->rq_disk->private_data;
        Command->BlockNumber = Request->sector;
        Command->BlockCount = Request->nr_sectors;
@@ -3657,8 +3654,8 @@ static void DAC960_V1_ProcessCompletedCommand(DAC960_Command_T *Command)
              (NewEnquiry->EventLogSequenceNumber !=
               OldEnquiry->EventLogSequenceNumber) ||
              Controller->MonitoringTimerCount == 0 ||
-             (jiffies - Controller->SecondaryMonitoringTime
-              >= DAC960_SecondaryMonitoringInterval))
+             time_after_eq(jiffies, Controller->SecondaryMonitoringTime
+              + DAC960_SecondaryMonitoringInterval))
            {
              Controller->V1.NeedLogicalDriveInformation = true;
              Controller->V1.NewEventLogSequenceNumber =
@@ -4782,15 +4779,16 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command)
              (NewPhysicalDeviceInfo->LogicalUnit !=
               PhysicalDeviceInfo->LogicalUnit))
            {
-             PhysicalDeviceInfo = (DAC960_V2_PhysicalDeviceInfo_T *)
+             PhysicalDeviceInfo =
                kmalloc(sizeof(DAC960_V2_PhysicalDeviceInfo_T), GFP_ATOMIC);
              InquiryUnitSerialNumber =
-               (DAC960_SCSI_Inquiry_UnitSerialNumber_T *)
                  kmalloc(sizeof(DAC960_SCSI_Inquiry_UnitSerialNumber_T),
                          GFP_ATOMIC);
-             if (InquiryUnitSerialNumber == NULL &&
-                 PhysicalDeviceInfo != NULL)
+             if (InquiryUnitSerialNumber == NULL ||
+                 PhysicalDeviceInfo == NULL)
                {
+                 kfree(InquiryUnitSerialNumber);
+                 InquiryUnitSerialNumber = NULL;
                  kfree(PhysicalDeviceInfo);
                  PhysicalDeviceInfo = NULL;
                }
@@ -5643,8 +5641,8 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData)
       unsigned int StatusChangeCounter =
        Controller->V2.HealthStatusBuffer->StatusChangeCounter;
       boolean ForceMonitoringCommand = false;
-      if (jiffies - Controller->SecondaryMonitoringTime
-         > DAC960_SecondaryMonitoringInterval)
+      if (time_after(jiffies, Controller->SecondaryMonitoringTime
+         + DAC960_SecondaryMonitoringInterval))
        {
          int LogicalDriveNumber;
          for (LogicalDriveNumber = 0;
@@ -5672,8 +5670,8 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData)
           ControllerInfo->ConsistencyChecksActive +
           ControllerInfo->RebuildsActive +
           ControllerInfo->OnlineExpansionsActive == 0 ||
-          jiffies - Controller->PrimaryMonitoringTime
-          < DAC960_MonitoringTimerInterval) &&
+          time_before(jiffies, Controller->PrimaryMonitoringTime
+          + DAC960_MonitoringTimerInterval)) &&
          !ForceMonitoringCommand)
        {
          Controller->MonitoringTimer.expires =
@@ -5810,8 +5808,8 @@ static void DAC960_Message(DAC960_MessageLevel_T MessageLevel,
       Controller->ProgressBufferLength = Length;
       if (Controller->EphemeralProgressMessage)
        {
-         if (jiffies - Controller->LastProgressReportTime
-             >= DAC960_ProgressReportingInterval)
+         if (time_after_eq(jiffies, Controller->LastProgressReportTime
+             + DAC960_ProgressReportingInterval))
            {
              printk("%sDAC960#%d: %s", DAC960_MessageLevelMap[MessageLevel],
                     Controller->ControllerNumber, Buffer);
@@ -7117,7 +7115,7 @@ static struct pci_device_id DAC960_id_table[] = {
        {
                .vendor         = PCI_VENDOR_ID_MYLEX,
                .device         = PCI_DEVICE_ID_MYLEX_DAC960_GEM,
-               .subvendor      = PCI_ANY_ID,
+               .subvendor      = PCI_VENDOR_ID_MYLEX,
                .subdevice      = PCI_ANY_ID,
                .driver_data    = (unsigned long) &DAC960_GEM_privdata,
        },