]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/block/cciss.c
block: autoconvert trivial BKL users to private mutex
[net-next-2.6.git] / drivers / block / cciss.c
index 31064df1370a96320f548d1ce5f191eaf2e97051..ba9c3a4947c7fd9d85cf1b86b924bad94dbcacad 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/pci.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
-#include <linux/smp_lock.h>
 #include <linux/delay.h>
 #include <linux/major.h>
 #include <linux/fs.h>
@@ -66,6 +65,7 @@ MODULE_SUPPORTED_DEVICE("HP Smart Array Controllers");
 MODULE_VERSION("3.6.26");
 MODULE_LICENSE("GPL");
 
+static DEFINE_MUTEX(cciss_mutex);
 static int cciss_allow_hpsa;
 module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(cciss_allow_hpsa,
@@ -297,6 +297,8 @@ static void enqueue_cmd_and_start_io(ctlr_info_t *h,
        spin_lock_irqsave(&h->lock, flags);
        addQ(&h->reqQ, c);
        h->Qdepth++;
+       if (h->Qdepth > h->maxQsinceinit)
+               h->maxQsinceinit = h->Qdepth;
        start_io(h);
        spin_unlock_irqrestore(&h->lock, flags);
 }
@@ -1057,9 +1059,9 @@ static int cciss_unlocked_open(struct block_device *bdev, fmode_t mode)
 {
        int ret;
 
-       lock_kernel();
+       mutex_lock(&cciss_mutex);
        ret = cciss_open(bdev, mode);
-       unlock_kernel();
+       mutex_unlock(&cciss_mutex);
 
        return ret;
 }
@@ -1072,13 +1074,13 @@ static int cciss_release(struct gendisk *disk, fmode_t mode)
        ctlr_info_t *h;
        drive_info_struct *drv;
 
-       lock_kernel();
+       mutex_lock(&cciss_mutex);
        h = get_host(disk);
        drv = get_drv(disk);
        dev_dbg(&h->pdev->dev, "cciss_release %s\n", disk->disk_name);
        drv->usage_count--;
        h->usage_count--;
-       unlock_kernel();
+       mutex_unlock(&cciss_mutex);
        return 0;
 }
 
@@ -1086,9 +1088,9 @@ static int do_ioctl(struct block_device *bdev, fmode_t mode,
                    unsigned cmd, unsigned long arg)
 {
        int ret;
-       lock_kernel();
+       mutex_lock(&cciss_mutex);
        ret = cciss_ioctl(bdev, mode, cmd, arg);
-       unlock_kernel();
+       mutex_unlock(&cciss_mutex);
        return ret;
 }
 
@@ -4519,6 +4521,12 @@ static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev)
        misc_fw_support = readl(&cfgtable->misc_fw_support);
        use_doorbell = misc_fw_support & MISC_FW_DOORBELL_RESET;
 
+       /* The doorbell reset seems to cause lockups on some Smart
+        * Arrays (e.g. P410, P410i, maybe others).  Until this is
+        * fixed or at least isolated, avoid the doorbell reset.
+        */
+       use_doorbell = 0;
+
        rc = cciss_controller_hard_reset(pdev, vaddr, use_doorbell);
        if (rc)
                goto unmap_cfgtable;
@@ -4712,6 +4720,9 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
        h->scatter_list = kmalloc(h->max_commands *
                                                sizeof(struct scatterlist *),
                                                GFP_KERNEL);
+       if (!h->scatter_list)
+               goto clean4;
+
        for (k = 0; k < h->nr_cmds; k++) {
                h->scatter_list[k] = kmalloc(sizeof(struct scatterlist) *
                                                        h->maxsgentries,