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>
This commit is contained in:
Christoph Hellwig 2019-06-26 14:27:12 +02:00 committed by Jason Gunthorpe
parent 897e6365cd
commit 80a72d0af0
4 changed files with 8 additions and 8 deletions

View File

@ -334,7 +334,7 @@ static void pmem_release_disk(void *__pmem)
put_disk(pmem->disk); put_disk(pmem->disk);
} }
static void pmem_pagemap_page_free(struct page *page, void *data) static void pmem_pagemap_page_free(struct page *page)
{ {
wake_up_var(&page->_refcount); wake_up_var(&page->_refcount);
} }

View File

@ -69,7 +69,7 @@ struct dev_pagemap_ops {
* reach 0 refcount unless there is a refcount bug. This allows the * reach 0 refcount unless there is a refcount bug. This allows the
* device driver to implement its own memory management.) * device driver to implement its own memory management.)
*/ */
void (*page_free)(struct page *page, void *data); void (*page_free)(struct page *page);
/* /*
* Transition the refcount in struct dev_pagemap to the dead state. * Transition the refcount in struct dev_pagemap to the dead state.
@ -104,7 +104,6 @@ struct dev_pagemap {
struct resource res; struct resource res;
struct percpu_ref *ref; struct percpu_ref *ref;
struct device *dev; struct device *dev;
void *data;
enum memory_type type; enum memory_type type;
u64 pci_p2pdma_bus_offset; u64 pci_p2pdma_bus_offset;
const struct dev_pagemap_ops *ops; const struct dev_pagemap_ops *ops;

View File

@ -376,7 +376,7 @@ void __put_devmap_managed_page(struct page *page)
mem_cgroup_uncharge(page); mem_cgroup_uncharge(page);
page->pgmap->ops->page_free(page, page->pgmap->data); page->pgmap->ops->page_free(page);
} else if (!count) } else if (!count)
__put_page(page); __put_page(page);
} }

View File

@ -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) 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, return devmem->ops->fault(devmem, vmf->vma, vmf->address, vmf->page,
vmf->flags, vmf->pmd); 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); 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.ops = &hmm_pagemap_ops;
devmem->pagemap.altmap_valid = false; devmem->pagemap.altmap_valid = false;
devmem->pagemap.ref = &devmem->ref; devmem->pagemap.ref = &devmem->ref;
devmem->pagemap.data = devmem;
result = devm_memremap_pages(devmem->device, &devmem->pagemap); result = devm_memremap_pages(devmem->device, &devmem->pagemap);
if (IS_ERR(result)) if (IS_ERR(result))