[RESEND PATCH 2/2] drm/armada: Replace drm_framebuffer_reference/unreference() with _get/put()

Sean Paul seanpaul at chromium.org
Mon Oct 16 19:03:30 UTC 2017


On Wed, Sep 20, 2017 at 12:01:39PM -0700, Sean Paul wrote:
> On Wed, Sep 20, 2017 at 11:57 AM, Haneen Mohammed
> <hamohammed.sa at gmail.com> wrote:
> > This patch replace instances of drm_framebuffer_reference/unreference with
> > *_get/put() suffixes, because get/put is shorter and consistent with the
> > kernel use of *_get/put suffixes.
> > This was done with the following Coccinelle script:
> >
> > @r1@
> > expression e;
> > @@
> >
> > (
> > -drm_framebuffer_reference(e);
> > +drm_framebuffer_get(e);
> > |
> > -drm_framebuffer_unreference(e);
> > +drm_framebuffer_put(e);
> > )
> >
> > Signed-off-by: Haneen Mohammed <hamohammed.sa at gmail.com>
> 
> Reviewed-by: Sean Paul <seanpaul at chromium.org>

Applied to drm-misc-next

Thanks for your patch!

Sean

> 
> > ---
> >  drivers/gpu/drm/armada/armada_crtc.c    | 14 +++++++-------
> >  drivers/gpu/drm/armada/armada_drv.c     |  2 +-
> >  drivers/gpu/drm/armada/armada_overlay.c |  4 ++--
> >  3 files changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
> > index 381dfa1..2e065fa 100644
> > --- a/drivers/gpu/drm/armada/armada_crtc.c
> > +++ b/drivers/gpu/drm/armada/armada_crtc.c
> > @@ -298,7 +298,7 @@ static void armada_drm_crtc_finish_fb(struct armada_crtc *dcrtc,
> >
> >         if (force) {
> >                 /* Display is disabled, so just drop the old fb */
> > -               drm_framebuffer_unreference(fb);
> > +               drm_framebuffer_put(fb);
> >                 return;
> >         }
> >
> > @@ -321,7 +321,7 @@ static void armada_drm_crtc_finish_fb(struct armada_crtc *dcrtc,
> >          * the best.  The worst that will happen is the buffer gets
> >          * reused before it has finished being displayed.
> >          */
> > -       drm_framebuffer_unreference(fb);
> > +       drm_framebuffer_put(fb);
> >  }
> >
> >  static void armada_drm_vblank_off(struct armada_crtc *dcrtc)
> > @@ -577,7 +577,7 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
> >         unsigned i;
> >         bool interlaced;
> >
> > -       drm_framebuffer_reference(crtc->primary->fb);
> > +       drm_framebuffer_get(crtc->primary->fb);
> >
> >         interlaced = !!(adj->flags & DRM_MODE_FLAG_INTERLACE);
> >
> > @@ -718,7 +718,7 @@ static int armada_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
> >                                    MAX_SCHEDULE_TIMEOUT);
> >
> >         /* Take a reference to the new fb as we're using it */
> > -       drm_framebuffer_reference(crtc->primary->fb);
> > +       drm_framebuffer_get(crtc->primary->fb);
> >
> >         /* Update the base in the CRTC */
> >         armada_drm_crtc_update_regs(dcrtc, regs);
> > @@ -742,7 +742,7 @@ void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc,
> >          * primary plane.
> >          */
> >         if (plane->fb)
> > -               drm_framebuffer_unreference(plane->fb);
> > +               drm_framebuffer_put(plane->fb);
> >
> >         /* Power down the Y/U/V FIFOs */
> >         sram_para1 = CFG_PDWN16x66 | CFG_PDWN32x66;
> > @@ -1045,12 +1045,12 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,
> >          * Ensure that we hold a reference on the new framebuffer.
> >          * This has to match the behaviour in mode_set.
> >          */
> > -       drm_framebuffer_reference(fb);
> > +       drm_framebuffer_get(fb);
> >
> >         ret = armada_drm_crtc_queue_frame_work(dcrtc, work);
> >         if (ret) {
> >                 /* Undo our reference above */
> > -               drm_framebuffer_unreference(fb);
> > +               drm_framebuffer_put(fb);
> >                 kfree(work);
> >                 return ret;
> >         }
> > diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
> > index 0b3227c..c993bcc 100644
> > --- a/drivers/gpu/drm/armada/armada_drv.c
> > +++ b/drivers/gpu/drm/armada/armada_drv.c
> > @@ -26,7 +26,7 @@ static void armada_drm_unref_work(struct work_struct *work)
> >         struct drm_framebuffer *fb;
> >
> >         while (kfifo_get(&priv->fb_unref, &fb))
> > -               drm_framebuffer_unreference(fb);
> > +               drm_framebuffer_put(fb);
> >  }
> >
> >  /* Must be called with dev->event_lock held */
> > diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
> > index edc4491..b411b60 100644
> > --- a/drivers/gpu/drm/armada/armada_overlay.c
> > +++ b/drivers/gpu/drm/armada/armada_overlay.c
> > @@ -177,7 +177,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
> >                  * Take a reference on the new framebuffer - we want to
> >                  * hold on to it while the hardware is displaying it.
> >                  */
> > -               drm_framebuffer_reference(fb);
> > +               drm_framebuffer_get(fb);
> >
> >                 if (plane->fb)
> >                         armada_ovl_retire_fb(dplane, plane->fb);
> > @@ -278,7 +278,7 @@ static int armada_ovl_plane_disable(struct drm_plane *plane,
> >
> >         fb = xchg(&dplane->old_fb, NULL);
> >         if (fb)
> > -               drm_framebuffer_unreference(fb);
> > +               drm_framebuffer_put(fb);
> >
> >         return 0;
> >  }
> > --
> > 2.7.4
> >

-- 
Sean Paul, Software Engineer, Google / Chromium OS


More information about the dri-devel mailing list