summaryrefslogtreecommitdiffstats
path: root/mm/hmm.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-06-26 14:27:12 +0200
committerJason Gunthorpe <jgg@mellanox.com>2019-07-02 19:32:44 +0200
commit80a72d0af05ae97a8b106c172e431072ba587492 (patch)
tree9f7ace9e0b44dc866a6ac1fda624813a608b11ed /mm/hmm.c
parentmemremap: add a migrate_to_ram method to struct dev_pagemap_ops (diff)
downloadlinux-80a72d0af05ae97a8b106c172e431072ba587492.tar.xz
linux-80a72d0af05ae97a8b106c172e431072ba587492.zip
memremap: remove the data field in struct dev_pagemap
struct dev_pagemap is always embedded into a containing structure, so there is no need to an additional private data field. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jason Gunthorpe <jgg@mellanox.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Tested-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'mm/hmm.c')
-rw-r--r--mm/hmm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/mm/hmm.c b/mm/hmm.c
index 96633ee066d8..36e25cdbdac1 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -1368,15 +1368,17 @@ static void hmm_devmem_ref_kill(struct dev_pagemap *pgmap)
static vm_fault_t hmm_devmem_migrate_to_ram(struct vm_fault *vmf)
{
- struct hmm_devmem *devmem = vmf->page->pgmap->data;
+ struct hmm_devmem *devmem =
+ container_of(vmf->page->pgmap, struct hmm_devmem, pagemap);
return devmem->ops->fault(devmem, vmf->vma, vmf->address, vmf->page,
vmf->flags, vmf->pmd);
}
-static void hmm_devmem_free(struct page *page, void *data)
+static void hmm_devmem_free(struct page *page)
{
- struct hmm_devmem *devmem = data;
+ struct hmm_devmem *devmem =
+ container_of(page->pgmap, struct hmm_devmem, pagemap);
devmem->ops->free(devmem, page);
}
@@ -1442,7 +1444,6 @@ struct hmm_devmem *hmm_devmem_add(const struct hmm_devmem_ops *ops,
devmem->pagemap.ops = &hmm_pagemap_ops;
devmem->pagemap.altmap_valid = false;
devmem->pagemap.ref = &devmem->ref;
- devmem->pagemap.data = devmem;
result = devm_memremap_pages(devmem->device, &devmem->pagemap);
if (IS_ERR(result))