aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/nvme-core.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew.r.wilcox@intel.com>2014-01-29 09:33:52 -0500
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2014-01-29 11:42:32 -0500
commitbdfd70fde389412be60f7e8aaed5732dc26fc8ac (patch)
tree41618ec5b7ad6f99456f4dc7c2ddcbeaa2d53e11 /drivers/block/nvme-core.c
parent3193f07bb7ae723f33ac8e8b9db317a4f68d7d18 (diff)
NVMe: Correct uses of INIT_WORK
We need to initialise the work_struct when we initialise the rest of the struct nvme_dev, otherwise we'll hit a lockdep warning when we remove the device. Use PREPARE_WORK to change the function pointer instead of INIT_WORK. Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block/nvme-core.c')
-rw-r--r--drivers/block/nvme-core.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 5ffc26937226..23728099e36f 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -1075,7 +1075,7 @@ static void nvme_abort_cmd(int cmdid, struct nvme_queue *nvmeq)
1075 dev_warn(&dev->pci_dev->dev, 1075 dev_warn(&dev->pci_dev->dev,
1076 "I/O %d QID %d timeout, reset controller\n", cmdid, 1076 "I/O %d QID %d timeout, reset controller\n", cmdid,
1077 nvmeq->qid); 1077 nvmeq->qid);
1078 INIT_WORK(&dev->reset_work, nvme_reset_failed_dev); 1078 PREPARE_WORK(&dev->reset_work, nvme_reset_failed_dev);
1079 queue_work(nvme_workq, &dev->reset_work); 1079 queue_work(nvme_workq, &dev->reset_work);
1080 return; 1080 return;
1081 } 1081 }
@@ -1757,7 +1757,7 @@ static int nvme_kthread(void *data)
1757 list_del_init(&dev->node); 1757 list_del_init(&dev->node);
1758 dev_warn(&dev->pci_dev->dev, 1758 dev_warn(&dev->pci_dev->dev,
1759 "Failed status, reset controller\n"); 1759 "Failed status, reset controller\n");
1760 INIT_WORK(&dev->reset_work, 1760 PREPARE_WORK(&dev->reset_work,
1761 nvme_reset_failed_dev); 1761 nvme_reset_failed_dev);
1762 queue_work(nvme_workq, &dev->reset_work); 1762 queue_work(nvme_workq, &dev->reset_work);
1763 continue; 1763 continue;
@@ -2460,7 +2460,7 @@ static int nvme_dev_resume(struct nvme_dev *dev)
2460 return ret; 2460 return ret;
2461 if (ret == -EBUSY) { 2461 if (ret == -EBUSY) {
2462 spin_lock(&dev_list_lock); 2462 spin_lock(&dev_list_lock);
2463 INIT_WORK(&dev->reset_work, nvme_remove_disks); 2463 PREPARE_WORK(&dev->reset_work, nvme_remove_disks);
2464 queue_work(nvme_workq, &dev->reset_work); 2464 queue_work(nvme_workq, &dev->reset_work);
2465 spin_unlock(&dev_list_lock); 2465 spin_unlock(&dev_list_lock);
2466 } 2466 }
@@ -2507,6 +2507,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2507 goto free; 2507 goto free;
2508 2508
2509 INIT_LIST_HEAD(&dev->namespaces); 2509 INIT_LIST_HEAD(&dev->namespaces);
2510 INIT_WORK(&dev->reset_work, nvme_reset_failed_dev);
2510 dev->pci_dev = pdev; 2511 dev->pci_dev = pdev;
2511 pci_set_drvdata(pdev, dev); 2512 pci_set_drvdata(pdev, dev);
2512 result = nvme_set_instance(dev); 2513 result = nvme_set_instance(dev);
@@ -2605,7 +2606,7 @@ static int nvme_resume(struct device *dev)
2605 struct nvme_dev *ndev = pci_get_drvdata(pdev); 2606 struct nvme_dev *ndev = pci_get_drvdata(pdev);
2606 2607
2607 if (nvme_dev_resume(ndev) && !work_busy(&ndev->reset_work)) { 2608 if (nvme_dev_resume(ndev) && !work_busy(&ndev->reset_work)) {
2608 INIT_WORK(&ndev->reset_work, nvme_reset_failed_dev); 2609 PREPARE_WORK(&ndev->reset_work, nvme_reset_failed_dev);
2609 queue_work(nvme_workq, &ndev->reset_work); 2610 queue_work(nvme_workq, &ndev->reset_work);
2610 } 2611 }
2611 return 0; 2612 return 0;