drm/i915: prefer i915_gem_object_has_pages()
authorMatthew Auld <matthew.auld@intel.com>
Mon, 18 Dec 2017 10:38:55 +0000 (10:38 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 18 Dec 2017 11:53:29 +0000 (11:53 +0000)
We have an existing helper for testing obj->mm.pages, so use it.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20171218103855.25274-1-matthew.auld@intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/selftests/huge_pages.c

index dca15c13af356226606c3942c2e3490fda79efca..5b4cfb20de973131e6b9b3650ad54bf623b8104e 100644 (file)
@@ -2596,7 +2596,7 @@ static int ____i915_gem_object_get_pages(struct drm_i915_gem_object *obj)
        }
 
        err = obj->ops->get_pages(obj);
-       GEM_BUG_ON(!err && IS_ERR_OR_NULL(obj->mm.pages));
+       GEM_BUG_ON(!err && !i915_gem_object_has_pages(obj));
 
        return err;
 }
index e6b31041cc881ecc0235508ad0d11698a4bddc49..2ea69394f42839f8ede1cc9475cd9ee9c16ba983 100644 (file)
@@ -1637,7 +1637,7 @@ static int igt_shrink_thp(void *arg)
         * shmem to truncate our pages.
         */
        i915_gem_shrink_all(i915);
-       if (!IS_ERR_OR_NULL(obj->mm.pages)) {
+       if (i915_gem_object_has_pages(obj)) {
                pr_err("shrink-all didn't truncate the pages\n");
                err = -EINVAL;
                goto out_close;