Now that there is always a valid page pointer, we can deduce the owner
from the page.

Signed-off-by: Thomas Hellström <thomas.hellst...@linux.intel.com>
---
 drivers/gpu/drm/drm_pagemap.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c
index 8a0bdf38fc65..d1efcd78a023 100644
--- a/drivers/gpu/drm/drm_pagemap.c
+++ b/drivers/gpu/drm/drm_pagemap.c
@@ -62,7 +62,6 @@
  * @refcount: Reference count for the zdd
  * @devmem_allocation: device memory allocation
  * @dpagemap: Pointer to the struct drm_pagemap.
- * @device_private_page_owner: Device private pages owner
  *
  * This structure serves as a generic wrapper installed in
  * page->zone_device_data. It provides infrastructure for looking up a device
@@ -75,13 +74,11 @@ struct drm_pagemap_zdd {
        struct kref refcount;
        struct drm_pagemap_devmem *devmem_allocation;
        struct drm_pagemap *dpagemap;
-       void *device_private_page_owner;
 };
 
 /**
  * drm_pagemap_zdd_alloc() - Allocate a zdd structure.
  * @dpagemap: Pointer to the struct drm_pagemap.
- * @device_private_page_owner: Device private pages owner
  *
  * This function allocates and initializes a new zdd structure. It sets up the
  * reference count and initializes the destroy work.
@@ -89,7 +86,7 @@ struct drm_pagemap_zdd {
  * Return: Pointer to the allocated zdd on success, ERR_PTR() on failure.
  */
 static struct drm_pagemap_zdd *
-drm_pagemap_zdd_alloc(struct drm_pagemap *dpagemap, void 
*device_private_page_owner)
+drm_pagemap_zdd_alloc(struct drm_pagemap *dpagemap)
 {
        struct drm_pagemap_zdd *zdd;
 
@@ -99,7 +96,6 @@ drm_pagemap_zdd_alloc(struct drm_pagemap *dpagemap, void 
*device_private_page_ow
 
        kref_init(&zdd->refcount);
        zdd->devmem_allocation = NULL;
-       zdd->device_private_page_owner = device_private_page_owner;
        zdd->dpagemap = dpagemap;
 
        return zdd;
@@ -344,7 +340,7 @@ int drm_pagemap_migrate_to_devmem(struct drm_pagemap_devmem 
*devmem_allocation,
        dma_addr = buf + (2 * sizeof(*migrate.src) * npages);
        pages = buf + (2 * sizeof(*migrate.src) + sizeof(*dma_addr)) * npages;
 
-       zdd = drm_pagemap_zdd_alloc(devmem_allocation->dpagemap, pgmap_owner);
+       zdd = drm_pagemap_zdd_alloc(devmem_allocation->dpagemap);
        if (!zdd) {
                err = -ENOMEM;
                goto err_free;
@@ -628,8 +624,7 @@ EXPORT_SYMBOL_GPL(drm_pagemap_evict_to_ram);
 /**
  * __drm_pagemap_migrate_to_ram() - Migrate a virtual range to RAM (internal)
  * @vas: Pointer to the VM area structure
- * @device_private_page_owner: Device private pages owner
- * @page: Pointer to the page for fault handling (can be NULL)
+ * @page: Pointer to the page for fault handling.
  * @fault_addr: Fault address
  * @size: Size of migration
  *
@@ -641,14 +636,13 @@ EXPORT_SYMBOL_GPL(drm_pagemap_evict_to_ram);
  * 0 on success, negative error code on failure.
  */
 static int __drm_pagemap_migrate_to_ram(struct vm_area_struct *vas,
-                                       void *device_private_page_owner,
                                        struct page *page,
                                        unsigned long fault_addr,
                                        unsigned long size)
 {
        struct migrate_vma migrate = {
                .vma            = vas,
-               .pgmap_owner    = device_private_page_owner,
+               .pgmap_owner    = page->pgmap->owner,
                .flags          = MIGRATE_VMA_SELECT_DEVICE_PRIVATE |
                MIGRATE_VMA_SELECT_DEVICE_COHERENT,
                .fault_page     = page,
@@ -774,7 +768,6 @@ static vm_fault_t drm_pagemap_migrate_to_ram(struct 
vm_fault *vmf)
        int err;
 
        err = __drm_pagemap_migrate_to_ram(vmf->vma,
-                                          zdd->device_private_page_owner,
                                           vmf->page, vmf->address,
                                           zdd->devmem_allocation->size);
 
-- 
2.48.1

Reply via email to