[PATCH -next] drm/i915/gt: Make use of __assign_bit() API

Hongbo Li lihongbo22 at huawei.com
Mon Sep 2 13:10:08 UTC 2024


We have for some time the __assign_bit() API to replace
open coded
    if (foo)
        __set_bit(n, bar);
    else
        __clear_bit(n, bar);

Use this API to simplify the code. No functional change
intended.

Signed-off-by: Hongbo Li <lihongbo22 at huawei.com>
---
 drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c b/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
index 0ffba50981e3..4380e6f9d0ab 100644
--- a/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
+++ b/drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
@@ -827,10 +827,7 @@ i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj,
 	i = 0;
 
 	for_each_sgt_page(page, sgt_iter, pages) {
-		if (page_to_phys(page) & (1 << 17))
-			__set_bit(i, obj->bit_17);
-		else
-			__clear_bit(i, obj->bit_17);
+		__assign_bit(i, obj->bit_17, page_to_phys(page) & (1 << 17));
 		i++;
 	}
 }
-- 
2.34.1



More information about the dri-devel mailing list