drm/gma500: Use to_gtt_range() everywhere
authorThomas Zimmermann <tzimmermann@suse.de>
Fri, 15 Oct 2021 08:40:45 +0000 (10:40 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Tue, 19 Oct 2021 08:31:32 +0000 (10:31 +0200)
Convert upcasts from struct drm_gem_object to struct gtt_range to
to_gtt_range(). Some places used container_of() directly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211015084053.13708-3-tzimmermann@suse.de
drivers/gpu/drm/gma500/gem.c
drivers/gpu/drm/gma500/gma_display.c

index a41990d..b529083 100644 (file)
@@ -117,7 +117,7 @@ static vm_fault_t psb_gem_fault(struct vm_fault *vmf);
 
 static void psb_gem_free_object(struct drm_gem_object *obj)
 {
-       struct gtt_range *gtt = container_of(obj, struct gtt_range, gem);
+       struct gtt_range *gtt = to_gtt_range(obj);
 
        /* Remove the list map if one is present */
        drm_gem_free_mmap_offset(obj);
@@ -267,7 +267,7 @@ static vm_fault_t psb_gem_fault(struct vm_fault *vmf)
        dev = obj->dev;
        dev_priv = to_drm_psb_private(dev);
 
-       r = container_of(obj, struct gtt_range, gem);   /* Get the gtt range */
+       r = to_gtt_range(obj);
 
        /* Make sure we don't parallel update on a fault, nor move or remove
           something from beneath our feet */
index ecf8153..8285358 100644 (file)
@@ -349,8 +349,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
 
                /* Unpin the old GEM object */
                if (gma_crtc->cursor_obj) {
-                       gt = container_of(gma_crtc->cursor_obj,
-                                         struct gtt_range, gem);
+                       gt = to_gtt_range(gma_crtc->cursor_obj);
                        psb_gtt_unpin(gt);
                        drm_gem_object_put(gma_crtc->cursor_obj);
                        gma_crtc->cursor_obj = NULL;
@@ -376,7 +375,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
                goto unref_cursor;
        }
 
-       gt = container_of(obj, struct gtt_range, gem);
+       gt = to_gtt_range(obj);
 
        /* Pin the memory into the GTT */
        ret = psb_gtt_pin(gt);
@@ -426,7 +425,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
 
        /* unpin the old bo */
        if (gma_crtc->cursor_obj) {
-               gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem);
+               gt = to_gtt_range(gma_crtc->cursor_obj);
                psb_gtt_unpin(gt);
                drm_gem_object_put(gma_crtc->cursor_obj);
        }