Skip to contentSkip to conversation

drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()

PATCH Superseded Harsha Sharma 5 participants 5 messages Oct 8, 2017 – Oct 9, 2017

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()

Replace instances of drm_framebuffer_reference/unreference() with *_get/put() suffixes and drm_dev_unref with *_put() suffix because get/put is shorter and consistent with the kernel use of *_get/put suffixes.
Done with following coccinelle semantic patch

@@
expression ex;
@@

(
-drm_framebuffer_unreference(ex);
+drm_framebuffer_put(ex);
|
-drm_dev_unref(ex);
+drm_dev_put(ex);
|
-drm_framebuffer_reference(ex);
+drm_framebuffer_get(ex);
)

---
Changes in v3:
-Removed changes in selftests
Changes in v2:
-Added cocinelle patch in log message
-cc to all driver-specific mailing lists

 drivers/gpu/drm/i915/i915_pci.c      |  2 +-
 drivers/gpu/drm/i915/intel_display.c | 10 +++++-----
 drivers/gpu/drm/i915/intel_fbdev.c   |  4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_pci.c +1 -1
index 09d97e0990b7..2f106cca46b4 100644
@@ -510,7 +510,7 @@ static void i915_pci_remove(struct pci_dev *pdev)
 	struct drm_device *dev = pci_get_drvdata(pdev);
 
 	i915_driver_unload(dev);
-	drm_dev_unref(dev);
+	drm_dev_put(dev);
 }
 
 static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
drivers/gpu/drm/i915/intel_display.c +5 -5
index f17275519484..92f83045878f 100644
@@ -2856,7 +2856,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
 
 		if (intel_plane_ggtt_offset(state) == plane_config->base) {
 			fb = c->primary->fb;
-			drm_framebuffer_reference(fb);
+			drm_framebuffer_get(fb);
 			goto valid_fb;
 		}
 	}
@@ -2887,7 +2887,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
 			  intel_crtc->pipe, PTR_ERR(intel_state->vma));
 
 		intel_state->vma = NULL;
-		drm_framebuffer_unreference(fb);
+		drm_framebuffer_put(fb);
 		return;
 	}
 
@@ -2908,7 +2908,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
 	if (i915_gem_object_is_tiled(obj))
 		dev_priv->preserve_bios_swizzle = true;
 
-	drm_framebuffer_reference(fb);
+	drm_framebuffer_get(fb);
 	primary->fb = primary->state->fb = fb;
 	primary->crtc = primary->state->crtc = &intel_crtc->base;
 
@@ -9847,7 +9847,7 @@ mode_fits_in_fbdev(struct drm_device *dev,
 	if (obj->base.size < mode->vdisplay * fb->pitches[0])
 		return NULL;
 
-	drm_framebuffer_reference(fb);
+	drm_framebuffer_get(fb);
 	return fb;
 #else
 	return NULL;
@@ -10028,7 +10028,7 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,
 	if (ret)
 		goto fail;
 
-	drm_framebuffer_unreference(fb);
+	drm_framebuffer_put(fb);
 
 	ret = drm_atomic_set_mode_for_crtc(&crtc_state->base, mode);
 	if (ret)
drivers/gpu/drm/i915/intel_fbdev.c +2 -2
index 262e75c00dd2..1ff714935c38 100644
@@ -189,7 +189,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
 			      " releasing it\n",
 			      intel_fb->base.width, intel_fb->base.height,
 			      sizes->fb_width, sizes->fb_height);
-		drm_framebuffer_unreference(&intel_fb->base);
+		drm_framebuffer_put(&intel_fb->base);
 		intel_fb = ifbdev->fb = NULL;
 	}
 	if (!intel_fb || WARN_ON(!intel_fb->obj)) {
@@ -624,7 +624,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
 	ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
 	ifbdev->fb = fb;
 
-	drm_framebuffer_reference(&ifbdev->fb->base);
+	drm_framebuffer_put(&ifbdev->fb->base);
 
 	/* Final pass to check if any active pipes don't have fbs */
 	for_each_crtc(dev, crtc) {
Signature · 1 line
2.11.0
#1 lore raw

✗ Fi.CI.BAT: failure for drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put() (rev2)

== Series Details ==

== Series Details ==

Series: drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put() (rev2)
URL : https://patchwork.freedesktop.org/series/31283/
State : failure

== Summary ==

Series 31283v2 drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()
https://patchwork.freedesktop.org/api/1.0/series/31283/revisions/2/mbox/

Test gem_exec_suspend:

        Subgroup basic-s3:
                pass       -> INCOMPLETE (fi-ivb-3770)
                pass       -> INCOMPLETE (fi-byt-j1900)
                pass       -> INCOMPLETE (fi-hsw-4770)
                pass       -> INCOMPLETE (fi-hsw-4770r)
Test gem_ringfill:
        Subgroup basic-default:
                skip       -> PASS       (fi-bsw-n3050)
        Subgroup basic-default-hang:
                dmesg-warn -> INCOMPLETE (fi-pnv-d510) fdo#101600
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-a:
                pass       -> DMESG-WARN (fi-skl-6700k)
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> PASS       (fi-skl-6700k) fdo#100367
Test drv_module_reload:
        Subgroup basic-no-display:
                dmesg-warn -> PASS       (fi-cfl-s) fdo#103022

fdo#101600 https://bugs.freedesktop.org/show_bug.cgi?id=101600
fdo#100367 https://bugs.freedesktop.org/show_bug.cgi?id=100367
fdo#103022 https://bugs.freedesktop.org/show_bug.cgi?id=103022

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:455s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:471s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:396s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:565s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:287s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:521s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:522s
fi-byt-j1900     total:118  pass:96   dwarn:0   dfail:0   fail:0   skip:21 
fi-cfl-s         total:289  pass:256  dwarn:1   dfail:0   fail:0   skip:32  time:564s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:620s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:431s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:597s
fi-hsw-4770      total:118  pass:100  dwarn:0   dfail:0   fail:0   skip:17 
fi-hsw-4770r     total:118  pass:100  dwarn:0   dfail:0   fail:0   skip:17 
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:508s
fi-ivb-3770      total:118  pass:96   dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:502s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:578s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:489s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:591s
fi-pnv-d510      total:156  pass:113  dwarn:0   dfail:0   fail:0   skip:42 
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:465s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:653s
fi-skl-6700k     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:526s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:564s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:473s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:579s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:436s

36006288fba389b08bbfb73a89da8eced404dfed drm-tip: 2017y-10m-07d-09h-13m-34s UTC integration manifest cd4b24cbf5e4 drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5942/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Harsha Sharma

Quoting Harsha Sharma (2017-10-08 15:04:07)

drivers/gpu/drm/i915/intel_fbdev.c static bool intel_fbdev_init_bios(struct drm_device *dev, · line 627

Quoted 6 lines
drivers/gpu/drm/i915/intel_fbdev.c +1 -1
@@ -624,7 +624,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
        ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
        ifbdev->fb = fb;
 
-       drm_framebuffer_reference(&ifbdev->fb->base);
+       drm_framebuffer_put(&ifbdev->fb->base);

Whoops.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 9 lines · Chris Wilson

Quoting Harsha Sharma (2017-10-08 15:04:07)

drivers/gpu/drm/i915/intel_fbdev.c static bool intel_fbdev_init_bios(struct drm_device *dev, · line 627

Quoted 6 lines
drivers/gpu/drm/i915/intel_fbdev.c +1 -1
@@ -624,7 +624,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
        ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
        ifbdev->fb = fb;
 
-       drm_framebuffer_reference(&ifbdev->fb->base);
+       drm_framebuffer_put(&ifbdev->fb->base);

Whoops.

Hm yeah, how did this happen? Does cocci really do this, or is that an accident from manually fixing stuff up?
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
Quoted 6 lines · Daniel Vetter
Quoted 5 lines · Chris Wilson

Quoting Harsha Sharma (2017-10-08 15:04:07)

Quoted 4 lines
drivers/gpu/drm/i915/intel_fbdev.c +0 -0
@@ -624,7 +624,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
        ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
        ifbdev->fb = fb;
 
Quoted 7 lines
Quoted 4 lines

drivers/gpu/drm/i915/intel_fbdev.c static bool intel_fbdev_init_bios(struct drm_device *dev, · line 627

Quoted 2 lines
drivers/gpu/drm/i915/intel_fbdev.c +1 -1
-       drm_framebuffer_reference(&ifbdev->fb->base);
+       drm_framebuffer_put(&ifbdev->fb->base);

Whoops.

Hm yeah, how did this happen? Does cocci really do this, or is that an accident from manually fixing stuff up?

Running the spatch from the commit message gives me the correct substitution:
@@ -627,7 +627,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,

        ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8;
        ifbdev->fb = fb;

- drm_framebuffer_reference(&ifbdev->fb->base);
+ drm_framebuffer_get(&ifbdev->fb->base);

        /* Final pass to check if any active pipes don't have fbs */
        for_each_crtc(dev, crtc) {

Probably just finger slip since this is the last chunk before the omitted selftests changes.

Harsha: the "better" way to omit the selftests without hand tuning the patch would be to run the cocci spatch on i915 as normal, and then run "git checkout -- drivers/gpu/drm/i915/selftests/" before committing. It's dangerous to edit patches by hand, or to misrepresent a patch as being the result of a cocci spatch when it's not.

Sean

Quoted 5 lines

-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch