Merge tag 'char-misc-5.15-rc1-lkdtm' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / drivers / nvme / target / passthru.c
index 225cd1f..f0efb35 100644 (file)
@@ -20,6 +20,16 @@ MODULE_IMPORT_NS(NVME_TARGET_PASSTHRU);
  */
 static DEFINE_XARRAY(passthru_subsystems);
 
+void nvmet_passthrough_override_cap(struct nvmet_ctrl *ctrl)
+{
+       /*
+        * Multiple command set support can only be declared if the underlying
+        * controller actually supports it.
+        */
+       if (!nvme_multi_css(ctrl->subsys->passthru_ctrl))
+               ctrl->cap &= ~(1ULL << 43);
+}
+
 static u16 nvmet_passthru_override_id_ctrl(struct nvmet_req *req)
 {
        struct nvmet_ctrl *ctrl = req->sq->ctrl;
@@ -218,7 +228,7 @@ static int nvmet_passthru_map_sg(struct nvmet_req *req, struct request *rq)
 
 static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
 {
-       struct nvme_ctrl *ctrl = nvmet_req_passthru_ctrl(req);
+       struct nvme_ctrl *ctrl = nvmet_req_subsys(req)->passthru_ctrl;
        struct request_queue *q = ctrl->admin_q;
        struct nvme_ns *ns = NULL;
        struct request *rq = NULL;
@@ -299,7 +309,7 @@ out:
  */
 static void nvmet_passthru_set_host_behaviour(struct nvmet_req *req)
 {
-       struct nvme_ctrl *ctrl = nvmet_req_passthru_ctrl(req);
+       struct nvme_ctrl *ctrl = nvmet_req_subsys(req)->passthru_ctrl;
        struct nvme_feat_host_behavior *host;
        u16 status = NVME_SC_INTERNAL;
        int ret;