X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fblock%2FDAC960.c;h=668dc234b8e22d5b09950950914398d6f1f61766;hb=fed99b1e86f5ff4f1b41e37264bb869da67d3174;hp=179c68a3cef37a37fb2d449e1d9d5139601dbf6d;hpb=a885c8c4316e1c1d2d2c8755da3f3d14f852528d;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 179c68a..668dc23 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c @@ -17,8 +17,8 @@ */ -#define DAC960_DriverVersion "2.5.47" -#define DAC960_DriverDate "14 November 2002" +#define DAC960_DriverVersion "2.5.49" +#define DAC960_DriverDate "21 Aug 2007" #include @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -41,6 +42,9 @@ #include #include #include +#include +#include +#include #include #include #include "DAC960.h" @@ -68,9 +72,9 @@ static long disk_size(DAC960_Controller_T *p, int drive_nr) } } -static int DAC960_open(struct inode *inode, struct file *file) +static int DAC960_open(struct block_device *bdev, fmode_t mode) { - struct gendisk *disk = inode->i_bdev->bd_disk; + struct gendisk *disk = bdev->bd_disk; DAC960_Controller_T *p = disk->queue->queuedata; int drive_nr = (long)disk->private_data; @@ -85,7 +89,7 @@ static int DAC960_open(struct inode *inode, struct file *file) return -ENXIO; } - check_disk_change(inode->i_bdev); + check_disk_change(bdev); if (!get_capacity(p->disks[drive_nr])) return -ENXIO; @@ -175,7 +179,7 @@ static void DAC960_AnnounceDriver(DAC960_Controller_T *Controller) DAC960_Failure prints a standardized error message, and then returns false. */ -static boolean DAC960_Failure(DAC960_Controller_T *Controller, +static bool DAC960_Failure(DAC960_Controller_T *Controller, unsigned char *ErrorMessage) { DAC960_Error("While configuring DAC960 PCI RAID Controller at\n", @@ -204,7 +208,7 @@ static boolean DAC960_Failure(DAC960_Controller_T *Controller, that are passed in. */ -static boolean init_dma_loaf(struct pci_dev *dev, struct dma_loaf *loaf, +static bool init_dma_loaf(struct pci_dev *dev, struct dma_loaf *loaf, size_t len) { void *cpu_addr; @@ -227,8 +231,7 @@ static void *slice_dma_loaf(struct dma_loaf *loaf, size_t len, void *cpu_end = loaf->cpu_free + len; void *cpu_addr = loaf->cpu_free; - if (cpu_end > loaf->cpu_base + loaf->length) - BUG(); + BUG_ON(cpu_end > loaf->cpu_base + loaf->length); *dma_handle = loaf->dma_free; loaf->cpu_free = cpu_end; loaf->dma_free += len; @@ -249,7 +252,7 @@ static void free_dma_loaf(struct pci_dev *dev, struct dma_loaf *loaf_handle) failure. */ -static boolean DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller) +static bool DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller) { int CommandAllocationLength, CommandAllocationGroupSize; int CommandsRemaining = 0, CommandIdentifier, CommandGroupByteCount; @@ -311,11 +314,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; @@ -324,13 +326,13 @@ static boolean DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller) Command->Next = Controller->FreeCommands; Controller->FreeCommands = Command; Controller->Commands[CommandIdentifier-1] = Command; - ScatterGatherCPU = pci_pool_alloc(ScatterGatherPool, SLAB_ATOMIC, + ScatterGatherCPU = pci_pool_alloc(ScatterGatherPool, GFP_ATOMIC, &ScatterGatherDMA); if (ScatterGatherCPU == NULL) return DAC960_Failure(Controller, "AUXILIARY STRUCTURE CREATION"); if (RequestSensePool != NULL) { - RequestSenseCPU = pci_pool_alloc(RequestSensePool, SLAB_ATOMIC, + RequestSenseCPU = pci_pool_alloc(RequestSensePool, GFP_ATOMIC, &RequestSenseDMA); if (RequestSenseCPU == NULL) { pci_pool_free(ScatterGatherPool, ScatterGatherCPU, @@ -344,6 +346,7 @@ static boolean DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller) Command->V1.ScatterGatherList = (DAC960_V1_ScatterGatherSegment_T *)ScatterGatherCPU; Command->V1.ScatterGatherListDMA = ScatterGatherDMA; + sg_init_table(Command->cmd_sglist, DAC960_V1_ScatterGatherLimit); } else { Command->cmd_sglist = Command->V2.ScatterList; Command->V2.ScatterGatherList = @@ -352,6 +355,7 @@ static boolean DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller) Command->V2.RequestSense = (DAC960_SCSI_RequestSense_T *)RequestSenseCPU; Command->V2.RequestSenseDMA = RequestSenseDMA; + sg_init_table(Command->cmd_sglist, DAC960_V2_ScatterGatherLimit); } } return true; @@ -770,7 +774,7 @@ static void DAC960_P_QueueCommand(DAC960_Command_T *Command) static void DAC960_ExecuteCommand(DAC960_Command_T *Command) { DAC960_Controller_T *Controller = Command->Controller; - DECLARE_COMPLETION(Completion); + DECLARE_COMPLETION_ONSTACK(Completion); unsigned long flags; Command->Completion = &Completion; @@ -790,7 +794,7 @@ static void DAC960_ExecuteCommand(DAC960_Command_T *Command) on failure. */ -static boolean DAC960_V1_ExecuteType3(DAC960_Controller_T *Controller, +static bool DAC960_V1_ExecuteType3(DAC960_Controller_T *Controller, DAC960_V1_CommandOpcode_T CommandOpcode, dma_addr_t DataDMA) { @@ -814,7 +818,7 @@ static boolean DAC960_V1_ExecuteType3(DAC960_Controller_T *Controller, on failure. */ -static boolean DAC960_V1_ExecuteType3B(DAC960_Controller_T *Controller, +static bool DAC960_V1_ExecuteType3B(DAC960_Controller_T *Controller, DAC960_V1_CommandOpcode_T CommandOpcode, unsigned char CommandOpcode2, dma_addr_t DataDMA) @@ -840,7 +844,7 @@ static boolean DAC960_V1_ExecuteType3B(DAC960_Controller_T *Controller, on failure. */ -static boolean DAC960_V1_ExecuteType3D(DAC960_Controller_T *Controller, +static bool DAC960_V1_ExecuteType3D(DAC960_Controller_T *Controller, DAC960_V1_CommandOpcode_T CommandOpcode, unsigned char Channel, unsigned char TargetID, @@ -870,7 +874,7 @@ static boolean DAC960_V1_ExecuteType3D(DAC960_Controller_T *Controller, Return data in The controller's HealthStatusBuffer, which is dma-able memory */ -static boolean DAC960_V2_GeneralInfo(DAC960_Controller_T *Controller) +static bool DAC960_V2_GeneralInfo(DAC960_Controller_T *Controller) { DAC960_Command_T *Command = DAC960_AllocateCommand(Controller); DAC960_V2_CommandMailbox_T *CommandMailbox = &Command->V2.CommandMailbox; @@ -908,7 +912,7 @@ static boolean DAC960_V2_GeneralInfo(DAC960_Controller_T *Controller) memory buffer. */ -static boolean DAC960_V2_NewControllerInfo(DAC960_Controller_T *Controller) +static bool DAC960_V2_NewControllerInfo(DAC960_Controller_T *Controller) { DAC960_Command_T *Command = DAC960_AllocateCommand(Controller); DAC960_V2_CommandMailbox_T *CommandMailbox = &Command->V2.CommandMailbox; @@ -946,7 +950,7 @@ static boolean DAC960_V2_NewControllerInfo(DAC960_Controller_T *Controller) Data is returned in the controller's V2.NewLogicalDeviceInformation */ -static boolean DAC960_V2_NewLogicalDeviceInfo(DAC960_Controller_T *Controller, +static bool DAC960_V2_NewLogicalDeviceInfo(DAC960_Controller_T *Controller, unsigned short LogicalDeviceNumber) { DAC960_Command_T *Command = DAC960_AllocateCommand(Controller); @@ -997,7 +1001,7 @@ static boolean DAC960_V2_NewLogicalDeviceInfo(DAC960_Controller_T *Controller, */ -static boolean DAC960_V2_NewPhysicalDeviceInfo(DAC960_Controller_T *Controller, +static bool DAC960_V2_NewPhysicalDeviceInfo(DAC960_Controller_T *Controller, unsigned char Channel, unsigned char TargetID, unsigned char LogicalUnit) @@ -1082,7 +1086,7 @@ static void DAC960_V2_ConstructNewUnitSerialNumber( memory buffer. */ -static boolean DAC960_V2_NewInquiryUnitSerialNumber(DAC960_Controller_T *Controller, +static bool DAC960_V2_NewInquiryUnitSerialNumber(DAC960_Controller_T *Controller, int Channel, int TargetID, int LogicalUnit) { DAC960_Command_T *Command; @@ -1110,7 +1114,7 @@ static boolean DAC960_V2_NewInquiryUnitSerialNumber(DAC960_Controller_T *Control success and false on failure. */ -static boolean DAC960_V2_DeviceOperation(DAC960_Controller_T *Controller, +static bool DAC960_V2_DeviceOperation(DAC960_Controller_T *Controller, DAC960_V2_IOCTL_Opcode_T IOCTL_Opcode, DAC960_V2_OperationDevice_T OperationDevice) @@ -1142,7 +1146,7 @@ static boolean DAC960_V2_DeviceOperation(DAC960_Controller_T *Controller, other dma mapped memory. */ -static boolean DAC960_V1_EnableMemoryMailboxInterface(DAC960_Controller_T +static bool DAC960_V1_EnableMemoryMailboxInterface(DAC960_Controller_T *Controller) { void __iomem *ControllerBaseAddress = Controller->BaseAddress; @@ -1165,9 +1169,9 @@ static boolean DAC960_V1_EnableMemoryMailboxInterface(DAC960_Controller_T int i; - if (pci_set_dma_mask(Controller->PCIDevice, DAC690_V1_PciDmaMask)) + if (pci_set_dma_mask(Controller->PCIDevice, DMA_BIT_MASK(32))) return DAC960_Failure(Controller, "DMA mask out of range"); - Controller->BounceBufferLimit = DAC690_V1_PciDmaMask; + Controller->BounceBufferLimit = DMA_BIT_MASK(32); if ((hw_type == DAC960_PD_Controller) || (hw_type == DAC960_P_Controller)) { CommandMailboxesSize = 0; @@ -1348,7 +1352,7 @@ skip_mailboxes: the structures that are contained in that region. */ -static boolean DAC960_V2_EnableMemoryMailboxInterface(DAC960_Controller_T +static bool DAC960_V2_EnableMemoryMailboxInterface(DAC960_Controller_T *Controller) { void __iomem *ControllerBaseAddress = Controller->BaseAddress; @@ -1368,13 +1372,15 @@ static boolean DAC960_V2_EnableMemoryMailboxInterface(DAC960_Controller_T dma_addr_t CommandMailboxDMA; DAC960_V2_CommandStatus_T CommandStatus; - if (pci_set_dma_mask(Controller->PCIDevice, DAC690_V2_PciDmaMask)) - return DAC960_Failure(Controller, "DMA mask out of range"); - Controller->BounceBufferLimit = DAC690_V2_PciDmaMask; + if (!pci_set_dma_mask(Controller->PCIDevice, DMA_BIT_MASK(64))) + Controller->BounceBufferLimit = DMA_BIT_MASK(64); + else if (!pci_set_dma_mask(Controller->PCIDevice, DMA_BIT_MASK(32))) + Controller->BounceBufferLimit = DMA_BIT_MASK(32); + else + return DAC960_Failure(Controller, "DMA mask out of range"); /* This is a temporary dma mapping, used only in the scope of this function */ - CommandMailbox = - (DAC960_V2_CommandMailbox_T *)pci_alloc_consistent( PCI_Device, + CommandMailbox = pci_alloc_consistent(PCI_Device, sizeof(DAC960_V2_CommandMailbox_T), &CommandMailboxDMA); if (CommandMailbox == NULL) return false; @@ -1526,7 +1532,7 @@ static boolean DAC960_V2_EnableMemoryMailboxInterface(DAC960_Controller_T from DAC960 V1 Firmware Controllers and initializes the Controller structure. */ -static boolean DAC960_V1_ReadControllerConfiguration(DAC960_Controller_T +static bool DAC960_V1_ReadControllerConfiguration(DAC960_Controller_T *Controller) { DAC960_V1_Enquiry2_T *Enquiry2; @@ -1767,7 +1773,7 @@ static boolean DAC960_V1_ReadControllerConfiguration(DAC960_Controller_T from DAC960 V2 Firmware Controllers and initializes the Controller structure. */ -static boolean DAC960_V2_ReadControllerConfiguration(DAC960_Controller_T +static bool DAC960_V2_ReadControllerConfiguration(DAC960_Controller_T *Controller) { DAC960_V2_ControllerInfo_T *ControllerInfo = @@ -1879,8 +1885,8 @@ static boolean DAC960_V2_ReadControllerConfiguration(DAC960_Controller_T if (NewLogicalDeviceInfo->LogicalDeviceState != DAC960_V2_LogicalDevice_Offline) Controller->LogicalDriveInitiallyAccessible[LogicalDeviceNumber] = true; - LogicalDeviceInfo = (DAC960_V2_LogicalDeviceInfo_T *) - kmalloc(sizeof(DAC960_V2_LogicalDeviceInfo_T), GFP_ATOMIC); + LogicalDeviceInfo = kmalloc(sizeof(DAC960_V2_LogicalDeviceInfo_T), + GFP_ATOMIC); if (LogicalDeviceInfo == NULL) return DAC960_Failure(Controller, "LOGICAL DEVICE ALLOCATION"); Controller->V2.LogicalDeviceInformation[LogicalDeviceNumber] = @@ -1898,7 +1904,7 @@ static boolean DAC960_V2_ReadControllerConfiguration(DAC960_Controller_T for Controller. */ -static boolean DAC960_ReportControllerConfiguration(DAC960_Controller_T +static bool DAC960_ReportControllerConfiguration(DAC960_Controller_T *Controller) { DAC960_Info("Configuring Mylex %s PCI RAID Controller\n", @@ -1947,7 +1953,7 @@ static boolean DAC960_ReportControllerConfiguration(DAC960_Controller_T Controller. */ -static boolean DAC960_V1_ReadDeviceConfiguration(DAC960_Controller_T +static bool DAC960_V1_ReadDeviceConfiguration(DAC960_Controller_T *Controller) { struct dma_loaf local_dma; @@ -2095,7 +2101,7 @@ static boolean DAC960_V1_ReadDeviceConfiguration(DAC960_Controller_T device connected to Controller. */ -static boolean DAC960_V2_ReadDeviceConfiguration(DAC960_Controller_T +static bool DAC960_V2_ReadDeviceConfiguration(DAC960_Controller_T *Controller) { unsigned char Channel = 0, TargetID = 0, LogicalUnit = 0; @@ -2113,8 +2119,8 @@ static boolean DAC960_V2_ReadDeviceConfiguration(DAC960_Controller_T if (!DAC960_V2_NewPhysicalDeviceInfo(Controller, Channel, TargetID, LogicalUnit)) break; - PhysicalDeviceInfo = (DAC960_V2_PhysicalDeviceInfo_T *) - kmalloc(sizeof(DAC960_V2_PhysicalDeviceInfo_T), GFP_ATOMIC); + PhysicalDeviceInfo = kmalloc(sizeof(DAC960_V2_PhysicalDeviceInfo_T), + GFP_ATOMIC); if (PhysicalDeviceInfo == NULL) return DAC960_Failure(Controller, "PHYSICAL DEVICE ALLOCATION"); Controller->V2.PhysicalDeviceInformation[PhysicalDeviceIndex] = @@ -2122,8 +2128,8 @@ static boolean DAC960_V2_ReadDeviceConfiguration(DAC960_Controller_T memcpy(PhysicalDeviceInfo, NewPhysicalDeviceInfo, sizeof(DAC960_V2_PhysicalDeviceInfo_T)); - InquiryUnitSerialNumber = (DAC960_SCSI_Inquiry_UnitSerialNumber_T *) - kmalloc(sizeof(DAC960_SCSI_Inquiry_UnitSerialNumber_T), GFP_ATOMIC); + InquiryUnitSerialNumber = kmalloc( + sizeof(DAC960_SCSI_Inquiry_UnitSerialNumber_T), GFP_ATOMIC); if (InquiryUnitSerialNumber == NULL) { kfree(PhysicalDeviceInfo); return DAC960_Failure(Controller, "SERIAL NUMBER ALLOCATION"); @@ -2219,7 +2225,7 @@ static void DAC960_SanitizeInquiryData(DAC960_SCSI_Inquiry_T Information for DAC960 V1 Firmware Controllers. */ -static boolean DAC960_V1_ReportDeviceConfiguration(DAC960_Controller_T +static bool DAC960_V1_ReportDeviceConfiguration(DAC960_Controller_T *Controller) { int LogicalDriveNumber, Channel, TargetID; @@ -2316,7 +2322,7 @@ static boolean DAC960_V1_ReportDeviceConfiguration(DAC960_Controller_T Information for DAC960 V2 Firmware Controllers. */ -static boolean DAC960_V2_ReportDeviceConfiguration(DAC960_Controller_T +static bool DAC960_V2_ReportDeviceConfiguration(DAC960_Controller_T *Controller) { int PhysicalDeviceIndex, LogicalDriveNumber; @@ -2501,7 +2507,7 @@ static boolean DAC960_V2_ReportDeviceConfiguration(DAC960_Controller_T associated with Controller. */ -static boolean DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller) +static bool DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller) { int MajorNumber = DAC960_MAJOR + Controller->ControllerNumber; int n; @@ -2530,7 +2536,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; @@ -2583,7 +2588,7 @@ static void DAC960_ComputeGenericDiskInfo(DAC960_Controller_T *Controller) It returns true for fatal errors and false otherwise. */ -static boolean DAC960_ReportErrorStatus(DAC960_Controller_T *Controller, +static bool DAC960_ReportErrorStatus(DAC960_Controller_T *Controller, unsigned char ErrorStatus, unsigned char Parameter0, unsigned char Parameter1) @@ -2699,8 +2704,7 @@ DAC960_DetectController(struct pci_dev *PCI_Device, { struct DAC960_privdata *privdata = (struct DAC960_privdata *)entry->driver_data; - irqreturn_t (*InterruptHandler)(int, void *, struct pt_regs *) = - privdata->InterruptHandler; + irq_handler_t InterruptHandler = privdata->InterruptHandler; unsigned int MemoryWindowSize = privdata->MemoryWindowSize; DAC960_Controller_T *Controller = NULL; unsigned char DeviceFunction = PCI_Device->devfn; @@ -2709,14 +2713,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 +3019,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", @@ -3052,7 +3054,7 @@ Failure: DAC960_InitializeController initializes Controller. */ -static boolean +static bool DAC960_InitializeController(DAC960_Controller_T *Controller) { if (DAC960_ReadControllerConfiguration(Controller) && @@ -3319,7 +3321,7 @@ static int DAC960_process_queue(DAC960_Controller_T *Controller, struct request_ DAC960_Command_T *Command; while(1) { - Request = elv_next_request(req_q); + Request = blk_peek_request(req_q); if (!Request) return 1; @@ -3334,12 +3336,12 @@ 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; + Command->BlockNumber = blk_rq_pos(Request); + Command->BlockCount = blk_rq_sectors(Request); Command->Request = Request; - blkdev_dequeue_request(Request); + blk_start_request(Request); Command->SegmentCount = blk_rq_map_sg(req_q, Command->Request, Command->cmd_sglist); /* pci_map_sg MAY change the value of SegCount */ @@ -3429,7 +3431,7 @@ static void DAC960_queue_partial_rw(DAC960_Command_T *Command) * successfully as possible. */ Command->SegmentCount = 1; - Command->BlockNumber = Request->sector; + Command->BlockNumber = blk_rq_pos(Request); Command->BlockCount = 1; DAC960_QueueReadWriteCommand(Command); return; @@ -3449,23 +3451,16 @@ static void DAC960_RequestFunction(struct request_queue *RequestQueue) individual Buffer. */ -static inline boolean DAC960_ProcessCompletedRequest(DAC960_Command_T *Command, - boolean SuccessfulIO) +static inline bool DAC960_ProcessCompletedRequest(DAC960_Command_T *Command, + bool SuccessfulIO) { struct request *Request = Command->Request; - int UpToDate; - - UpToDate = 0; - if (SuccessfulIO) - UpToDate = 1; + int Error = SuccessfulIO ? 0 : -EIO; pci_unmap_sg(Command->Controller->PCIDevice, Command->cmd_sglist, Command->SegmentCount, Command->DmaDirection); - if (!end_that_request_first(Request, UpToDate, Command->BlockCount)) { - - end_that_request_last(Request, UpToDate); - + if (!__blk_end_request(Request, Error, Command->BlockCount << 9)) { if (Command->Completion) { complete(Command->Completion); Command->Completion = NULL; @@ -3576,7 +3571,7 @@ static void DAC960_V1_ProcessCompletedCommand(DAC960_Command_T *Command) else if (CommandType == DAC960_ReadRetryCommand || CommandType == DAC960_WriteRetryCommand) { - boolean normal_completion; + bool normal_completion; #ifdef FORCE_RETRY_FAILURE_DEBUG static int retry_count = 1; #endif @@ -3657,8 +3652,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 = @@ -3760,7 +3755,7 @@ static void DAC960_V1_ProcessCompletedCommand(DAC960_Command_T *Command) if (SenseKey == DAC960_SenseKey_VendorSpecific && AdditionalSenseCode == 0x80 && AdditionalSenseCodeQualifier < - sizeof(DAC960_EventMessages) / sizeof(char *)) + ARRAY_SIZE(DAC960_EventMessages)) DAC960_Critical("Physical Device %d:%d %s\n", Controller, EventLogEntry->Channel, EventLogEntry->TargetID, @@ -4663,7 +4658,7 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command) else if (CommandType == DAC960_ReadRetryCommand || CommandType == DAC960_WriteRetryCommand) { - boolean normal_completion; + bool normal_completion; #ifdef FORCE_RETRY_FAILURE_DEBUG static int retry_count = 1; @@ -4782,15 +4777,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; } @@ -4952,8 +4948,8 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command) PhysicalDevice.LogicalUnit = NewLogicalDeviceInfo->LogicalUnit; Controller->V2.LogicalDriveToVirtualDevice[LogicalDeviceNumber] = PhysicalDevice; - LogicalDeviceInfo = (DAC960_V2_LogicalDeviceInfo_T *) - kmalloc(sizeof(DAC960_V2_LogicalDeviceInfo_T), GFP_ATOMIC); + LogicalDeviceInfo = kmalloc(sizeof(DAC960_V2_LogicalDeviceInfo_T), + GFP_ATOMIC); Controller->V2.LogicalDeviceInformation[LogicalDeviceNumber] = LogicalDeviceInfo; DAC960_Critical("Logical Drive %d (/dev/rd/c%dd%d) " @@ -5255,10 +5251,9 @@ static void DAC960_V2_ProcessCompletedCommand(DAC960_Command_T *Command) */ static irqreturn_t DAC960_GEM_InterruptHandler(int IRQ_Channel, - void *DeviceIdentifier, - struct pt_regs *InterruptRegisters) + void *DeviceIdentifier) { - DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; + DAC960_Controller_T *Controller = DeviceIdentifier; void __iomem *ControllerBaseAddress = Controller->BaseAddress; DAC960_V2_StatusMailbox_T *NextStatusMailbox; unsigned long flags; @@ -5297,10 +5292,9 @@ static irqreturn_t DAC960_GEM_InterruptHandler(int IRQ_Channel, */ static irqreturn_t DAC960_BA_InterruptHandler(int IRQ_Channel, - void *DeviceIdentifier, - struct pt_regs *InterruptRegisters) + void *DeviceIdentifier) { - DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; + DAC960_Controller_T *Controller = DeviceIdentifier; void __iomem *ControllerBaseAddress = Controller->BaseAddress; DAC960_V2_StatusMailbox_T *NextStatusMailbox; unsigned long flags; @@ -5340,10 +5334,9 @@ static irqreturn_t DAC960_BA_InterruptHandler(int IRQ_Channel, */ static irqreturn_t DAC960_LP_InterruptHandler(int IRQ_Channel, - void *DeviceIdentifier, - struct pt_regs *InterruptRegisters) + void *DeviceIdentifier) { - DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; + DAC960_Controller_T *Controller = DeviceIdentifier; void __iomem *ControllerBaseAddress = Controller->BaseAddress; DAC960_V2_StatusMailbox_T *NextStatusMailbox; unsigned long flags; @@ -5383,10 +5376,9 @@ static irqreturn_t DAC960_LP_InterruptHandler(int IRQ_Channel, */ static irqreturn_t DAC960_LA_InterruptHandler(int IRQ_Channel, - void *DeviceIdentifier, - struct pt_regs *InterruptRegisters) + void *DeviceIdentifier) { - DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; + DAC960_Controller_T *Controller = DeviceIdentifier; void __iomem *ControllerBaseAddress = Controller->BaseAddress; DAC960_V1_StatusMailbox_T *NextStatusMailbox; unsigned long flags; @@ -5422,10 +5414,9 @@ static irqreturn_t DAC960_LA_InterruptHandler(int IRQ_Channel, */ static irqreturn_t DAC960_PG_InterruptHandler(int IRQ_Channel, - void *DeviceIdentifier, - struct pt_regs *InterruptRegisters) + void *DeviceIdentifier) { - DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; + DAC960_Controller_T *Controller = DeviceIdentifier; void __iomem *ControllerBaseAddress = Controller->BaseAddress; DAC960_V1_StatusMailbox_T *NextStatusMailbox; unsigned long flags; @@ -5461,10 +5452,9 @@ static irqreturn_t DAC960_PG_InterruptHandler(int IRQ_Channel, */ static irqreturn_t DAC960_PD_InterruptHandler(int IRQ_Channel, - void *DeviceIdentifier, - struct pt_regs *InterruptRegisters) + void *DeviceIdentifier) { - DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; + DAC960_Controller_T *Controller = DeviceIdentifier; void __iomem *ControllerBaseAddress = Controller->BaseAddress; unsigned long flags; @@ -5500,10 +5490,9 @@ static irqreturn_t DAC960_PD_InterruptHandler(int IRQ_Channel, */ static irqreturn_t DAC960_P_InterruptHandler(int IRQ_Channel, - void *DeviceIdentifier, - struct pt_regs *InterruptRegisters) + void *DeviceIdentifier) { - DAC960_Controller_T *Controller = (DAC960_Controller_T *) DeviceIdentifier; + DAC960_Controller_T *Controller = DeviceIdentifier; void __iomem *ControllerBaseAddress = Controller->BaseAddress; unsigned long flags; @@ -5642,9 +5631,9 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData) &Controller->V2.ControllerInformation; unsigned int StatusChangeCounter = Controller->V2.HealthStatusBuffer->StatusChangeCounter; - boolean ForceMonitoringCommand = false; - if (jiffies - Controller->SecondaryMonitoringTime - > DAC960_SecondaryMonitoringInterval) + bool ForceMonitoringCommand = false; + if (time_after(jiffies, Controller->SecondaryMonitoringTime + + DAC960_SecondaryMonitoringInterval)) { int LogicalDriveNumber; for (LogicalDriveNumber = 0; @@ -5672,8 +5661,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 = @@ -5706,7 +5695,7 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData) necessary. It returns true if there is enough room and false otherwise. */ -static boolean DAC960_CheckStatusBuffer(DAC960_Controller_T *Controller, +static bool DAC960_CheckStatusBuffer(DAC960_Controller_T *Controller, unsigned int ByteCount) { unsigned char *NewStatusBuffer; @@ -5719,14 +5708,14 @@ static boolean DAC960_CheckStatusBuffer(DAC960_Controller_T *Controller, unsigned int NewStatusBufferLength = DAC960_InitialStatusBufferSize; while (NewStatusBufferLength < ByteCount) NewStatusBufferLength *= 2; - Controller->CombinedStatusBuffer = - (unsigned char *) kmalloc(NewStatusBufferLength, GFP_ATOMIC); + Controller->CombinedStatusBuffer = kmalloc(NewStatusBufferLength, + GFP_ATOMIC); if (Controller->CombinedStatusBuffer == NULL) return false; Controller->CombinedStatusBufferLength = NewStatusBufferLength; return true; } - NewStatusBuffer = (unsigned char *) - kmalloc(2 * Controller->CombinedStatusBufferLength, GFP_ATOMIC); + NewStatusBuffer = kmalloc(2 * Controller->CombinedStatusBufferLength, + GFP_ATOMIC); if (NewStatusBuffer == NULL) { DAC960_Warning("Unable to expand Combined Status Buffer - Truncating\n", @@ -5754,7 +5743,7 @@ static void DAC960_Message(DAC960_MessageLevel_T MessageLevel, ...) { static unsigned char Buffer[DAC960_LineBufferSize]; - static boolean BeginningOfLine = true; + static bool BeginningOfLine = true; va_list Arguments; int Length = 0; va_start(Arguments, Controller); @@ -5810,8 +5799,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); @@ -5847,7 +5836,7 @@ static void DAC960_Message(DAC960_MessageLevel_T MessageLevel, Channel and TargetID and returns true on success and false on failure. */ -static boolean DAC960_ParsePhysicalDevice(DAC960_Controller_T *Controller, +static bool DAC960_ParsePhysicalDevice(DAC960_Controller_T *Controller, char *UserCommandString, unsigned char *Channel, unsigned char *TargetID) @@ -5880,7 +5869,7 @@ static boolean DAC960_ParsePhysicalDevice(DAC960_Controller_T *Controller, returns true on success and false on failure. */ -static boolean DAC960_ParseLogicalDrive(DAC960_Controller_T *Controller, +static bool DAC960_ParseLogicalDrive(DAC960_Controller_T *Controller, char *UserCommandString, unsigned char *LogicalDriveNumber) { @@ -5961,7 +5950,7 @@ static void DAC960_V1_SetDeviceState(DAC960_Controller_T *Controller, Controllers. */ -static boolean DAC960_V1_ExecuteUserCommand(DAC960_Controller_T *Controller, +static bool DAC960_V1_ExecuteUserCommand(DAC960_Controller_T *Controller, unsigned char *UserCommand) { DAC960_Command_T *Command; @@ -6176,7 +6165,7 @@ failure: on failure. */ -static boolean DAC960_V2_TranslatePhysicalDevice(DAC960_Command_T *Command, +static bool DAC960_V2_TranslatePhysicalDevice(DAC960_Command_T *Command, unsigned char Channel, unsigned char TargetID, unsigned short @@ -6223,7 +6212,7 @@ static boolean DAC960_V2_TranslatePhysicalDevice(DAC960_Command_T *Command, Controllers. */ -static boolean DAC960_V2_ExecuteUserCommand(DAC960_Controller_T *Controller, +static bool DAC960_V2_ExecuteUserCommand(DAC960_Controller_T *Controller, unsigned char *UserCommand) { DAC960_Command_T *Command; @@ -6639,15 +6628,18 @@ static void DAC960_DestroyProcEntries(DAC960_Controller_T *Controller) * DAC960_gam_ioctl is the ioctl function for performing RAID operations. */ -static int DAC960_gam_ioctl(struct inode *inode, struct file *file, - unsigned int Request, unsigned long Argument) +static long DAC960_gam_ioctl(struct file *file, unsigned int Request, + unsigned long Argument) { - int ErrorCode = 0; + long ErrorCode = 0; if (!capable(CAP_SYS_ADMIN)) return -EACCES; + + lock_kernel(); switch (Request) { case DAC960_IOCTL_GET_CONTROLLER_COUNT: - return DAC960_ControllerCount; + ErrorCode = DAC960_ControllerCount; + break; case DAC960_IOCTL_GET_CONTROLLER_INFO: { DAC960_ControllerInfo_T __user *UserSpaceControllerInfo = @@ -6655,15 +6647,20 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, DAC960_ControllerInfo_T ControllerInfo; DAC960_Controller_T *Controller; int ControllerNumber; - if (UserSpaceControllerInfo == NULL) return -EINVAL; - ErrorCode = get_user(ControllerNumber, + if (UserSpaceControllerInfo == NULL) + ErrorCode = -EINVAL; + else ErrorCode = get_user(ControllerNumber, &UserSpaceControllerInfo->ControllerNumber); - if (ErrorCode != 0) return ErrorCode; + if (ErrorCode != 0) + break;; + ErrorCode = -ENXIO; if (ControllerNumber < 0 || - ControllerNumber > DAC960_ControllerCount - 1) - return -ENXIO; + ControllerNumber > DAC960_ControllerCount - 1) { + break; + } Controller = DAC960_Controllers[ControllerNumber]; - if (Controller == NULL) return -ENXIO; + if (Controller == NULL) + break;; memset(&ControllerInfo, 0, sizeof(DAC960_ControllerInfo_T)); ControllerInfo.ControllerNumber = ControllerNumber; ControllerInfo.FirmwareType = Controller->FirmwareType; @@ -6676,8 +6673,9 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, ControllerInfo.PCI_Address = Controller->PCI_Address; strcpy(ControllerInfo.ModelName, Controller->ModelName); strcpy(ControllerInfo.FirmwareVersion, Controller->FirmwareVersion); - return (copy_to_user(UserSpaceControllerInfo, &ControllerInfo, + ErrorCode = (copy_to_user(UserSpaceControllerInfo, &ControllerInfo, sizeof(DAC960_ControllerInfo_T)) ? -EFAULT : 0); + break; } case DAC960_IOCTL_V1_EXECUTE_COMMAND: { @@ -6695,30 +6693,39 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, int ControllerNumber, DataTransferLength; unsigned char *DataTransferBuffer = NULL; dma_addr_t DataTransferBufferDMA; - if (UserSpaceUserCommand == NULL) return -EINVAL; + if (UserSpaceUserCommand == NULL) { + ErrorCode = -EINVAL; + break; + } if (copy_from_user(&UserCommand, UserSpaceUserCommand, sizeof(DAC960_V1_UserCommand_T))) { ErrorCode = -EFAULT; - goto Failure1a; + break; } ControllerNumber = UserCommand.ControllerNumber; + ErrorCode = -ENXIO; if (ControllerNumber < 0 || ControllerNumber > DAC960_ControllerCount - 1) - return -ENXIO; + break; Controller = DAC960_Controllers[ControllerNumber]; - if (Controller == NULL) return -ENXIO; - if (Controller->FirmwareType != DAC960_V1_Controller) return -EINVAL; + if (Controller == NULL) + break; + ErrorCode = -EINVAL; + if (Controller->FirmwareType != DAC960_V1_Controller) + break; CommandOpcode = UserCommand.CommandMailbox.Common.CommandOpcode; DataTransferLength = UserCommand.DataTransferLength; - if (CommandOpcode & 0x80) return -EINVAL; + if (CommandOpcode & 0x80) + break; if (CommandOpcode == DAC960_V1_DCDB) { if (copy_from_user(&DCDB, UserCommand.DCDB, sizeof(DAC960_V1_DCDB_T))) { ErrorCode = -EFAULT; - goto Failure1a; + break; } - if (DCDB.Channel >= DAC960_V1_MaxChannels) return -EINVAL; + if (DCDB.Channel >= DAC960_V1_MaxChannels) + break; if (!((DataTransferLength == 0 && DCDB.Direction == DAC960_V1_DCDB_NoDataTransfer) || @@ -6728,38 +6735,37 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, (DataTransferLength < 0 && DCDB.Direction == DAC960_V1_DCDB_DataTransferSystemToDevice))) - return -EINVAL; + break; if (((DCDB.TransferLengthHigh4 << 16) | DCDB.TransferLength) != abs(DataTransferLength)) - return -EINVAL; + break; DCDB_IOBUF = pci_alloc_consistent(Controller->PCIDevice, sizeof(DAC960_V1_DCDB_T), &DCDB_IOBUFDMA); - if (DCDB_IOBUF == NULL) - return -ENOMEM; + if (DCDB_IOBUF == NULL) { + ErrorCode = -ENOMEM; + break; + } } + ErrorCode = -ENOMEM; if (DataTransferLength > 0) { DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice, DataTransferLength, &DataTransferBufferDMA); - if (DataTransferBuffer == NULL) { - ErrorCode = -ENOMEM; - goto Failure1; - } + if (DataTransferBuffer == NULL) + break; memset(DataTransferBuffer, 0, DataTransferLength); } else if (DataTransferLength < 0) { DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice, -DataTransferLength, &DataTransferBufferDMA); - if (DataTransferBuffer == NULL) { - ErrorCode = -ENOMEM; - goto Failure1; - } + if (DataTransferBuffer == NULL) + break; if (copy_from_user(DataTransferBuffer, UserCommand.DataTransferBuffer, -DataTransferLength)) { ErrorCode = -EFAULT; - goto Failure1; + break; } } if (CommandOpcode == DAC960_V1_DCDB) @@ -6836,8 +6842,7 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, if (DCDB_IOBUF != NULL) pci_free_consistent(Controller->PCIDevice, sizeof(DAC960_V1_DCDB_T), DCDB_IOBUF, DCDB_IOBUFDMA); - Failure1a: - return ErrorCode; + break; } case DAC960_IOCTL_V2_EXECUTE_COMMAND: { @@ -6855,32 +6860,43 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, dma_addr_t DataTransferBufferDMA; unsigned char *RequestSenseBuffer = NULL; dma_addr_t RequestSenseBufferDMA; - if (UserSpaceUserCommand == NULL) return -EINVAL; + + ErrorCode = -EINVAL; + if (UserSpaceUserCommand == NULL) + break; if (copy_from_user(&UserCommand, UserSpaceUserCommand, sizeof(DAC960_V2_UserCommand_T))) { ErrorCode = -EFAULT; - goto Failure2a; + break; } + ErrorCode = -ENXIO; ControllerNumber = UserCommand.ControllerNumber; if (ControllerNumber < 0 || ControllerNumber > DAC960_ControllerCount - 1) - return -ENXIO; + break; Controller = DAC960_Controllers[ControllerNumber]; - if (Controller == NULL) return -ENXIO; - if (Controller->FirmwareType != DAC960_V2_Controller) return -EINVAL; + if (Controller == NULL) + break; + if (Controller->FirmwareType != DAC960_V2_Controller){ + ErrorCode = -EINVAL; + break; + } DataTransferLength = UserCommand.DataTransferLength; + ErrorCode = -ENOMEM; if (DataTransferLength > 0) { DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice, DataTransferLength, &DataTransferBufferDMA); - if (DataTransferBuffer == NULL) return -ENOMEM; + if (DataTransferBuffer == NULL) + break; memset(DataTransferBuffer, 0, DataTransferLength); } else if (DataTransferLength < 0) { DataTransferBuffer = pci_alloc_consistent(Controller->PCIDevice, -DataTransferLength, &DataTransferBufferDMA); - if (DataTransferBuffer == NULL) return -ENOMEM; + if (DataTransferBuffer == NULL) + break; if (copy_from_user(DataTransferBuffer, UserCommand.DataTransferBuffer, -DataTransferLength)) { @@ -6990,8 +7006,7 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, if (RequestSenseBuffer != NULL) pci_free_consistent(Controller->PCIDevice, RequestSenseLength, RequestSenseBuffer, RequestSenseBufferDMA); - Failure2a: - return ErrorCode; + break; } case DAC960_IOCTL_V2_GET_HEALTH_STATUS: { @@ -7001,21 +7016,33 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, DAC960_V2_HealthStatusBuffer_T HealthStatusBuffer; DAC960_Controller_T *Controller; int ControllerNumber; - if (UserSpaceGetHealthStatus == NULL) return -EINVAL; + if (UserSpaceGetHealthStatus == NULL) { + ErrorCode = -EINVAL; + break; + } if (copy_from_user(&GetHealthStatus, UserSpaceGetHealthStatus, - sizeof(DAC960_V2_GetHealthStatus_T))) - return -EFAULT; + sizeof(DAC960_V2_GetHealthStatus_T))) { + ErrorCode = -EFAULT; + break; + } + ErrorCode = -ENXIO; ControllerNumber = GetHealthStatus.ControllerNumber; if (ControllerNumber < 0 || ControllerNumber > DAC960_ControllerCount - 1) - return -ENXIO; + break; Controller = DAC960_Controllers[ControllerNumber]; - if (Controller == NULL) return -ENXIO; - if (Controller->FirmwareType != DAC960_V2_Controller) return -EINVAL; + if (Controller == NULL) + break; + if (Controller->FirmwareType != DAC960_V2_Controller) { + ErrorCode = -EINVAL; + break; + } if (copy_from_user(&HealthStatusBuffer, GetHealthStatus.HealthStatusBuffer, - sizeof(DAC960_V2_HealthStatusBuffer_T))) - return -EFAULT; + sizeof(DAC960_V2_HealthStatusBuffer_T))) { + ErrorCode = -EFAULT; + break; + } while (Controller->V2.HealthStatusBuffer->StatusChangeCounter == HealthStatusBuffer.StatusChangeCounter && Controller->V2.HealthStatusBuffer->NextEventSequenceNumber @@ -7023,21 +7050,28 @@ static int DAC960_gam_ioctl(struct inode *inode, struct file *file, { interruptible_sleep_on_timeout(&Controller->HealthStatusWaitQueue, DAC960_MonitoringTimerInterval); - if (signal_pending(current)) return -EINTR; + if (signal_pending(current)) { + ErrorCode = -EINTR; + break; + } } if (copy_to_user(GetHealthStatus.HealthStatusBuffer, Controller->V2.HealthStatusBuffer, sizeof(DAC960_V2_HealthStatusBuffer_T))) - return -EFAULT; - return 0; + ErrorCode = -EFAULT; + else + ErrorCode = 0; } + default: + ErrorCode = -ENOTTY; } - return -EINVAL; + unlock_kernel(); + return ErrorCode; } -static struct file_operations DAC960_gam_fops = { +static const struct file_operations DAC960_gam_fops = { .owner = THIS_MODULE, - .ioctl = DAC960_gam_ioctl + .unlocked_ioctl = DAC960_gam_ioctl }; static struct miscdevice DAC960_gam_dev = { @@ -7117,7 +7151,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, }, @@ -7179,7 +7213,7 @@ static int DAC960_init_module(void) { int ret; - ret = pci_module_init(&DAC960_pci_driver); + ret = pci_register_driver(&DAC960_pci_driver); #ifdef DAC960_GAM_MINOR if (!ret) DAC960_gam_init();