From: Cihangir Akturk <cakturk@gmail.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
David Airlie <airlied@linux.ie>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 12/29] drm/i915: switch to drm_*{get,put} helpers
Date: Thu, 3 Aug 2017 18:36:16 +0300 [thread overview]
Message-ID: <20170803153616.GA629@mbp> (raw)
In-Reply-To: <87lgn0hm7a.fsf@nikula.org>
On Thu, Aug 03, 2017 at 03:26:01PM +0300, Jani Nikula wrote:
> On Thu, 03 Aug 2017, Cihangir Akturk <cakturk@gmail.com> wrote:
> > drm_*_reference() and drm_*_unreference() functions are just
> > compatibility alias for drm_*_get() and drm_*_put() adn should not be
> > used by new code. So convert all users of compatibility functions to use
> > the new APIs.
>
> Please include the cocci script in the commit message. If you didn't use
> cocci, you should check it out! :)
Indeed I used a simple shell script, which I included in the cover
letter. But the cover letter doesn't seem to show up in the mailing
list archives for some reason. I think I have done something wrong.
The script I use is like:
path=$1
do_replace() {
local pattern=$1
local replacement=$2
git grep -lw "${pattern}" -- "${path}/*.[hc]" |\
xargs -r sed -i "s/\b$pattern\b/$replacement/g"
}
do_replace drm_mode_object_reference drm_mode_object_get
do_replace drm_mode_object_unreference drm_mode_object_put
do_replace drm_connector_reference drm_connector_get
do_replace drm_connector_unreference drm_connector_put
do_replace drm_framebuffer_reference drm_framebuffer_get
do_replace drm_framebuffer_unreference drm_framebuffer_put
do_replace drm_gem_object_reference drm_gem_object_get
do_replace drm_gem_object_unreference drm_gem_object_put
do_replace __drm_gem_object_unreference __drm_gem_object_put
do_replace drm_gem_object_unreference_unlocked drm_gem_object_put_unlocked
do_replace drm_property_reference_blob drm_property_blob_get
do_replace drm_property_unreference_blob drm_property_blob_put
I had used the coccinelle in report mode for staging tree. It reported
about staging: vboxvideo driver. In this way I saw there is a need to
change to the new APIs.
I used my own script because I haven't used coccinelle in patch mode
before.
>
> BR,
> Jani.
>
> >
> > Signed-off-by: Cihangir Akturk <cakturk@gmail.com>
> > ---
> > drivers/gpu/drm/i915/i915_gem_object.h | 10 +++++-----
> > drivers/gpu/drm/i915/intel_display.c | 24 ++++++++++++------------
> > drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
> > drivers/gpu/drm/i915/intel_fbdev.c | 4 ++--
> > 4 files changed, 20 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem_object.h b/drivers/gpu/drm/i915/i915_gem_object.h
> > index 5b19a49..8f6c915 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_object.h
> > +++ b/drivers/gpu/drm/i915/i915_gem_object.h
> > @@ -257,25 +257,25 @@ __attribute__((nonnull))
> > static inline struct drm_i915_gem_object *
> > i915_gem_object_get(struct drm_i915_gem_object *obj)
> > {
> > - drm_gem_object_reference(&obj->base);
> > + drm_gem_object_get(&obj->base);
> > return obj;
> > }
> >
> > __deprecated
> > -extern void drm_gem_object_reference(struct drm_gem_object *);
> > +extern void drm_gem_object_get(struct drm_gem_object *);
> >
> > __attribute__((nonnull))
> > static inline void
> > i915_gem_object_put(struct drm_i915_gem_object *obj)
> > {
> > - __drm_gem_object_unreference(&obj->base);
> > + __drm_gem_object_put(&obj->base);
> > }
> >
> > __deprecated
> > -extern void drm_gem_object_unreference(struct drm_gem_object *);
> > +extern void drm_gem_object_put(struct drm_gem_object *);
> >
> > __deprecated
> > -extern void drm_gem_object_unreference_unlocked(struct drm_gem_object *);
> > +extern void drm_gem_object_put_unlocked(struct drm_gem_object *);
> >
> > static inline void i915_gem_object_lock(struct drm_i915_gem_object *obj)
> > {
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index dec9e58..b4d03cf 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -2672,10 +2672,10 @@ update_state_fb(struct drm_plane *plane)
> > return;
> >
> > if (plane->state->fb)
> > - drm_framebuffer_unreference(plane->state->fb);
> > + drm_framebuffer_put(plane->state->fb);
> > plane->state->fb = plane->fb;
> > if (plane->state->fb)
> > - drm_framebuffer_reference(plane->state->fb);
> > + drm_framebuffer_get(plane->state->fb);
> > }
> >
> > static void
> > @@ -2746,7 +2746,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;
> > }
> > }
> > @@ -2777,7 +2777,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;
> > }
> >
> > @@ -2798,7 +2798,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;
> >
> > @@ -9668,7 +9668,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;
> > @@ -9849,7 +9849,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)
> > @@ -10159,7 +10159,7 @@ static void intel_unpin_work_fn(struct work_struct *__work)
> > intel_frontbuffer_flip_complete(to_i915(dev),
> > to_intel_plane(primary)->frontbuffer_bit);
> > intel_fbc_post_update(crtc);
> > - drm_framebuffer_unreference(work->old_fb);
> > + drm_framebuffer_put(work->old_fb);
> >
> > BUG_ON(atomic_read(&crtc->unpin_work_count) == 0);
> > atomic_dec(&crtc->unpin_work_count);
> > @@ -10799,7 +10799,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
> > flush_workqueue(dev_priv->wq);
> >
> > /* Reference the objects for the scheduled work. */
> > - drm_framebuffer_reference(work->old_fb);
> > + drm_framebuffer_get(work->old_fb);
> >
> > crtc->primary->fb = fb;
> > update_state_fb(crtc->primary);
> > @@ -10913,7 +10913,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
> > update_state_fb(crtc->primary);
> >
> > i915_gem_object_put(obj);
> > - drm_framebuffer_unreference(work->old_fb);
> > + drm_framebuffer_put(work->old_fb);
> >
> > spin_lock_irq(&dev->event_lock);
> > intel_crtc->flip_work = NULL;
> > @@ -11237,7 +11237,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
> > drm_connector_list_iter_begin(dev, &conn_iter);
> > for_each_intel_connector_iter(connector, &conn_iter) {
> > if (connector->base.state->crtc)
> > - drm_connector_unreference(&connector->base);
> > + drm_connector_put(&connector->base);
> >
> > if (connector->base.encoder) {
> > connector->base.state->best_encoder =
> > @@ -11245,7 +11245,7 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
> > connector->base.state->crtc =
> > connector->base.encoder->crtc;
> >
> > - drm_connector_reference(&connector->base);
> > + drm_connector_get(&connector->base);
> > } else {
> > connector->base.state->best_encoder = NULL;
> > connector->base.state->crtc = NULL;
> > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> > index 2cf046b..b942578 100644
> > --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> > @@ -524,7 +524,7 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
> > intel_connector->mst_port = NULL;
> > drm_modeset_unlock_all(dev);
> >
> > - drm_connector_unreference(&intel_connector->base);
> > + drm_connector_put(&intel_connector->base);
> > DRM_DEBUG_KMS("\n");
> > }
> >
> > diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> > index 0c4cde6..13fbe80 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)) {
> > @@ -650,7 +650,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) {
>
> --
> Jani Nikula, Intel Open Source Technology Center
next prev parent reply other threads:[~2017-08-03 15:36 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-03 11:58 [PATCH 00/29] DRM API conversions Cihangir Akturk
2017-08-03 11:58 ` [PATCH 01/29] drm/amdgpu: switch to drm_*{get,put} helpers Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 12:08 ` Christian König
2017-08-03 12:08 ` Christian König
2017-08-03 11:58 ` [PATCH 02/29] drm: mali-dp: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 14:02 ` Liviu Dudau
2017-08-03 11:58 ` [PATCH 03/29] drm/armada: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 04/29] drm/ast: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 05/29] drm/atmel-hlcdc: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 12:10 ` Boris Brezillon
2017-08-03 12:10 ` Boris Brezillon
2017-08-03 14:55 ` Boris Brezillon
2017-08-03 11:58 ` [PATCH 06/29] drm/bochs: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 07/29] drm/cirrus: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 08/29] drm/etnaviv: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 09/29] drm/exynos: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 10/29] drm/gma500: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 11/29] drm/hisilicon: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 12/29] drm/i915: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 12:26 ` Jani Nikula
2017-08-03 12:26 ` Jani Nikula
2017-08-03 12:49 ` Daniel Vetter
2017-08-03 12:49 ` Daniel Vetter
2017-08-03 15:52 ` Cihangir Akturk
2017-08-07 9:10 ` Daniel Vetter
2017-08-03 15:36 ` Cihangir Akturk [this message]
2017-08-04 8:18 ` [PATCH 12/29] drm/i915: switch to drm_*{get, put} helpers Jani Nikula
2017-08-04 8:18 ` [PATCH 12/29] drm/i915: switch to drm_*{get,put} helpers Jani Nikula
2017-08-03 11:58 ` [PATCH 13/29] drm/imx: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 14/29] drm/mediatek: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 15/29] drm/mgag200: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 16/29] drm/msm: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 17/29] drm/nouveau: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 13:05 ` Tobias Klausmann
2017-08-03 11:58 ` [PATCH 18/29] drm/omap: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 19/29] drm/qxl: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 20/29] drm/radeon: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
[not found] ` <1501761585-11757-21-git-send-email-cakturk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-03 12:08 ` Christian König
2017-08-03 12:08 ` Christian König
[not found] ` <b17a0800-e3be-0841-54ae-b5289590f312-5C7GfCeVMHo@public.gmane.org>
2017-08-03 16:27 ` Alex Deucher
2017-08-03 16:27 ` Alex Deucher
2017-08-03 11:58 ` [PATCH 21/29] drm/rockchip: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 22/29] drm/tegra: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 23/29] drm/tilcdc: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 13:56 ` Jyri Sarha
2017-08-03 13:56 ` Jyri Sarha
2017-08-03 15:42 ` Daniel Vetter
2017-08-03 17:37 ` Jyri Sarha
2017-08-03 17:37 ` Jyri Sarha
2017-08-03 11:58 ` [PATCH 24/29] drm/udl: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 25/29] drm/vc4: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-08 20:39 ` Eric Anholt
2017-08-08 20:39 ` Eric Anholt
2017-08-03 11:58 ` [PATCH 26/29] drm/vgem: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 27/29] drm/virtio: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 11:58 ` [PATCH 28/29] drm/vmwgfx: " Cihangir Akturk
2017-08-03 11:58 ` Cihangir Akturk
2017-08-03 12:40 ` Thomas Hellstrom
2017-08-03 13:06 ` Daniel Vetter
2017-08-03 13:06 ` Daniel Vetter
2017-08-03 11:58 ` [PATCH 29/29] staging: vboxvideo: " Cihangir Akturk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170803153616.GA629@mbp \
--to=cakturk@gmail.com \
--cc=airlied@linux.ie \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.