vserver 1.9.3
[linux-2.6.git] / drivers / block / DAC960.c
index 29035dd..48c3e63 100644 (file)
@@ -97,7 +97,8 @@ static int DAC960_ioctl(struct inode *inode, struct file *file,
        struct gendisk *disk = inode->i_bdev->bd_disk;
        DAC960_Controller_T *p = disk->queue->queuedata;
        int drive_nr = (long)disk->private_data;
-       struct hd_geometry g, *loc = (struct hd_geometry *)arg;
+       struct hd_geometry g;
+       struct hd_geometry __user *loc = (struct hd_geometry __user *)arg;
 
        if (cmd != HDIO_GETGEO || !loc)
                return -EINVAL;
@@ -287,12 +288,17 @@ static boolean DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
                Controller->PCIDevice,
        DAC960_V2_ScatterGatherLimit * sizeof(DAC960_V2_ScatterGatherSegment_T),
        sizeof(DAC960_V2_ScatterGatherSegment_T), 0);
+      if (ScatterGatherPool == NULL)
+           return DAC960_Failure(Controller,
+                       "AUXILIARY STRUCTURE CREATION (SG)");
       RequestSensePool = pci_pool_create("DAC960_V2_RequestSense",
                Controller->PCIDevice, sizeof(DAC960_SCSI_RequestSense_T),
                sizeof(int), 0);
-      if (ScatterGatherPool == NULL || RequestSensePool == NULL)
+      if (RequestSensePool == NULL) {
+           pci_pool_destroy(ScatterGatherPool);
            return DAC960_Failure(Controller,
                        "AUXILIARY STRUCTURE CREATION (SG)");
+      }
       Controller->ScatterGatherPool = ScatterGatherPool;
       Controller->V2.RequestSensePool = RequestSensePool;
     }
@@ -534,7 +540,7 @@ static void DAC960_WaitForCommand(DAC960_Controller_T *Controller)
 static void DAC960_BA_QueueCommand(DAC960_Command_T *Command)
 {
   DAC960_Controller_T *Controller = Command->Controller;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_V2_CommandMailbox_T *CommandMailbox = &Command->V2.CommandMailbox;
   DAC960_V2_CommandMailbox_T *NextCommandMailbox =
     Controller->V2.NextCommandMailbox;
@@ -559,7 +565,7 @@ static void DAC960_BA_QueueCommand(DAC960_Command_T *Command)
 static void DAC960_LP_QueueCommand(DAC960_Command_T *Command)
 {
   DAC960_Controller_T *Controller = Command->Controller;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_V2_CommandMailbox_T *CommandMailbox = &Command->V2.CommandMailbox;
   DAC960_V2_CommandMailbox_T *NextCommandMailbox =
     Controller->V2.NextCommandMailbox;
@@ -585,7 +591,7 @@ static void DAC960_LP_QueueCommand(DAC960_Command_T *Command)
 static void DAC960_LA_QueueCommandDualMode(DAC960_Command_T *Command)
 {
   DAC960_Controller_T *Controller = Command->Controller;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_V1_CommandMailbox_T *CommandMailbox = &Command->V1.CommandMailbox;
   DAC960_V1_CommandMailbox_T *NextCommandMailbox =
     Controller->V1.NextCommandMailbox;
@@ -611,7 +617,7 @@ static void DAC960_LA_QueueCommandDualMode(DAC960_Command_T *Command)
 static void DAC960_LA_QueueCommandSingleMode(DAC960_Command_T *Command)
 {
   DAC960_Controller_T *Controller = Command->Controller;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_V1_CommandMailbox_T *CommandMailbox = &Command->V1.CommandMailbox;
   DAC960_V1_CommandMailbox_T *NextCommandMailbox =
     Controller->V1.NextCommandMailbox;
@@ -637,7 +643,7 @@ static void DAC960_LA_QueueCommandSingleMode(DAC960_Command_T *Command)
 static void DAC960_PG_QueueCommandDualMode(DAC960_Command_T *Command)
 {
   DAC960_Controller_T *Controller = Command->Controller;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_V1_CommandMailbox_T *CommandMailbox = &Command->V1.CommandMailbox;
   DAC960_V1_CommandMailbox_T *NextCommandMailbox =
     Controller->V1.NextCommandMailbox;
@@ -663,7 +669,7 @@ static void DAC960_PG_QueueCommandDualMode(DAC960_Command_T *Command)
 static void DAC960_PG_QueueCommandSingleMode(DAC960_Command_T *Command)
 {
   DAC960_Controller_T *Controller = Command->Controller;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_V1_CommandMailbox_T *CommandMailbox = &Command->V1.CommandMailbox;
   DAC960_V1_CommandMailbox_T *NextCommandMailbox =
     Controller->V1.NextCommandMailbox;
@@ -688,7 +694,7 @@ static void DAC960_PG_QueueCommandSingleMode(DAC960_Command_T *Command)
 static void DAC960_PD_QueueCommand(DAC960_Command_T *Command)
 {
   DAC960_Controller_T *Controller = Command->Controller;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_V1_CommandMailbox_T *CommandMailbox = &Command->V1.CommandMailbox;
   CommandMailbox->Common.CommandIdentifier = Command->CommandIdentifier;
   while (DAC960_PD_MailboxFullP(ControllerBaseAddress))
@@ -705,7 +711,7 @@ static void DAC960_PD_QueueCommand(DAC960_Command_T *Command)
 static void DAC960_P_QueueCommand(DAC960_Command_T *Command)
 {
   DAC960_Controller_T *Controller = Command->Controller;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_V1_CommandMailbox_T *CommandMailbox = &Command->V1.CommandMailbox;
   CommandMailbox->Common.CommandIdentifier = Command->CommandIdentifier;
   switch (CommandMailbox->Common.CommandOpcode)
@@ -1126,7 +1132,7 @@ static boolean DAC960_V2_DeviceOperation(DAC960_Controller_T *Controller,
 static boolean DAC960_V1_EnableMemoryMailboxInterface(DAC960_Controller_T
                                                      *Controller)
 {
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_HardwareType_T hw_type = Controller->HardwareType;
   struct pci_dev *PCI_Device = Controller->PCIDevice;
   struct dma_loaf *DmaPages = &Controller->DmaPages;
@@ -1332,7 +1338,7 @@ skip_mailboxes:
 static boolean DAC960_V2_EnableMemoryMailboxInterface(DAC960_Controller_T
                                                      *Controller)
 {
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   struct pci_dev *PCI_Device = Controller->PCIDevice;
   struct dma_loaf *DmaPages = &Controller->DmaPages;
   size_t DmaPagesSize;
@@ -2673,7 +2679,7 @@ DAC960_DetectController(struct pci_dev *PCI_Device,
   unsigned char DeviceFunction = PCI_Device->devfn;
   unsigned char ErrorStatus, Parameter0, Parameter1;
   unsigned int IRQ_Channel = PCI_Device->irq;
-  void *BaseAddress;
+  void __iomem *BaseAddress;
   int i;
 
   Controller = (DAC960_Controller_T *)
@@ -5195,7 +5201,7 @@ static irqreturn_t DAC960_BA_InterruptHandler(int IRQ_Channel,
                                       struct pt_regs *InterruptRegisters)
 {
   DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_V2_StatusMailbox_T *NextStatusMailbox;
   unsigned long flags;
 
@@ -5238,7 +5244,7 @@ static irqreturn_t DAC960_LP_InterruptHandler(int IRQ_Channel,
                                       struct pt_regs *InterruptRegisters)
 {
   DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_V2_StatusMailbox_T *NextStatusMailbox;
   unsigned long flags;
 
@@ -5281,7 +5287,7 @@ static irqreturn_t DAC960_LA_InterruptHandler(int IRQ_Channel,
                                       struct pt_regs *InterruptRegisters)
 {
   DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_V1_StatusMailbox_T *NextStatusMailbox;
   unsigned long flags;
 
@@ -5320,7 +5326,7 @@ static irqreturn_t DAC960_PG_InterruptHandler(int IRQ_Channel,
                                       struct pt_regs *InterruptRegisters)
 {
   DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   DAC960_V1_StatusMailbox_T *NextStatusMailbox;
   unsigned long flags;
 
@@ -5359,7 +5365,7 @@ static irqreturn_t DAC960_PD_InterruptHandler(int IRQ_Channel,
                                       struct pt_regs *InterruptRegisters)
 {
   DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   unsigned long flags;
 
   spin_lock_irqsave(&Controller->queue_lock, flags);
@@ -5398,7 +5404,7 @@ static irqreturn_t DAC960_P_InterruptHandler(int IRQ_Channel,
                                      struct pt_regs *InterruptRegisters)
 {
   DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier;
-  void *ControllerBaseAddress = Controller->BaseAddress;
+  void __iomem *ControllerBaseAddress = Controller->BaseAddress;
   unsigned long flags;
 
   spin_lock_irqsave(&Controller->queue_lock, flags);
@@ -6455,7 +6461,8 @@ static int DAC960_ProcReadUserCommand(char *Page, char **Start, off_t Offset,
   DAC960_ProcWriteUserCommand implements writing /proc/rd/cN/user_command.
 */
 
-static int DAC960_ProcWriteUserCommand(struct file *file, const char *Buffer,
+static int DAC960_ProcWriteUserCommand(struct file *file,
+                                      const char __user *Buffer,
                                       unsigned long Count, void *Data)
 {
   DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data;
@@ -6543,8 +6550,8 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file,
       return DAC960_ControllerCount;
     case DAC960_IOCTL_GET_CONTROLLER_INFO:
       {
-       DAC960_ControllerInfo_T *UserSpaceControllerInfo =
-         (DAC960_ControllerInfo_T *) Argument;
+       DAC960_ControllerInfo_T __user *UserSpaceControllerInfo =
+         (DAC960_ControllerInfo_T __user *) Argument;
        DAC960_ControllerInfo_T ControllerInfo;
        DAC960_Controller_T *Controller;
        int ControllerNumber;
@@ -6574,8 +6581,8 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file,
       }
     case DAC960_IOCTL_V1_EXECUTE_COMMAND:
       {
-       DAC960_V1_UserCommand_T *UserSpaceUserCommand =
-         (DAC960_V1_UserCommand_T *) Argument;
+       DAC960_V1_UserCommand_T __user *UserSpaceUserCommand =
+         (DAC960_V1_UserCommand_T __user *) Argument;
        DAC960_V1_UserCommand_T UserCommand;
        DAC960_Controller_T *Controller;
        DAC960_Command_T *Command = NULL;
@@ -6734,8 +6741,8 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file,
       }
     case DAC960_IOCTL_V2_EXECUTE_COMMAND:
       {
-       DAC960_V2_UserCommand_T *UserSpaceUserCommand =
-         (DAC960_V2_UserCommand_T *) Argument;
+       DAC960_V2_UserCommand_T __user *UserSpaceUserCommand =
+         (DAC960_V2_UserCommand_T __user *) Argument;
        DAC960_V2_UserCommand_T UserCommand;
        DAC960_Controller_T *Controller;
        DAC960_Command_T *Command = NULL;
@@ -6888,8 +6895,8 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file,
       }
     case DAC960_IOCTL_V2_GET_HEALTH_STATUS:
       {
-       DAC960_V2_GetHealthStatus_T *UserSpaceGetHealthStatus =
-         (DAC960_V2_GetHealthStatus_T *) Argument;
+       DAC960_V2_GetHealthStatus_T __user *UserSpaceGetHealthStatus =
+         (DAC960_V2_GetHealthStatus_T __user *) Argument;
        DAC960_V2_GetHealthStatus_T GetHealthStatus;
        DAC960_V2_HealthStatusBuffer_T HealthStatusBuffer;
        DAC960_Controller_T *Controller;