* [RESEND PATCH 0/2] drm/armada: Replace _reference/unreference() with _get/put()
@ 2017-09-20 18:51 Haneen Mohammed
2017-09-20 18:54 ` [RESEND PATCH 1/2] drm/armada: Replace drm_gem_object_reference/unreference() " Haneen Mohammed
2017-09-20 18:57 ` [RESEND PATCH 2/2] drm/armada: Replace drm_framebuffer_reference/unreference() " Haneen Mohammed
0 siblings, 2 replies; 7+ messages in thread
From: Haneen Mohammed @ 2017-09-20 18:51 UTC (permalink / raw)
To: outreachy-kernel
Cc: hamohammed.sa, gregkh, Russell King, dri-devel, Daniel Vetter
This patchset replace instances of *_reference/unreference() with *_get/put(),
because get/put is shorter and consistent with the kernel use of *_get/put suffixes.
Haneen Mohammed (2):
drm/armada: Replace drm_gem_object_reference/unreference() with
_get/put()
drm/armada: Replace drm_framebuffer_reference/unreference() with
_get/put()
drivers/gpu/drm/armada/armada_crtc.c | 22 +++++++++++-----------
drivers/gpu/drm/armada/armada_drv.c | 2 +-
drivers/gpu/drm/armada/armada_fb.c | 8 ++++----
drivers/gpu/drm/armada/armada_fbdev.c | 6 +++---
drivers/gpu/drm/armada/armada_gem.c | 14 +++++++-------
drivers/gpu/drm/armada/armada_overlay.c | 4 ++--
6 files changed, 28 insertions(+), 28 deletions(-)
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread* [RESEND PATCH 1/2] drm/armada: Replace drm_gem_object_reference/unreference() with _get/put() 2017-09-20 18:51 [RESEND PATCH 0/2] drm/armada: Replace _reference/unreference() with _get/put() Haneen Mohammed @ 2017-09-20 18:54 ` Haneen Mohammed 2017-09-20 19:01 ` Sean Paul 2017-09-20 18:57 ` [RESEND PATCH 2/2] drm/armada: Replace drm_framebuffer_reference/unreference() " Haneen Mohammed 1 sibling, 1 reply; 7+ messages in thread From: Haneen Mohammed @ 2017-09-20 18:54 UTC (permalink / raw) To: outreachy-kernel Cc: hamohammed.sa, gregkh, Russell King, dri-devel, Daniel Vetter This patch replace instances of drm_gem_object_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_gem_object_reference(e); +drm_gem_object_get(e); | -drm_gem_object_unreference(e); +drm_gem_object_put(e); | -drm_gem_object_unreference_unlocked(e); +drm_gem_object_put_unlocked(e); ) Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com> --- drivers/gpu/drm/armada/armada_crtc.c | 8 ++++---- drivers/gpu/drm/armada/armada_fb.c | 8 ++++---- drivers/gpu/drm/armada/armada_fbdev.c | 6 +++--- drivers/gpu/drm/armada/armada_gem.c | 14 +++++++------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index 2a4d163..381dfa1 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c @@ -947,13 +947,13 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc, /* Must be a kernel-mapped object */ if (!obj->addr) { - drm_gem_object_unreference_unlocked(&obj->obj); + drm_gem_object_put_unlocked(&obj->obj); return -EINVAL; } if (obj->obj.size < w * h * 4) { DRM_ERROR("buffer is too small\n"); - drm_gem_object_unreference_unlocked(&obj->obj); + drm_gem_object_put_unlocked(&obj->obj); return -ENOMEM; } } @@ -961,7 +961,7 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc, if (dcrtc->cursor_obj) { dcrtc->cursor_obj->update = NULL; dcrtc->cursor_obj->update_data = NULL; - drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj); + drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj); } dcrtc->cursor_obj = obj; dcrtc->cursor_w = w; @@ -997,7 +997,7 @@ static void armada_drm_crtc_destroy(struct drm_crtc *crtc) struct armada_private *priv = crtc->dev->dev_private; if (dcrtc->cursor_obj) - drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj); + drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj); priv->dcrtc[dcrtc->num] = NULL; drm_crtc_cleanup(&dcrtc->crtc); diff --git a/drivers/gpu/drm/armada/armada_fb.c b/drivers/gpu/drm/armada/armada_fb.c index 92e6b08..51839c1 100644 --- a/drivers/gpu/drm/armada/armada_fb.c +++ b/drivers/gpu/drm/armada/armada_fb.c @@ -18,7 +18,7 @@ static void armada_fb_destroy(struct drm_framebuffer *fb) struct armada_framebuffer *dfb = drm_fb_to_armada_fb(fb); drm_framebuffer_cleanup(&dfb->fb); - drm_gem_object_unreference_unlocked(&dfb->obj->obj); + drm_gem_object_put_unlocked(&dfb->obj->obj); kfree(dfb); } @@ -95,7 +95,7 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev, * the above call, but the caller will drop their reference * to it. Hence we need to take our own reference. */ - drm_gem_object_reference(&obj->obj); + drm_gem_object_get(&obj->obj); return dfb; } @@ -144,12 +144,12 @@ static struct drm_framebuffer *armada_fb_create(struct drm_device *dev, goto err; } - drm_gem_object_unreference_unlocked(&obj->obj); + drm_gem_object_put_unlocked(&obj->obj); return &dfb->fb; err_unref: - drm_gem_object_unreference_unlocked(&obj->obj); + drm_gem_object_put_unlocked(&obj->obj); err: DRM_ERROR("failed to initialize framebuffer: %d\n", ret); return ERR_PTR(ret); diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c index 29c7d04..cf6bad1 100644 --- a/drivers/gpu/drm/armada/armada_fbdev.c +++ b/drivers/gpu/drm/armada/armada_fbdev.c @@ -52,13 +52,13 @@ static int armada_fb_create(struct drm_fb_helper *fbh, ret = armada_gem_linear_back(dev, obj); if (ret) { - drm_gem_object_unreference_unlocked(&obj->obj); + drm_gem_object_put_unlocked(&obj->obj); return ret; } ptr = armada_gem_map_object(dev, obj); if (!ptr) { - drm_gem_object_unreference_unlocked(&obj->obj); + drm_gem_object_put_unlocked(&obj->obj); return -ENOMEM; } @@ -68,7 +68,7 @@ static int armada_fb_create(struct drm_fb_helper *fbh, * A reference is now held by the framebuffer object if * successful, otherwise this drops the ref for the error path. */ - drm_gem_object_unreference_unlocked(&obj->obj); + drm_gem_object_put_unlocked(&obj->obj); if (IS_ERR(dfb)) return PTR_ERR(dfb); diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c index a76ca21..49d40aa 100644 --- a/drivers/gpu/drm/armada/armada_gem.c +++ b/drivers/gpu/drm/armada/armada_gem.c @@ -266,7 +266,7 @@ int armada_gem_dumb_create(struct drm_file *file, struct drm_device *dev, /* drop reference from allocate - handle holds it now */ DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle); err: - drm_gem_object_unreference_unlocked(&dobj->obj); + drm_gem_object_put_unlocked(&dobj->obj); return ret; } @@ -295,7 +295,7 @@ int armada_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, } err_unref: - drm_gem_object_unreference_unlocked(&obj->obj); + drm_gem_object_put_unlocked(&obj->obj); return ret; } @@ -334,7 +334,7 @@ int armada_gem_create_ioctl(struct drm_device *dev, void *data, /* drop reference from allocate - handle holds it now */ DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle); err: - drm_gem_object_unreference_unlocked(&dobj->obj); + drm_gem_object_put_unlocked(&dobj->obj); return ret; } @@ -351,13 +351,13 @@ int armada_gem_mmap_ioctl(struct drm_device *dev, void *data, return -ENOENT; if (!dobj->obj.filp) { - drm_gem_object_unreference_unlocked(&dobj->obj); + drm_gem_object_put_unlocked(&dobj->obj); return -EINVAL; } addr = vm_mmap(dobj->obj.filp, 0, args->size, PROT_READ | PROT_WRITE, MAP_SHARED, args->offset); - drm_gem_object_unreference_unlocked(&dobj->obj); + drm_gem_object_put_unlocked(&dobj->obj); if (IS_ERR_VALUE(addr)) return addr; @@ -412,7 +412,7 @@ int armada_gem_pwrite_ioctl(struct drm_device *dev, void *data, } unref: - drm_gem_object_unreference_unlocked(&dobj->obj); + drm_gem_object_put_unlocked(&dobj->obj); return ret; } @@ -561,7 +561,7 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf) * Importing our own dmabuf(s) increases the * refcount on the gem object itself. */ - drm_gem_object_reference(obj); + drm_gem_object_get(obj); return obj; } } -- 2.7.4 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [RESEND PATCH 1/2] drm/armada: Replace drm_gem_object_reference/unreference() with _get/put() 2017-09-20 18:54 ` [RESEND PATCH 1/2] drm/armada: Replace drm_gem_object_reference/unreference() " Haneen Mohammed @ 2017-09-20 19:01 ` Sean Paul 2017-10-16 19:03 ` Sean Paul 0 siblings, 1 reply; 7+ messages in thread From: Sean Paul @ 2017-09-20 19:01 UTC (permalink / raw) To: Haneen Mohammed Cc: Greg Kroah-Hartman, Russell King, dri-devel, outreachy-kernel, Daniel Vetter On Wed, Sep 20, 2017 at 11:54 AM, Haneen Mohammed <hamohammed.sa@gmail.com> wrote: > This patch replace instances of drm_gem_object_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_gem_object_reference(e); > +drm_gem_object_get(e); > | > -drm_gem_object_unreference(e); > +drm_gem_object_put(e); > | > -drm_gem_object_unreference_unlocked(e); > +drm_gem_object_put_unlocked(e); > ) > > Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> > --- > drivers/gpu/drm/armada/armada_crtc.c | 8 ++++---- > drivers/gpu/drm/armada/armada_fb.c | 8 ++++---- > drivers/gpu/drm/armada/armada_fbdev.c | 6 +++--- > drivers/gpu/drm/armada/armada_gem.c | 14 +++++++------- > 4 files changed, 18 insertions(+), 18 deletions(-) > > diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c > index 2a4d163..381dfa1 100644 > --- a/drivers/gpu/drm/armada/armada_crtc.c > +++ b/drivers/gpu/drm/armada/armada_crtc.c > @@ -947,13 +947,13 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc, > > /* Must be a kernel-mapped object */ > if (!obj->addr) { > - drm_gem_object_unreference_unlocked(&obj->obj); > + drm_gem_object_put_unlocked(&obj->obj); > return -EINVAL; > } > > if (obj->obj.size < w * h * 4) { > DRM_ERROR("buffer is too small\n"); > - drm_gem_object_unreference_unlocked(&obj->obj); > + drm_gem_object_put_unlocked(&obj->obj); > return -ENOMEM; > } > } > @@ -961,7 +961,7 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc, > if (dcrtc->cursor_obj) { > dcrtc->cursor_obj->update = NULL; > dcrtc->cursor_obj->update_data = NULL; > - drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj); > + drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj); > } > dcrtc->cursor_obj = obj; > dcrtc->cursor_w = w; > @@ -997,7 +997,7 @@ static void armada_drm_crtc_destroy(struct drm_crtc *crtc) > struct armada_private *priv = crtc->dev->dev_private; > > if (dcrtc->cursor_obj) > - drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj); > + drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj); > > priv->dcrtc[dcrtc->num] = NULL; > drm_crtc_cleanup(&dcrtc->crtc); > diff --git a/drivers/gpu/drm/armada/armada_fb.c b/drivers/gpu/drm/armada/armada_fb.c > index 92e6b08..51839c1 100644 > --- a/drivers/gpu/drm/armada/armada_fb.c > +++ b/drivers/gpu/drm/armada/armada_fb.c > @@ -18,7 +18,7 @@ static void armada_fb_destroy(struct drm_framebuffer *fb) > struct armada_framebuffer *dfb = drm_fb_to_armada_fb(fb); > > drm_framebuffer_cleanup(&dfb->fb); > - drm_gem_object_unreference_unlocked(&dfb->obj->obj); > + drm_gem_object_put_unlocked(&dfb->obj->obj); > kfree(dfb); > } > > @@ -95,7 +95,7 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev, > * the above call, but the caller will drop their reference > * to it. Hence we need to take our own reference. > */ > - drm_gem_object_reference(&obj->obj); > + drm_gem_object_get(&obj->obj); > > return dfb; > } > @@ -144,12 +144,12 @@ static struct drm_framebuffer *armada_fb_create(struct drm_device *dev, > goto err; > } > > - drm_gem_object_unreference_unlocked(&obj->obj); > + drm_gem_object_put_unlocked(&obj->obj); > > return &dfb->fb; > > err_unref: > - drm_gem_object_unreference_unlocked(&obj->obj); > + drm_gem_object_put_unlocked(&obj->obj); > err: > DRM_ERROR("failed to initialize framebuffer: %d\n", ret); > return ERR_PTR(ret); > diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c > index 29c7d04..cf6bad1 100644 > --- a/drivers/gpu/drm/armada/armada_fbdev.c > +++ b/drivers/gpu/drm/armada/armada_fbdev.c > @@ -52,13 +52,13 @@ static int armada_fb_create(struct drm_fb_helper *fbh, > > ret = armada_gem_linear_back(dev, obj); > if (ret) { > - drm_gem_object_unreference_unlocked(&obj->obj); > + drm_gem_object_put_unlocked(&obj->obj); > return ret; > } > > ptr = armada_gem_map_object(dev, obj); > if (!ptr) { > - drm_gem_object_unreference_unlocked(&obj->obj); > + drm_gem_object_put_unlocked(&obj->obj); > return -ENOMEM; > } > > @@ -68,7 +68,7 @@ static int armada_fb_create(struct drm_fb_helper *fbh, > * A reference is now held by the framebuffer object if > * successful, otherwise this drops the ref for the error path. > */ > - drm_gem_object_unreference_unlocked(&obj->obj); > + drm_gem_object_put_unlocked(&obj->obj); > > if (IS_ERR(dfb)) > return PTR_ERR(dfb); > diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c > index a76ca21..49d40aa 100644 > --- a/drivers/gpu/drm/armada/armada_gem.c > +++ b/drivers/gpu/drm/armada/armada_gem.c > @@ -266,7 +266,7 @@ int armada_gem_dumb_create(struct drm_file *file, struct drm_device *dev, > /* drop reference from allocate - handle holds it now */ > DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle); > err: > - drm_gem_object_unreference_unlocked(&dobj->obj); > + drm_gem_object_put_unlocked(&dobj->obj); > return ret; > } > > @@ -295,7 +295,7 @@ int armada_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, > } > > err_unref: > - drm_gem_object_unreference_unlocked(&obj->obj); > + drm_gem_object_put_unlocked(&obj->obj); > > return ret; > } > @@ -334,7 +334,7 @@ int armada_gem_create_ioctl(struct drm_device *dev, void *data, > /* drop reference from allocate - handle holds it now */ > DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle); > err: > - drm_gem_object_unreference_unlocked(&dobj->obj); > + drm_gem_object_put_unlocked(&dobj->obj); > return ret; > } > > @@ -351,13 +351,13 @@ int armada_gem_mmap_ioctl(struct drm_device *dev, void *data, > return -ENOENT; > > if (!dobj->obj.filp) { > - drm_gem_object_unreference_unlocked(&dobj->obj); > + drm_gem_object_put_unlocked(&dobj->obj); > return -EINVAL; > } > > addr = vm_mmap(dobj->obj.filp, 0, args->size, PROT_READ | PROT_WRITE, > MAP_SHARED, args->offset); > - drm_gem_object_unreference_unlocked(&dobj->obj); > + drm_gem_object_put_unlocked(&dobj->obj); > if (IS_ERR_VALUE(addr)) > return addr; > > @@ -412,7 +412,7 @@ int armada_gem_pwrite_ioctl(struct drm_device *dev, void *data, > } > > unref: > - drm_gem_object_unreference_unlocked(&dobj->obj); > + drm_gem_object_put_unlocked(&dobj->obj); > return ret; > } > > @@ -561,7 +561,7 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf) > * Importing our own dmabuf(s) increases the > * refcount on the gem object itself. > */ > - drm_gem_object_reference(obj); > + drm_gem_object_get(obj); > return obj; > } > } > -- > 2.7.4 > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RESEND PATCH 1/2] drm/armada: Replace drm_gem_object_reference/unreference() with _get/put() 2017-09-20 19:01 ` Sean Paul @ 2017-10-16 19:03 ` Sean Paul 0 siblings, 0 replies; 7+ messages in thread From: Sean Paul @ 2017-10-16 19:03 UTC (permalink / raw) To: Haneen Mohammed Cc: Greg Kroah-Hartman, Russell King, dri-devel, outreachy-kernel, Daniel Vetter On Wed, Sep 20, 2017 at 12:01:05PM -0700, Sean Paul wrote: > On Wed, Sep 20, 2017 at 11:54 AM, Haneen Mohammed > <hamohammed.sa@gmail.com> wrote: > > This patch replace instances of drm_gem_object_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_gem_object_reference(e); > > +drm_gem_object_get(e); > > | > > -drm_gem_object_unreference(e); > > +drm_gem_object_put(e); > > | > > -drm_gem_object_unreference_unlocked(e); > > +drm_gem_object_put_unlocked(e); > > ) > > > > Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com> > > Reviewed-by: Sean Paul <seanpaul@chromium.org> Applied to drm-misc-next Thanks for your patch! Sean > > > --- > > drivers/gpu/drm/armada/armada_crtc.c | 8 ++++---- > > drivers/gpu/drm/armada/armada_fb.c | 8 ++++---- > > drivers/gpu/drm/armada/armada_fbdev.c | 6 +++--- > > drivers/gpu/drm/armada/armada_gem.c | 14 +++++++------- > > 4 files changed, 18 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c > > index 2a4d163..381dfa1 100644 > > --- a/drivers/gpu/drm/armada/armada_crtc.c > > +++ b/drivers/gpu/drm/armada/armada_crtc.c > > @@ -947,13 +947,13 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc, > > > > /* Must be a kernel-mapped object */ > > if (!obj->addr) { > > - drm_gem_object_unreference_unlocked(&obj->obj); > > + drm_gem_object_put_unlocked(&obj->obj); > > return -EINVAL; > > } > > > > if (obj->obj.size < w * h * 4) { > > DRM_ERROR("buffer is too small\n"); > > - drm_gem_object_unreference_unlocked(&obj->obj); > > + drm_gem_object_put_unlocked(&obj->obj); > > return -ENOMEM; > > } > > } > > @@ -961,7 +961,7 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc, > > if (dcrtc->cursor_obj) { > > dcrtc->cursor_obj->update = NULL; > > dcrtc->cursor_obj->update_data = NULL; > > - drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj); > > + drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj); > > } > > dcrtc->cursor_obj = obj; > > dcrtc->cursor_w = w; > > @@ -997,7 +997,7 @@ static void armada_drm_crtc_destroy(struct drm_crtc *crtc) > > struct armada_private *priv = crtc->dev->dev_private; > > > > if (dcrtc->cursor_obj) > > - drm_gem_object_unreference_unlocked(&dcrtc->cursor_obj->obj); > > + drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj); > > > > priv->dcrtc[dcrtc->num] = NULL; > > drm_crtc_cleanup(&dcrtc->crtc); > > diff --git a/drivers/gpu/drm/armada/armada_fb.c b/drivers/gpu/drm/armada/armada_fb.c > > index 92e6b08..51839c1 100644 > > --- a/drivers/gpu/drm/armada/armada_fb.c > > +++ b/drivers/gpu/drm/armada/armada_fb.c > > @@ -18,7 +18,7 @@ static void armada_fb_destroy(struct drm_framebuffer *fb) > > struct armada_framebuffer *dfb = drm_fb_to_armada_fb(fb); > > > > drm_framebuffer_cleanup(&dfb->fb); > > - drm_gem_object_unreference_unlocked(&dfb->obj->obj); > > + drm_gem_object_put_unlocked(&dfb->obj->obj); > > kfree(dfb); > > } > > > > @@ -95,7 +95,7 @@ struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev, > > * the above call, but the caller will drop their reference > > * to it. Hence we need to take our own reference. > > */ > > - drm_gem_object_reference(&obj->obj); > > + drm_gem_object_get(&obj->obj); > > > > return dfb; > > } > > @@ -144,12 +144,12 @@ static struct drm_framebuffer *armada_fb_create(struct drm_device *dev, > > goto err; > > } > > > > - drm_gem_object_unreference_unlocked(&obj->obj); > > + drm_gem_object_put_unlocked(&obj->obj); > > > > return &dfb->fb; > > > > err_unref: > > - drm_gem_object_unreference_unlocked(&obj->obj); > > + drm_gem_object_put_unlocked(&obj->obj); > > err: > > DRM_ERROR("failed to initialize framebuffer: %d\n", ret); > > return ERR_PTR(ret); > > diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c > > index 29c7d04..cf6bad1 100644 > > --- a/drivers/gpu/drm/armada/armada_fbdev.c > > +++ b/drivers/gpu/drm/armada/armada_fbdev.c > > @@ -52,13 +52,13 @@ static int armada_fb_create(struct drm_fb_helper *fbh, > > > > ret = armada_gem_linear_back(dev, obj); > > if (ret) { > > - drm_gem_object_unreference_unlocked(&obj->obj); > > + drm_gem_object_put_unlocked(&obj->obj); > > return ret; > > } > > > > ptr = armada_gem_map_object(dev, obj); > > if (!ptr) { > > - drm_gem_object_unreference_unlocked(&obj->obj); > > + drm_gem_object_put_unlocked(&obj->obj); > > return -ENOMEM; > > } > > > > @@ -68,7 +68,7 @@ static int armada_fb_create(struct drm_fb_helper *fbh, > > * A reference is now held by the framebuffer object if > > * successful, otherwise this drops the ref for the error path. > > */ > > - drm_gem_object_unreference_unlocked(&obj->obj); > > + drm_gem_object_put_unlocked(&obj->obj); > > > > if (IS_ERR(dfb)) > > return PTR_ERR(dfb); > > diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c > > index a76ca21..49d40aa 100644 > > --- a/drivers/gpu/drm/armada/armada_gem.c > > +++ b/drivers/gpu/drm/armada/armada_gem.c > > @@ -266,7 +266,7 @@ int armada_gem_dumb_create(struct drm_file *file, struct drm_device *dev, > > /* drop reference from allocate - handle holds it now */ > > DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle); > > err: > > - drm_gem_object_unreference_unlocked(&dobj->obj); > > + drm_gem_object_put_unlocked(&dobj->obj); > > return ret; > > } > > > > @@ -295,7 +295,7 @@ int armada_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, > > } > > > > err_unref: > > - drm_gem_object_unreference_unlocked(&obj->obj); > > + drm_gem_object_put_unlocked(&obj->obj); > > > > return ret; > > } > > @@ -334,7 +334,7 @@ int armada_gem_create_ioctl(struct drm_device *dev, void *data, > > /* drop reference from allocate - handle holds it now */ > > DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle); > > err: > > - drm_gem_object_unreference_unlocked(&dobj->obj); > > + drm_gem_object_put_unlocked(&dobj->obj); > > return ret; > > } > > > > @@ -351,13 +351,13 @@ int armada_gem_mmap_ioctl(struct drm_device *dev, void *data, > > return -ENOENT; > > > > if (!dobj->obj.filp) { > > - drm_gem_object_unreference_unlocked(&dobj->obj); > > + drm_gem_object_put_unlocked(&dobj->obj); > > return -EINVAL; > > } > > > > addr = vm_mmap(dobj->obj.filp, 0, args->size, PROT_READ | PROT_WRITE, > > MAP_SHARED, args->offset); > > - drm_gem_object_unreference_unlocked(&dobj->obj); > > + drm_gem_object_put_unlocked(&dobj->obj); > > if (IS_ERR_VALUE(addr)) > > return addr; > > > > @@ -412,7 +412,7 @@ int armada_gem_pwrite_ioctl(struct drm_device *dev, void *data, > > } > > > > unref: > > - drm_gem_object_unreference_unlocked(&dobj->obj); > > + drm_gem_object_put_unlocked(&dobj->obj); > > return ret; > > } > > > > @@ -561,7 +561,7 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf) > > * Importing our own dmabuf(s) increases the > > * refcount on the gem object itself. > > */ > > - drm_gem_object_reference(obj); > > + drm_gem_object_get(obj); > > return obj; > > } > > } > > -- > > 2.7.4 > > -- Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 7+ messages in thread
* [RESEND PATCH 2/2] drm/armada: Replace drm_framebuffer_reference/unreference() with _get/put() 2017-09-20 18:51 [RESEND PATCH 0/2] drm/armada: Replace _reference/unreference() with _get/put() Haneen Mohammed 2017-09-20 18:54 ` [RESEND PATCH 1/2] drm/armada: Replace drm_gem_object_reference/unreference() " Haneen Mohammed @ 2017-09-20 18:57 ` Haneen Mohammed 2017-09-20 19:01 ` Sean Paul 1 sibling, 1 reply; 7+ messages in thread From: Haneen Mohammed @ 2017-09-20 18:57 UTC (permalink / raw) To: outreachy-kernel Cc: hamohammed.sa, gregkh, Russell King, dri-devel, Daniel Vetter 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@gmail.com> --- 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 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [RESEND PATCH 2/2] drm/armada: Replace drm_framebuffer_reference/unreference() with _get/put() 2017-09-20 18:57 ` [RESEND PATCH 2/2] drm/armada: Replace drm_framebuffer_reference/unreference() " Haneen Mohammed @ 2017-09-20 19:01 ` Sean Paul 2017-10-16 19:03 ` Sean Paul 0 siblings, 1 reply; 7+ messages in thread From: Sean Paul @ 2017-09-20 19:01 UTC (permalink / raw) To: Haneen Mohammed Cc: Greg Kroah-Hartman, Russell King, dri-devel, outreachy-kernel, Daniel Vetter On Wed, Sep 20, 2017 at 11:57 AM, Haneen Mohammed <hamohammed.sa@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@gmail.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> > --- > 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 > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RESEND PATCH 2/2] drm/armada: Replace drm_framebuffer_reference/unreference() with _get/put() 2017-09-20 19:01 ` Sean Paul @ 2017-10-16 19:03 ` Sean Paul 0 siblings, 0 replies; 7+ messages in thread From: Sean Paul @ 2017-10-16 19:03 UTC (permalink / raw) To: Haneen Mohammed Cc: Greg Kroah-Hartman, Russell King, dri-devel, outreachy-kernel, Daniel Vetter 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@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@gmail.com> > > Reviewed-by: Sean Paul <seanpaul@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 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-10-16 19:03 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-09-20 18:51 [RESEND PATCH 0/2] drm/armada: Replace _reference/unreference() with _get/put() Haneen Mohammed 2017-09-20 18:54 ` [RESEND PATCH 1/2] drm/armada: Replace drm_gem_object_reference/unreference() " Haneen Mohammed 2017-09-20 19:01 ` Sean Paul 2017-10-16 19:03 ` Sean Paul 2017-09-20 18:57 ` [RESEND PATCH 2/2] drm/armada: Replace drm_framebuffer_reference/unreference() " Haneen Mohammed 2017-09-20 19:01 ` Sean Paul 2017-10-16 19:03 ` Sean Paul
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox