[PATCH v2 2/2] drm/tilcdc: replace reference/unreference() with get/put

Daniel Vetter daniel at ffwll.ch
Tue Sep 26 11:13:47 UTC 2017


On Tue, Sep 26, 2017 at 12:18:06PM +0300, Jyri Sarha wrote:
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
> On 09/26/17 11:30, Aishwarya Pant wrote:
> > For maintaining consistency with kernel coding style replace
> > reference/unreference in ref counting functions with get/put.
> > 
> > The following cocci script was used to generate the tilcdc 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: Aishwarya Pant <aishpant at gmail.com>
> 
> Acked-by: Jyri Sarha <jsarha at ti.com>
> 
> I guess this should go in via drm-misc at the same time with
> "drm: introduce drm_dev_{get/put} functions".

Yup, this one needs the previous one, both pushed to drm-misc-next.

Aishwarya, while reviewing your patches I've noticed that you've missed to
case of drm_dev_unref() in the drm core code, one in drm_pci.c and one in
drm_prime.c. Can you pls do a follow-up patch to address these two? Fixing
up the core completely is nice, drivers can be done later on (also by
others, this is a prefect newbies tasks). But making sure the core is
consistent is good I think.
-Daniel

> 
> Best regards,
> Jyri
> 
> 
> > ---
> > No changes in v2
> > 
> > drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 6 +++---
> >  drivers/gpu/drm/tilcdc/tilcdc_drv.c  | 2 +-
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> > index 406fe45..d2589f310 100644
> > --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> > +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
> > @@ -75,7 +75,7 @@ static void unref_worker(struct drm_flip_work *work, void *val)
> >  	struct drm_device *dev = tilcdc_crtc->base.dev;
> >  
> >  	mutex_lock(&dev->mode_config.mutex);
> > -	drm_framebuffer_unreference(val);
> > +	drm_framebuffer_put(val);
> >  	mutex_unlock(&dev->mode_config.mutex);
> >  }
> >  
> > @@ -456,7 +456,7 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *crtc)
> >  
> >  	set_scanout(crtc, fb);
> >  
> > -	drm_framebuffer_reference(fb);
> > +	drm_framebuffer_get(fb);
> >  
> >  	crtc->hwmode = crtc->state->adjusted_mode;
> >  }
> > @@ -633,7 +633,7 @@ int tilcdc_crtc_update_fb(struct drm_crtc *crtc,
> >  		return -EBUSY;
> >  	}
> >  
> > -	drm_framebuffer_reference(fb);
> > +	drm_framebuffer_get(fb);
> >  
> >  	crtc->primary->fb = fb;
> >  	tilcdc_crtc->event = event;
> > diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > index b0d70f9..74276ef 100644
> > --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > @@ -225,7 +225,7 @@ static void tilcdc_fini(struct drm_device *dev)
> >  
> >  	pm_runtime_disable(dev->dev);
> >  
> > -	drm_dev_unref(dev);
> > +	drm_dev_put(dev);
> >  }
> >  
> >  static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
> > 
> 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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


More information about the dri-devel mailing list