]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
pmem: kill memremap_pmem()
authorDan Williams <dan.j.williams@intel.com>
Tue, 15 Sep 2015 06:14:03 +0000 (02:14 -0400)
committerDan Williams <dan.j.williams@intel.com>
Fri, 9 Oct 2015 21:00:32 +0000 (17:00 -0400)
Now that the pmem-api is defined as "a set of apis that enables access
to WB mapped pmem",  the mapping type is implied.  Remove the wrapper
and push the functionality down into the pmem driver in preparation for
adding support for direct-mapped pmem.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/nvdimm/pmem.c
include/linux/pmem.h

index 0ba6a978f227e76a4b0c27046e2736d43cf37e45..0680affae04aa2a0ef207b2d263ad9101865fbc7 100644 (file)
@@ -157,8 +157,9 @@ static struct pmem_device *pmem_alloc(struct device *dev,
                        return addr;
                pmem->virt_addr = (void __pmem *) addr;
        } else {
-               pmem->virt_addr = memremap_pmem(dev, pmem->phys_addr,
-                               pmem->size);
+               pmem->virt_addr = (void __pmem *) devm_memremap(dev,
+                               pmem->phys_addr, pmem->size,
+                               ARCH_MEMREMAP_PMEM);
                if (!pmem->virt_addr)
                        return ERR_PTR(-ENXIO);
        }
@@ -363,8 +364,8 @@ static int nvdimm_namespace_attach_pfn(struct nd_namespace_common *ndns)
 
        /* establish pfn range for lookup, and switch to direct map */
        pmem = dev_get_drvdata(dev);
-       memunmap_pmem(dev, pmem->virt_addr);
-       pmem->virt_addr = (void __pmem *)devm_memremap_pages(dev, &nsio->res);
+       devm_memunmap(dev, (void __force *) pmem->virt_addr);
+       pmem->virt_addr = (void __pmem *) devm_memremap_pages(dev, &nsio->res);
        if (IS_ERR(pmem->virt_addr)) {
                rc = PTR_ERR(pmem->virt_addr);
                goto err;
index 85f810b339175f71367f6a06fe09a24f82f96f10..acfea8ce4a07be8b6291c76ca0f53728b06ae5fa 100644 (file)
@@ -65,11 +65,6 @@ static inline void memcpy_from_pmem(void *dst, void __pmem const *src, size_t si
        memcpy(dst, (void __force const *) src, size);
 }
 
-static inline void memunmap_pmem(struct device *dev, void __pmem *addr)
-{
-       devm_memunmap(dev, (void __force *) addr);
-}
-
 static inline bool arch_has_pmem_api(void)
 {
        return IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API);
@@ -93,7 +88,7 @@ static inline bool arch_has_wmb_pmem(void)
  * These defaults seek to offer decent performance and minimize the
  * window between i/o completion and writes being durable on media.
  * However, it is undefined / architecture specific whether
- * default_memremap_pmem + default_memcpy_to_pmem is sufficient for
+ * ARCH_MEMREMAP_PMEM + default_memcpy_to_pmem is sufficient for
  * making data durable relative to i/o completion.
  */
 static inline void default_memcpy_to_pmem(void __pmem *dst, const void *src,
@@ -116,25 +111,6 @@ static inline void default_clear_pmem(void __pmem *addr, size_t size)
                memset((void __force *)addr, 0, size);
 }
 
-/**
- * memremap_pmem - map physical persistent memory for pmem api
- * @offset: physical address of persistent memory
- * @size: size of the mapping
- *
- * Establish a mapping of the architecture specific memory type expected
- * by memcpy_to_pmem() and wmb_pmem().  For example, it may be
- * the case that an uncacheable or writethrough mapping is sufficient,
- * or a writeback mapping provided memcpy_to_pmem() and
- * wmb_pmem() arrange for the data to be written through the
- * cache to persistent media.
- */
-static inline void __pmem *memremap_pmem(struct device *dev,
-               resource_size_t offset, unsigned long size)
-{
-       return (void __pmem *) devm_memremap(dev, offset, size,
-                       ARCH_MEMREMAP_PMEM);
-}
-
 /**
  * memcpy_to_pmem - copy data to persistent memory
  * @dst: destination buffer for the copy