block: introduce new block status code type
[sfrench/cifs-2.6.git] / drivers / nvme / host / lightnvm.c
index 8c4adac6fafcc56dfe37d05a51f45798e5194652..2d7a2889866f09234874ac1a9b133dec5054ca29 100644 (file)
@@ -367,7 +367,8 @@ static int nvme_nvm_get_l2p_tbl(struct nvm_dev *nvmdev, u64 slba, u32 nlb,
 
                if (unlikely(elba > nvmdev->total_secs)) {
                        pr_err("nvm: L2P data from device is out of bounds!\n");
-                       return -EINVAL;
+                       ret = -EINVAL;
+                       goto out;
                }
 
                /* Transform physical address to target address space */
@@ -464,8 +465,8 @@ static int nvme_nvm_set_bb_tbl(struct nvm_dev *nvmdev, struct ppa_addr *ppas,
        return ret;
 }
 
-static inline void nvme_nvm_rqtocmd(struct request *rq, struct nvm_rq *rqd,
-                               struct nvme_ns *ns, struct nvme_nvm_command *c)
+static inline void nvme_nvm_rqtocmd(struct nvm_rq *rqd, struct nvme_ns *ns,
+                                   struct nvme_nvm_command *c)
 {
        c->ph_rw.opcode = rqd->opcode;
        c->ph_rw.nsid = cpu_to_le32(ns->ns_id);
@@ -479,7 +480,7 @@ static inline void nvme_nvm_rqtocmd(struct request *rq, struct nvm_rq *rqd,
                                        rqd->bio->bi_iter.bi_sector));
 }
 
-static void nvme_nvm_end_io(struct request *rq, int error)
+static void nvme_nvm_end_io(struct request *rq, blk_status_t status)
 {
        struct nvm_rq *rqd = rq->end_io_data;
 
@@ -503,7 +504,7 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
        if (!cmd)
                return -ENOMEM;
 
-       nvme_nvm_rqtocmd(rq, rqd, ns, cmd);
+       nvme_nvm_rqtocmd(rqd, ns, cmd);
 
        rq = nvme_alloc_request(q, (struct nvme_command *)cmd, 0, NVME_QID_ANY);
        if (IS_ERR(rq)) {
@@ -570,13 +571,6 @@ static struct nvm_dev_ops nvme_nvm_dev_ops = {
        .max_phys_sect          = 64,
 };
 
-static void nvme_nvm_end_user_vio(struct request *rq, int error)
-{
-       struct completion *waiting = rq->end_io_data;
-
-       complete(waiting);
-}
-
 static int nvme_nvm_submit_user_cmd(struct request_queue *q,
                                struct nvme_ns *ns,
                                struct nvme_nvm_command *vcmd,
@@ -607,7 +601,6 @@ static int nvme_nvm_submit_user_cmd(struct request_queue *q,
        rq->timeout = timeout ? timeout : ADMIN_TIMEOUT;
 
        rq->cmd_flags &= ~REQ_FAILFAST_DRIVER;
-       rq->end_io_data = &wait;
 
        if (ppa_buf && ppa_len) {
                ppa_list = dma_pool_alloc(dev->dma_pool, GFP_KERNEL, &ppa_dma);
@@ -661,9 +654,7 @@ static int nvme_nvm_submit_user_cmd(struct request_queue *q,
        }
 
 submit:
-       blk_execute_rq_nowait(q, NULL, rq, 0, nvme_nvm_end_user_vio);
-
-       wait_for_completion_io(&wait);
+       blk_execute_rq(q, NULL, rq, 0);
 
        if (nvme_req(rq)->flags & NVME_REQ_CANCELLED)
                ret = -EINTR;