diff options
author | Christoph Hellwig <hch@lst.de> | 2015-11-28 17:40:19 +0300 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-12-01 20:59:40 +0300 |
commit | f3ca80fc11c3af566eacd99cf821c1a48035c63b (patch) | |
tree | 1db6d155210c4f11a48a2285eb7691313fa73496 /drivers/nvme/host/scsi.c | |
parent | 5bae7f73d378a986671a3cad717c721b38f80d9e (diff) | |
download | linux-f3ca80fc11c3af566eacd99cf821c1a48035c63b.tar.xz |
nvme: move chardev and sysfs interface to common code
For this we need to add a proper controller init routine and a list of
all controllers that is in addition to the list of PCIe controllers,
which stays in pci.c. Note that we remove the sysfs device when the
last reference to a controller is dropped now - the old code would have
kept it around longer, which doesn't make much sense.
This requires a new ->reset_ctrl operation to implement controleller
resets, and a new ->write_reg32 operation that is required to implement
subsystem resets. We also now store caches copied of the NVMe compliance
version and the flag if a controller is attached to a subsystem or not in
the generic controller structure now.
Signed-off-by: Christoph Hellwig <hch@lst.de>
[Fixes for pr merge]
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/nvme/host/scsi.c')
-rw-r--r-- | drivers/nvme/host/scsi.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/nvme/host/scsi.c b/drivers/nvme/host/scsi.c index eaf725610fe2..e947e298a737 100644 --- a/drivers/nvme/host/scsi.c +++ b/drivers/nvme/host/scsi.c @@ -600,7 +600,7 @@ static int nvme_trans_unit_serial_page(struct nvme_ns *ns, } static int nvme_fill_device_id_eui64(struct nvme_ns *ns, struct sg_io_hdr *hdr, - u8 *inq_response, int alloc_len, u32 vs) + u8 *inq_response, int alloc_len) { struct nvme_id_ns *id_ns; int nvme_sc, res; @@ -615,7 +615,7 @@ static int nvme_fill_device_id_eui64(struct nvme_ns *ns, struct sg_io_hdr *hdr, eui = id_ns->eui64; len = sizeof(id_ns->eui64); - if (vs >= NVME_VS(1, 2)) { + if (ns->ctrl->vs >= NVME_VS(1, 2)) { if (bitmap_empty(eui, len * 8)) { eui = id_ns->nguid; len = sizeof(id_ns->nguid); @@ -687,14 +687,9 @@ static int nvme_trans_device_id_page(struct nvme_ns *ns, struct sg_io_hdr *hdr, u8 *resp, int alloc_len) { int res; - u32 vs; - res = ns->ctrl->ops->reg_read32(ns->ctrl, NVME_REG_VS, &vs); - if (res) - return res; - - if (vs >= NVME_VS(1, 1)) { - res = nvme_fill_device_id_eui64(ns, hdr, resp, alloc_len, vs); + if (ns->ctrl->vs >= NVME_VS(1, 1)) { + res = nvme_fill_device_id_eui64(ns, hdr, resp, alloc_len); if (res != -EOPNOTSUPP) return res; } |