aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pmcraid.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/scsi/pmcraid.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/scsi/pmcraid.c')
-rw-r--r--drivers/scsi/pmcraid.c169
1 files changed, 131 insertions, 38 deletions
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index ecc45c8b4e6b..fca6a8953070 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -62,6 +62,7 @@
62static unsigned int pmcraid_debug_log; 62static unsigned int pmcraid_debug_log;
63static unsigned int pmcraid_disable_aen; 63static unsigned int pmcraid_disable_aen;
64static unsigned int pmcraid_log_level = IOASC_LOG_LEVEL_MUST; 64static unsigned int pmcraid_log_level = IOASC_LOG_LEVEL_MUST;
65static unsigned int pmcraid_enable_msix;
65 66
66/* 67/*
67 * Data structures to support multiple adapters by the LLD. 68 * Data structures to support multiple adapters by the LLD.
@@ -212,7 +213,7 @@ static int pmcraid_slave_alloc(struct scsi_device *scsi_dev)
212 * pmcraid_slave_configure - Configures a SCSI device 213 * pmcraid_slave_configure - Configures a SCSI device
213 * @scsi_dev: scsi device struct 214 * @scsi_dev: scsi device struct
214 * 215 *
215 * This fucntion is executed by SCSI mid layer just after a device is first 216 * This function is executed by SCSI mid layer just after a device is first
216 * scanned (i.e. it has responded to an INQUIRY). For VSET resources, the 217 * scanned (i.e. it has responded to an INQUIRY). For VSET resources, the
217 * timeout value (default 30s) will be over-written to a higher value (60s) 218 * timeout value (default 30s) will be over-written to a higher value (60s)
218 * and max_sectors value will be over-written to 512. It also sets queue depth 219 * and max_sectors value will be over-written to 512. It also sets queue depth
@@ -1594,10 +1595,12 @@ static void pmcraid_handle_config_change(struct pmcraid_instance *pinstance)
1594 cfg_entry = &ccn_hcam->cfg_entry; 1595 cfg_entry = &ccn_hcam->cfg_entry;
1595 fw_version = be16_to_cpu(pinstance->inq_data->fw_version); 1596 fw_version = be16_to_cpu(pinstance->inq_data->fw_version);
1596 1597
1597 pmcraid_info 1598 pmcraid_info("CCN(%x): %x timestamp: %llx type: %x lost: %x flags: %x \
1598 ("CCN(%x): %x type: %x lost: %x flags: %x res: %x:%x:%x:%x\n", 1599 res: %x:%x:%x:%x\n",
1599 pinstance->ccn.hcam->ilid, 1600 pinstance->ccn.hcam->ilid,
1600 pinstance->ccn.hcam->op_code, 1601 pinstance->ccn.hcam->op_code,
1602 ((pinstance->ccn.hcam->timestamp1) |
1603 ((pinstance->ccn.hcam->timestamp2 & 0xffffffffLL) << 32)),
1601 pinstance->ccn.hcam->notification_type, 1604 pinstance->ccn.hcam->notification_type,
1602 pinstance->ccn.hcam->notification_lost, 1605 pinstance->ccn.hcam->notification_lost,
1603 pinstance->ccn.hcam->flags, 1606 pinstance->ccn.hcam->flags,
@@ -1850,6 +1853,7 @@ static void pmcraid_process_ccn(struct pmcraid_cmd *cmd)
1850 * none 1853 * none
1851 */ 1854 */
1852static void pmcraid_initiate_reset(struct pmcraid_instance *); 1855static void pmcraid_initiate_reset(struct pmcraid_instance *);
1856static void pmcraid_set_timestamp(struct pmcraid_cmd *cmd);
1853 1857
1854static void pmcraid_process_ldn(struct pmcraid_cmd *cmd) 1858static void pmcraid_process_ldn(struct pmcraid_cmd *cmd)
1855{ 1859{
@@ -1881,6 +1885,10 @@ static void pmcraid_process_ldn(struct pmcraid_cmd *cmd)
1881 lock_flags); 1885 lock_flags);
1882 return; 1886 return;
1883 } 1887 }
1888 if (fd_ioasc == PMCRAID_IOASC_TIME_STAMP_OUT_OF_SYNC) {
1889 pinstance->timestamp_error = 1;
1890 pmcraid_set_timestamp(cmd);
1891 }
1884 } else { 1892 } else {
1885 dev_info(&pinstance->pdev->dev, 1893 dev_info(&pinstance->pdev->dev,
1886 "Host RCB(LDN) failed with IOASC: 0x%08X\n", ioasc); 1894 "Host RCB(LDN) failed with IOASC: 0x%08X\n", ioasc);
@@ -2114,7 +2122,7 @@ static void pmcraid_fail_outstanding_cmds(struct pmcraid_instance *pinstance)
2114 * 2122 *
2115 * This function executes most of the steps required for IOA reset. This gets 2123 * This function executes most of the steps required for IOA reset. This gets
2116 * called by user threads (modprobe/insmod/rmmod) timer, tasklet and midlayer's 2124 * called by user threads (modprobe/insmod/rmmod) timer, tasklet and midlayer's
2117 * 'eh_' thread. Access to variables used for controling the reset sequence is 2125 * 'eh_' thread. Access to variables used for controlling the reset sequence is
2118 * synchronized using host lock. Various functions called during reset process 2126 * synchronized using host lock. Various functions called during reset process
2119 * would make use of a single command block, pointer to which is also stored in 2127 * would make use of a single command block, pointer to which is also stored in
2120 * adapter instance structure. 2128 * adapter instance structure.
@@ -2220,12 +2228,7 @@ static void pmcraid_ioa_reset(struct pmcraid_cmd *cmd)
2220 /* Once either bist or pci reset is done, restore PCI config 2228 /* Once either bist or pci reset is done, restore PCI config
2221 * space. If this fails, proceed with hard reset again 2229 * space. If this fails, proceed with hard reset again
2222 */ 2230 */
2223 if (pci_restore_state(pinstance->pdev)) { 2231 pci_restore_state(pinstance->pdev);
2224 pmcraid_info("config-space error resetting again\n");
2225 pinstance->ioa_state = IOA_STATE_IN_RESET_ALERT;
2226 pmcraid_reset_alert(cmd);
2227 break;
2228 }
2229 2232
2230 /* fail all pending commands */ 2233 /* fail all pending commands */
2231 pmcraid_fail_outstanding_cmds(pinstance); 2234 pmcraid_fail_outstanding_cmds(pinstance);
@@ -2991,7 +2994,7 @@ static int pmcraid_abort_complete(struct pmcraid_cmd *cancel_cmd)
2991 2994
2992 /* If the abort task is not timed out we will get a Good completion 2995 /* If the abort task is not timed out we will get a Good completion
2993 * as sense_key, otherwise we may get one the following responses 2996 * as sense_key, otherwise we may get one the following responses
2994 * due to subsquent bus reset or device reset. In case IOASC is 2997 * due to subsequent bus reset or device reset. In case IOASC is
2995 * NR_SYNC_REQUIRED, set sync_reqd flag for the corresponding resource 2998 * NR_SYNC_REQUIRED, set sync_reqd flag for the corresponding resource
2996 */ 2999 */
2997 if (ioasc == PMCRAID_IOASC_UA_BUS_WAS_RESET || 3000 if (ioasc == PMCRAID_IOASC_UA_BUS_WAS_RESET ||
@@ -3363,7 +3366,7 @@ static struct pmcraid_sglist *pmcraid_alloc_sglist(int buflen)
3363 sg_size = buflen; 3366 sg_size = buflen;
3364 3367
3365 for (i = 0; i < num_elem; i++) { 3368 for (i = 0; i < num_elem; i++) {
3366 page = alloc_pages(GFP_KERNEL|GFP_DMA, order); 3369 page = alloc_pages(GFP_KERNEL|GFP_DMA|__GFP_ZERO, order);
3367 if (!page) { 3370 if (!page) {
3368 for (j = i - 1; j >= 0; j--) 3371 for (j = i - 1; j >= 0; j--)
3369 __free_pages(sg_page(&scatterlist[j]), order); 3372 __free_pages(sg_page(&scatterlist[j]), order);
@@ -3471,7 +3474,7 @@ static int pmcraid_copy_sglist(
3471 * SCSI_MLQUEUE_DEVICE_BUSY if device is busy 3474 * SCSI_MLQUEUE_DEVICE_BUSY if device is busy
3472 * SCSI_MLQUEUE_HOST_BUSY if host is busy 3475 * SCSI_MLQUEUE_HOST_BUSY if host is busy
3473 */ 3476 */
3474static int pmcraid_queuecommand( 3477static int pmcraid_queuecommand_lck(
3475 struct scsi_cmnd *scsi_cmd, 3478 struct scsi_cmnd *scsi_cmd,
3476 void (*done) (struct scsi_cmnd *) 3479 void (*done) (struct scsi_cmnd *)
3477) 3480)
@@ -3577,6 +3580,8 @@ static int pmcraid_queuecommand(
3577 return rc; 3580 return rc;
3578} 3581}
3579 3582
3583static DEF_SCSI_QCMD(pmcraid_queuecommand)
3584
3580/** 3585/**
3581 * pmcraid_open -char node "open" entry, allowed only users with admin access 3586 * pmcraid_open -char node "open" entry, allowed only users with admin access
3582 */ 3587 */
@@ -3739,6 +3744,7 @@ static long pmcraid_ioctl_passthrough(
3739 unsigned long request_buffer; 3744 unsigned long request_buffer;
3740 unsigned long request_offset; 3745 unsigned long request_offset;
3741 unsigned long lock_flags; 3746 unsigned long lock_flags;
3747 void *ioasa;
3742 u32 ioasc; 3748 u32 ioasc;
3743 int request_size; 3749 int request_size;
3744 int buffer_size; 3750 int buffer_size;
@@ -3780,6 +3786,11 @@ static long pmcraid_ioctl_passthrough(
3780 rc = __copy_from_user(buffer, 3786 rc = __copy_from_user(buffer,
3781 (struct pmcraid_passthrough_ioctl_buffer *) arg, 3787 (struct pmcraid_passthrough_ioctl_buffer *) arg,
3782 sizeof(struct pmcraid_passthrough_ioctl_buffer)); 3788 sizeof(struct pmcraid_passthrough_ioctl_buffer));
3789
3790 ioasa =
3791 (void *)(arg +
3792 offsetof(struct pmcraid_passthrough_ioctl_buffer, ioasa));
3793
3783 if (rc) { 3794 if (rc) {
3784 pmcraid_err("ioctl: can't copy passthrough buffer\n"); 3795 pmcraid_err("ioctl: can't copy passthrough buffer\n");
3785 rc = -EFAULT; 3796 rc = -EFAULT;
@@ -3803,6 +3814,9 @@ static long pmcraid_ioctl_passthrough(
3803 rc = -EFAULT; 3814 rc = -EFAULT;
3804 goto out_free_buffer; 3815 goto out_free_buffer;
3805 } 3816 }
3817 } else if (request_size < 0) {
3818 rc = -EINVAL;
3819 goto out_free_buffer;
3806 } 3820 }
3807 3821
3808 /* check if we have any additional command parameters */ 3822 /* check if we have any additional command parameters */
@@ -3922,7 +3936,7 @@ static long pmcraid_ioctl_passthrough(
3922 3936
3923 /* if abort task couldn't find the command i.e it got 3937 /* if abort task couldn't find the command i.e it got
3924 * completed prior to aborting, return good completion. 3938 * completed prior to aborting, return good completion.
3925 * if command got aborted succesfully or there was IOA 3939 * if command got aborted successfully or there was IOA
3926 * reset due to abort task itself getting timedout then 3940 * reset due to abort task itself getting timedout then
3927 * return -ETIMEDOUT 3941 * return -ETIMEDOUT
3928 */ 3942 */
@@ -3947,22 +3961,14 @@ static long pmcraid_ioctl_passthrough(
3947 } 3961 }
3948 3962
3949out_handle_response: 3963out_handle_response:
3950 /* If the command failed for any reason, copy entire IOASA buffer and 3964 /* copy entire IOASA buffer and return IOCTL success.
3951 * return IOCTL success. If copying IOASA to user-buffer fails, return 3965 * If copying IOASA to user-buffer fails, return
3952 * EFAULT 3966 * EFAULT
3953 */ 3967 */
3954 if (PMCRAID_IOASC_SENSE_KEY(le32_to_cpu(cmd->ioa_cb->ioasa.ioasc))) { 3968 if (copy_to_user(ioasa, &cmd->ioa_cb->ioasa,
3955 void *ioasa = 3969 sizeof(struct pmcraid_ioasa))) {
3956 (void *)(arg + 3970 pmcraid_err("failed to copy ioasa buffer to user\n");
3957 offsetof(struct pmcraid_passthrough_ioctl_buffer, ioasa)); 3971 rc = -EFAULT;
3958
3959 pmcraid_info("command failed with %x\n",
3960 le32_to_cpu(cmd->ioa_cb->ioasa.ioasc));
3961 if (copy_to_user(ioasa, &cmd->ioa_cb->ioasa,
3962 sizeof(struct pmcraid_ioasa))) {
3963 pmcraid_err("failed to copy ioasa buffer to user\n");
3964 rc = -EFAULT;
3965 }
3966 } 3972 }
3967 3973
3968 /* If the data transfer was from device, copy the data onto user 3974 /* If the data transfer was from device, copy the data onto user
@@ -4165,6 +4171,7 @@ static const struct file_operations pmcraid_fops = {
4165#ifdef CONFIG_COMPAT 4171#ifdef CONFIG_COMPAT
4166 .compat_ioctl = pmcraid_chr_ioctl, 4172 .compat_ioctl = pmcraid_chr_ioctl,
4167#endif 4173#endif
4174 .llseek = noop_llseek,
4168}; 4175};
4169 4176
4170 4177
@@ -4245,8 +4252,8 @@ static ssize_t pmcraid_show_drv_version(
4245 char *buf 4252 char *buf
4246) 4253)
4247{ 4254{
4248 return snprintf(buf, PAGE_SIZE, "version: %s, build date: %s\n", 4255 return snprintf(buf, PAGE_SIZE, "version: %s\n",
4249 PMCRAID_DRIVER_VERSION, PMCRAID_DRIVER_DATE); 4256 PMCRAID_DRIVER_VERSION);
4250} 4257}
4251 4258
4252static struct device_attribute pmcraid_driver_version_attr = { 4259static struct device_attribute pmcraid_driver_version_attr = {
@@ -4683,7 +4690,8 @@ pmcraid_register_interrupt_handler(struct pmcraid_instance *pinstance)
4683 int rc; 4690 int rc;
4684 struct pci_dev *pdev = pinstance->pdev; 4691 struct pci_dev *pdev = pinstance->pdev;
4685 4692
4686 if (pci_find_capability(pdev, PCI_CAP_ID_MSIX)) { 4693 if ((pmcraid_enable_msix) &&
4694 (pci_find_capability(pdev, PCI_CAP_ID_MSIX))) {
4687 int num_hrrq = PMCRAID_NUM_MSIX_VECTORS; 4695 int num_hrrq = PMCRAID_NUM_MSIX_VECTORS;
4688 struct msix_entry entries[PMCRAID_NUM_MSIX_VECTORS]; 4696 struct msix_entry entries[PMCRAID_NUM_MSIX_VECTORS];
4689 int i; 4697 int i;
@@ -5146,6 +5154,16 @@ static void pmcraid_release_buffers(struct pmcraid_instance *pinstance)
5146 pinstance->inq_data = NULL; 5154 pinstance->inq_data = NULL;
5147 pinstance->inq_data_baddr = 0; 5155 pinstance->inq_data_baddr = 0;
5148 } 5156 }
5157
5158 if (pinstance->timestamp_data != NULL) {
5159 pci_free_consistent(pinstance->pdev,
5160 sizeof(struct pmcraid_timestamp_data),
5161 pinstance->timestamp_data,
5162 pinstance->timestamp_data_baddr);
5163
5164 pinstance->timestamp_data = NULL;
5165 pinstance->timestamp_data_baddr = 0;
5166 }
5149} 5167}
5150 5168
5151/** 5169/**
@@ -5204,6 +5222,20 @@ static int __devinit pmcraid_init_buffers(struct pmcraid_instance *pinstance)
5204 return -ENOMEM; 5222 return -ENOMEM;
5205 } 5223 }
5206 5224
5225 /* allocate DMAable memory for set timestamp data buffer */
5226 pinstance->timestamp_data = pci_alloc_consistent(
5227 pinstance->pdev,
5228 sizeof(struct pmcraid_timestamp_data),
5229 &pinstance->timestamp_data_baddr);
5230
5231 if (pinstance->timestamp_data == NULL) {
5232 pmcraid_err("couldn't allocate DMA memory for \
5233 set time_stamp \n");
5234 pmcraid_release_buffers(pinstance);
5235 return -ENOMEM;
5236 }
5237
5238
5207 /* Initialize all the command blocks and add them to free pool. No 5239 /* Initialize all the command blocks and add them to free pool. No
5208 * need to lock (free_pool_lock) as this is done in initialization 5240 * need to lock (free_pool_lock) as this is done in initialization
5209 * itself 5241 * itself
@@ -5425,7 +5457,7 @@ static void __devexit pmcraid_remove(struct pci_dev *pdev)
5425 pmcraid_shutdown(pdev); 5457 pmcraid_shutdown(pdev);
5426 5458
5427 pmcraid_disable_interrupts(pinstance, ~0); 5459 pmcraid_disable_interrupts(pinstance, ~0);
5428 flush_scheduled_work(); 5460 flush_work_sync(&pinstance->worker_q);
5429 5461
5430 pmcraid_kill_tasklets(pinstance); 5462 pmcraid_kill_tasklets(pinstance);
5431 pmcraid_unregister_interrupt_handler(pinstance); 5463 pmcraid_unregister_interrupt_handler(pinstance);
@@ -5609,6 +5641,68 @@ static void pmcraid_set_supported_devs(struct pmcraid_cmd *cmd)
5609} 5641}
5610 5642
5611/** 5643/**
5644 * pmcraid_set_timestamp - set the timestamp to IOAFP
5645 *
5646 * @cmd: pointer to pmcraid_cmd structure
5647 *
5648 * Return Value
5649 * 0 for success or non-zero for failure cases
5650 */
5651static void pmcraid_set_timestamp(struct pmcraid_cmd *cmd)
5652{
5653 struct pmcraid_instance *pinstance = cmd->drv_inst;
5654 struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb;
5655 __be32 time_stamp_len = cpu_to_be32(PMCRAID_TIMESTAMP_LEN);
5656 struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl;
5657
5658 struct timeval tv;
5659 __le64 timestamp;
5660
5661 do_gettimeofday(&tv);
5662 timestamp = tv.tv_sec * 1000;
5663
5664 pinstance->timestamp_data->timestamp[0] = (__u8)(timestamp);
5665 pinstance->timestamp_data->timestamp[1] = (__u8)((timestamp) >> 8);
5666 pinstance->timestamp_data->timestamp[2] = (__u8)((timestamp) >> 16);
5667 pinstance->timestamp_data->timestamp[3] = (__u8)((timestamp) >> 24);
5668 pinstance->timestamp_data->timestamp[4] = (__u8)((timestamp) >> 32);
5669 pinstance->timestamp_data->timestamp[5] = (__u8)((timestamp) >> 40);
5670
5671 pmcraid_reinit_cmdblk(cmd);
5672 ioarcb->request_type = REQ_TYPE_SCSI;
5673 ioarcb->resource_handle = cpu_to_le32(PMCRAID_IOA_RES_HANDLE);
5674 ioarcb->cdb[0] = PMCRAID_SCSI_SET_TIMESTAMP;
5675 ioarcb->cdb[1] = PMCRAID_SCSI_SERVICE_ACTION;
5676 memcpy(&(ioarcb->cdb[6]), &time_stamp_len, sizeof(time_stamp_len));
5677
5678 ioarcb->ioadl_bus_addr = cpu_to_le64((cmd->ioa_cb_bus_addr) +
5679 offsetof(struct pmcraid_ioarcb,
5680 add_data.u.ioadl[0]));
5681 ioarcb->ioadl_length = cpu_to_le32(sizeof(struct pmcraid_ioadl_desc));
5682 ioarcb->ioarcb_bus_addr &= ~(0x1FULL);
5683
5684 ioarcb->request_flags0 |= NO_LINK_DESCS;
5685 ioarcb->request_flags0 |= TRANSFER_DIR_WRITE;
5686 ioarcb->data_transfer_length =
5687 cpu_to_le32(sizeof(struct pmcraid_timestamp_data));
5688 ioadl = &(ioarcb->add_data.u.ioadl[0]);
5689 ioadl->flags = IOADL_FLAGS_LAST_DESC;
5690 ioadl->address = cpu_to_le64(pinstance->timestamp_data_baddr);
5691 ioadl->data_len = cpu_to_le32(sizeof(struct pmcraid_timestamp_data));
5692
5693 if (!pinstance->timestamp_error) {
5694 pinstance->timestamp_error = 0;
5695 pmcraid_send_cmd(cmd, pmcraid_set_supported_devs,
5696 PMCRAID_INTERNAL_TIMEOUT, pmcraid_timeout_handler);
5697 } else {
5698 pmcraid_send_cmd(cmd, pmcraid_return_cmd,
5699 PMCRAID_INTERNAL_TIMEOUT, pmcraid_timeout_handler);
5700 return;
5701 }
5702}
5703
5704
5705/**
5612 * pmcraid_init_res_table - Initialize the resource table 5706 * pmcraid_init_res_table - Initialize the resource table
5613 * @cmd: pointer to pmcraid command struct 5707 * @cmd: pointer to pmcraid command struct
5614 * 5708 *
@@ -5719,7 +5813,7 @@ static void pmcraid_init_res_table(struct pmcraid_cmd *cmd)
5719 5813
5720 /* release the resource list lock */ 5814 /* release the resource list lock */
5721 spin_unlock_irqrestore(&pinstance->resource_lock, lock_flags); 5815 spin_unlock_irqrestore(&pinstance->resource_lock, lock_flags);
5722 pmcraid_set_supported_devs(cmd); 5816 pmcraid_set_timestamp(cmd);
5723} 5817}
5724 5818
5725/** 5819/**
@@ -5841,7 +5935,7 @@ static int __devinit pmcraid_probe(
5841 * However, firmware supports 64-bit streaming DMA buffers, whereas 5935 * However, firmware supports 64-bit streaming DMA buffers, whereas
5842 * coherent buffers are to be 32-bit. Since pci_alloc_consistent always 5936 * coherent buffers are to be 32-bit. Since pci_alloc_consistent always
5843 * returns memory within 4GB (if not, change this logic), coherent 5937 * returns memory within 4GB (if not, change this logic), coherent
5844 * buffers are within firmware acceptible address ranges. 5938 * buffers are within firmware acceptable address ranges.
5845 */ 5939 */
5846 if ((sizeof(dma_addr_t) == 4) || 5940 if ((sizeof(dma_addr_t) == 4) ||
5847 pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) 5941 pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))
@@ -6002,9 +6096,8 @@ static int __init pmcraid_init(void)
6002 dev_t dev; 6096 dev_t dev;
6003 int error; 6097 int error;
6004 6098
6005 pmcraid_info("%s Device Driver version: %s %s\n", 6099 pmcraid_info("%s Device Driver version: %s\n",
6006 PMCRAID_DRIVER_NAME, 6100 PMCRAID_DRIVER_NAME, PMCRAID_DRIVER_VERSION);
6007 PMCRAID_DRIVER_VERSION, PMCRAID_DRIVER_DATE);
6008 6101
6009 error = alloc_chrdev_region(&dev, 0, 6102 error = alloc_chrdev_region(&dev, 0,
6010 PMCRAID_MAX_ADAPTERS, 6103 PMCRAID_MAX_ADAPTERS,
@@ -6053,10 +6146,10 @@ out_init:
6053static void __exit pmcraid_exit(void) 6146static void __exit pmcraid_exit(void)
6054{ 6147{
6055 pmcraid_netlink_release(); 6148 pmcraid_netlink_release();
6056 class_destroy(pmcraid_class);
6057 unregister_chrdev_region(MKDEV(pmcraid_major, 0), 6149 unregister_chrdev_region(MKDEV(pmcraid_major, 0),
6058 PMCRAID_MAX_ADAPTERS); 6150 PMCRAID_MAX_ADAPTERS);
6059 pci_unregister_driver(&pmcraid_driver); 6151 pci_unregister_driver(&pmcraid_driver);
6152 class_destroy(pmcraid_class);
6060} 6153}
6061 6154
6062module_init(pmcraid_init); 6155module_init(pmcraid_init);