* [PATCH v3] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()
@ 2017-10-08 14:04 Harsha Sharma
2017-10-08 14:43 ` [Intel-gfx] " Chris Wilson
0 siblings, 1 reply; 4+ messages in thread
From: Harsha Sharma @ 2017-10-08 14:04 UTC (permalink / raw)
To: daniel.vetter, seanpaul, jani.nikula
Cc: intel-gfx, dri-devel, linux-kernel, outreachy-kernel, Harsha Sharma
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);
)
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
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(-)
diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 09d97e0990b7..2f106cca46b4 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -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)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index f17275519484..92f83045878f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -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)
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 262e75c00dd2..1ff714935c38 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -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) {
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Intel-gfx] [PATCH v3] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()
2017-10-08 14:04 [PATCH v3] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put() Harsha Sharma
@ 2017-10-08 14:43 ` Chris Wilson
2017-10-09 8:59 ` Daniel Vetter
0 siblings, 1 reply; 4+ messages in thread
From: Chris Wilson @ 2017-10-08 14:43 UTC (permalink / raw)
To: Harsha Sharma, daniel.vetter, seanpaul, jani.nikula
Cc: outreachy-kernel, intel-gfx, Harsha Sharma, linux-kernel, dri-devel
Quoting Harsha Sharma (2017-10-08 15:04:07)
> @@ -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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Intel-gfx] [PATCH v3] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()
2017-10-08 14:43 ` [Intel-gfx] " Chris Wilson
@ 2017-10-09 8:59 ` Daniel Vetter
2017-10-09 19:31 ` Sean Paul
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Vetter @ 2017-10-09 8:59 UTC (permalink / raw)
To: Chris Wilson
Cc: Harsha Sharma, daniel.vetter, seanpaul, jani.nikula,
outreachy-kernel, intel-gfx, dri-devel, linux-kernel
On Sun, Oct 08, 2017 at 03:43:35PM +0100, Chris Wilson wrote:
> Quoting Harsha Sharma (2017-10-08 15:04:07)
> > @@ -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
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Intel-gfx] [PATCH v3] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put()
2017-10-09 8:59 ` Daniel Vetter
@ 2017-10-09 19:31 ` Sean Paul
0 siblings, 0 replies; 4+ messages in thread
From: Sean Paul @ 2017-10-09 19:31 UTC (permalink / raw)
To: Chris Wilson, Harsha Sharma, Sean Paul, Jani Nikula,
outreachy-kernel, Intel Graphics Development, dri-devel,
Linux Kernel Mailing List
Cc: Daniel Vetter
On Mon, Oct 9, 2017 at 4:59 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Sun, Oct 08, 2017 at 03:43:35PM +0100, Chris Wilson wrote:
>> Quoting Harsha Sharma (2017-10-08 15:04:07)
>> > @@ -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?
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
> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-09 19:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-08 14:04 [PATCH v3] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put() Harsha Sharma
2017-10-08 14:43 ` [Intel-gfx] " Chris Wilson
2017-10-09 8:59 ` Daniel Vetter
2017-10-09 19:31 ` Sean Paul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).