]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915: Switch to bitmap_zalloc()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 4 Mar 2019 09:29:08 +0000 (11:29 +0200)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 20 Mar 2019 17:50:35 +0000 (17:50 +0000)
Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190304092908.57382-2-andriy.shevchenko@linux.intel.com
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_fence_reg.c
drivers/gpu/drm/i915/i915_gem_tiling.c
drivers/gpu/drm/i915/selftests/intel_uncore.c

index b7086c8d472639b2f8de608d37a501b8643c2f19..92389825a7ff3ead79991a120a8125725f296398 100644 (file)
@@ -4195,7 +4195,7 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,
                drm_gem_object_release(&obj->base);
                i915_gem_info_remove_obj(i915, obj->base.size);
 
-               kfree(obj->bit_17);
+               bitmap_free(obj->bit_17);
                i915_gem_object_free(obj);
 
                GEM_BUG_ON(!atomic_read(&i915->mm.free_count));
index 9418ad499b7e5c1a4474ff735892ba81f29465ec..3084f52e337283cfcab4f03b21786db9573882dc 100644 (file)
@@ -765,8 +765,7 @@ i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj,
        int i;
 
        if (obj->bit_17 == NULL) {
-               obj->bit_17 = kcalloc(BITS_TO_LONGS(page_count),
-                                     sizeof(long), GFP_KERNEL);
+               obj->bit_17 = bitmap_zalloc(page_count, GFP_KERNEL);
                if (obj->bit_17 == NULL) {
                        DRM_ERROR("Failed to allocate memory for bit 17 "
                                  "record\n");
index 16cc9ddbce34ae8e97e59838c2e687af6a0f52f9..a9b5329dae3bc34b08b1ddaf3f03bdc7527e54b9 100644 (file)
@@ -301,11 +301,11 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj,
        /* Try to preallocate memory required to save swizzling on put-pages */
        if (i915_gem_object_needs_bit17_swizzle(obj)) {
                if (!obj->bit_17) {
-                       obj->bit_17 = kcalloc(BITS_TO_LONGS(obj->base.size >> PAGE_SHIFT),
-                                             sizeof(long), GFP_KERNEL);
+                       obj->bit_17 = bitmap_zalloc(obj->base.size >> PAGE_SHIFT,
+                                                   GFP_KERNEL);
                }
        } else {
-               kfree(obj->bit_17);
+               bitmap_free(obj->bit_17);
                obj->bit_17 = NULL;
        }
 
index 099486235936b93bbcb1aadb3384edaee4de7e30..f9f5672b27c412ffbc68dcb26522f25fdc316dd5 100644 (file)
@@ -258,8 +258,7 @@ static int live_forcewake_domains(void *arg)
        if (!IS_ENABLED(CONFIG_DRM_I915_SELFTEST_BROKEN))
                return 0;
 
-       valid = kcalloc(BITS_TO_LONGS(FW_RANGE), sizeof(*valid),
-                       GFP_KERNEL);
+       valid = bitmap_zalloc(FW_RANGE, GFP_KERNEL);
        if (!valid)
                return -ENOMEM;
 
@@ -294,7 +293,7 @@ static int live_forcewake_domains(void *arg)
                }
        }
 
-       kfree(valid);
+       bitmap_free(valid);
        return err;
 }