summaryrefslogtreecommitdiffstats
path: root/drivers/nvme/host/pci.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-02-17 13:59:39 +0100
committerJens Axboe <axboe@fb.com>2017-02-17 12:41:47 -0700
commit4f1244c8298606b8fae64b4d78b820ae6b896e3c (patch)
tree81fbf9080d730ca328572847be75fa4e05e4268e /drivers/nvme/host/pci.c
parentf5b37b7c23915af93081a8711e0a0f0219063756 (diff)
downloadblackbird-op-linux-4f1244c8298606b8fae64b4d78b820ae6b896e3c.tar.gz
blackbird-op-linux-4f1244c8298606b8fae64b4d78b820ae6b896e3c.zip
block/sed-opal: allocate struct opal_dev dynamically
Insted of bloating the containing structure with it all the time this allocates struct opal_dev dynamically. Additionally this allows moving the definition of struct opal_dev into sed-opal.c. For this a new private data field is added to it that is passed to the send/receive callback. After that a lot of internals can be made private as well. Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Scott Bauer <scott.bauer@intel.com> Reviewed-by: Scott Bauer <scott.bauer@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/nvme/host/pci.c')
-rw-r--r--drivers/nvme/host/pci.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index f08e86e73dda..50b070528c50 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1742,6 +1742,7 @@ static void nvme_pci_free_ctrl(struct nvme_ctrl *ctrl)
if (dev->ctrl.admin_q)
blk_put_queue(dev->ctrl.admin_q);
kfree(dev->queues);
+ kfree(dev->ctrl.opal_dev);
kfree(dev);
}
@@ -1791,10 +1792,13 @@ static void nvme_reset_work(struct work_struct *work)
if (result)
goto out;
- init_opal_dev(&dev->ctrl.opal_dev, &nvme_sec_submit);
+ if (!dev->ctrl.opal_dev) {
+ dev->ctrl.opal_dev =
+ init_opal_dev(&dev->ctrl, &nvme_sec_submit);
+ }
if (was_suspend)
- opal_unlock_from_suspend(&dev->ctrl.opal_dev);
+ opal_unlock_from_suspend(dev->ctrl.opal_dev);
result = nvme_setup_io_queues(dev);
if (result)
OpenPOWER on IntegriCloud