diff options
| author | Christoph Hellwig <hch@lst.de> | 2017-12-29 02:54:05 -0500 |
|---|---|---|
| committer | Dan Williams <dan.j.williams@intel.com> | 2018-01-08 14:46:23 -0500 |
| commit | e8d5134833006a46fcbefc5f4a84d0b62bd520e7 (patch) | |
| tree | dbd532f4ef91828e251a291c967ee3afe71fd475 /tools/testing/nvdimm/test/iomap.c | |
| parent | e7744aa25cffe26d3767c9ffcf4e130cca1dff00 (diff) | |
memremap: change devm_memremap_pages interface to use struct dev_pagemap
This new interface is similar to how struct device (and many others)
work. The caller initializes a 'struct dev_pagemap' as required
and calls 'devm_memremap_pages'. This allows the pagemap structure to
be embedded in another structure and thus container_of can be used. In
this way application specific members can be stored in a containing
struct.
This will be used by the P2P infrastructure and HMM could probably
be cleaned up to use it as well (instead of having it's own, similar
'hmm_devmem_pages_create' function).
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'tools/testing/nvdimm/test/iomap.c')
| -rw-r--r-- | tools/testing/nvdimm/test/iomap.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/testing/nvdimm/test/iomap.c b/tools/testing/nvdimm/test/iomap.c index e1f75a1914a1..ff9d3a5825e1 100644 --- a/tools/testing/nvdimm/test/iomap.c +++ b/tools/testing/nvdimm/test/iomap.c | |||
| @@ -104,15 +104,14 @@ void *__wrap_devm_memremap(struct device *dev, resource_size_t offset, | |||
| 104 | } | 104 | } |
| 105 | EXPORT_SYMBOL(__wrap_devm_memremap); | 105 | EXPORT_SYMBOL(__wrap_devm_memremap); |
| 106 | 106 | ||
| 107 | void *__wrap_devm_memremap_pages(struct device *dev, struct resource *res, | 107 | void *__wrap_devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap) |
| 108 | struct percpu_ref *ref, struct vmem_altmap *altmap) | ||
| 109 | { | 108 | { |
| 110 | resource_size_t offset = res->start; | 109 | resource_size_t offset = pgmap->res.start; |
| 111 | struct nfit_test_resource *nfit_res = get_nfit_res(offset); | 110 | struct nfit_test_resource *nfit_res = get_nfit_res(offset); |
| 112 | 111 | ||
| 113 | if (nfit_res) | 112 | if (nfit_res) |
| 114 | return nfit_res->buf + offset - nfit_res->res.start; | 113 | return nfit_res->buf + offset - nfit_res->res.start; |
| 115 | return devm_memremap_pages(dev, res, ref, altmap); | 114 | return devm_memremap_pages(dev, pgmap); |
| 116 | } | 115 | } |
| 117 | EXPORT_SYMBOL(__wrap_devm_memremap_pages); | 116 | EXPORT_SYMBOL(__wrap_devm_memremap_pages); |
| 118 | 117 | ||
