Merge branch 'fix/acer-alc889-fix' into fix/hda
[firefly-linux-kernel-4.4.55.git] / drivers / block / nvme.c
index b583603fae5bbe1c02532c54a338c31acdc6fa55..c1dc4d86c22122f4b34abd35880cfcbb0896215d 100644 (file)
@@ -613,11 +613,7 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
        return result;
 }
 
-/*
- * NB: return value of non-zero would mean that we were a stacking driver.
- * make_request must always succeed.
- */
-static int nvme_make_request(struct request_queue *q, struct bio *bio)
+static void nvme_make_request(struct request_queue *q, struct bio *bio)
 {
        struct nvme_ns *ns = q->queuedata;
        struct nvme_queue *nvmeq = get_nvmeq(ns->dev);
@@ -634,8 +630,6 @@ static int nvme_make_request(struct request_queue *q, struct bio *bio)
 
        spin_unlock_irq(&nvmeq->q_lock);
        put_nvmeq(nvmeq);
-
-       return 0;
 }
 
 static irqreturn_t nvme_process_cq(struct nvme_queue *nvmeq)
@@ -840,7 +834,7 @@ static int nvme_identify(struct nvme_dev *dev, unsigned nsid, unsigned cns,
 }
 
 static int nvme_get_features(struct nvme_dev *dev, unsigned fid,
-                       unsigned dword11, dma_addr_t dma_addr, u32 *result)
+                               unsigned dword11, dma_addr_t dma_addr)
 {
        struct nvme_command c;
 
@@ -850,6 +844,20 @@ static int nvme_get_features(struct nvme_dev *dev, unsigned fid,
        c.features.fid = cpu_to_le32(fid);
        c.features.dword11 = cpu_to_le32(dword11);
 
+       return nvme_submit_admin_cmd(dev, &c, NULL);
+}
+
+static int nvme_set_features(struct nvme_dev *dev, unsigned fid,
+                       unsigned dword11, dma_addr_t dma_addr, u32 *result)
+{
+       struct nvme_command c;
+
+       memset(&c, 0, sizeof(c));
+       c.features.opcode = nvme_admin_set_features;
+       c.features.prp1 = cpu_to_le64(dma_addr);
+       c.features.fid = cpu_to_le32(fid);
+       c.features.dword11 = cpu_to_le32(dword11);
+
        return nvme_submit_admin_cmd(dev, &c, result);
 }
 
@@ -1365,7 +1373,7 @@ static int set_queue_count(struct nvme_dev *dev, int count)
        u32 result;
        u32 q_count = (count - 1) | ((count - 1) << 16);
 
-       status = nvme_get_features(dev, NVME_FEAT_NUM_QUEUES, q_count, 0,
+       status = nvme_set_features(dev, NVME_FEAT_NUM_QUEUES, q_count, 0,
                                                                &result);
        if (status)
                return -EIO;
@@ -1482,7 +1490,7 @@ static int __devinit nvme_dev_add(struct nvme_dev *dev)
                        continue;
 
                res = nvme_get_features(dev, NVME_FEAT_LBA_RANGE, i,
-                                                       dma_addr + 4096, NULL);
+                                                       dma_addr + 4096);
                if (res)
                        continue;
 
@@ -1726,6 +1734,6 @@ static void __exit nvme_exit(void)
 
 MODULE_AUTHOR("Matthew Wilcox <willy@linux.intel.com>");
 MODULE_LICENSE("GPL");
-MODULE_VERSION("0.7");
+MODULE_VERSION("0.8");
 module_init(nvme_init);
 module_exit(nvme_exit);