Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753143AbdHKPCJ (ORCPT ); Fri, 11 Aug 2017 11:02:09 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36043 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752896AbdHKPCI (ORCPT ); Fri, 11 Aug 2017 11:02:08 -0400 Date: Fri, 11 Aug 2017 18:01:59 +0300 From: Cihangir Akturk To: Lucas Stach Cc: daniel@ffwll.ch, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Russell King , Christian Gmeiner , David Airlie , etnaviv@lists.freedesktop.org Subject: Re: [PATCH v3 07/28] drm/etnaviv: switch to drm_*_get(), drm_*_put() helpers Message-ID: <20170811150159.GA14080@yoga.localdomain> References: <1502454794-28558-1-git-send-email-cakturk@gmail.com> <1502454794-28558-8-git-send-email-cakturk@gmail.com> <1502462587.21055.33.camel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1502462587.21055.33.camel@pengutronix.de> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 7345 Lines: 199 On Fri, Aug 11, 2017 at 04:43:07PM +0200, Lucas Stach wrote: > Am Freitag, den 11.08.2017, 15:32 +0300 schrieb Cihangir Akturk: > > Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference() > > and drm_*_unreference() helpers. > > > > drm_*_reference() and drm_*_unreference() functions are just > > compatibility alias for drm_*_get() and drm_*_put() and should not be > > used by new code. So convert all users of compatibility functions to > > use the new APIs. > > > > Generated by: scripts/coccinelle/api/drm-get-put.cocci > > > > Signed-off-by: Cihangir Akturk > > I have already applied v1 of this patch to the etnaviv tree. This is identical to the same patch of v1, just based on drm-misc-next as suggested by Sean Paul. > Regards, > Lucas > > > --- > > drivers/gpu/drm/etnaviv/etnaviv_drv.c | 8 ++++---- > > drivers/gpu/drm/etnaviv/etnaviv_gem.c | 20 ++++++++++---------- > > drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +- > > drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 4 ++-- > > 4 files changed, 17 insertions(+), 17 deletions(-) > > > > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c > > index 91e17ae..2cb4773 100644 > > --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c > > +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c > > @@ -316,7 +316,7 @@ static int etnaviv_ioctl_gem_cpu_prep(struct drm_device *dev, void *data, > > > > ret = etnaviv_gem_cpu_prep(obj, args->op, &TS(args->timeout)); > > > > - drm_gem_object_unreference_unlocked(obj); > > + drm_gem_object_put_unlocked(obj); > > > > return ret; > > } > > @@ -337,7 +337,7 @@ static int etnaviv_ioctl_gem_cpu_fini(struct drm_device *dev, void *data, > > > > ret = etnaviv_gem_cpu_fini(obj); > > > > - drm_gem_object_unreference_unlocked(obj); > > + drm_gem_object_put_unlocked(obj); > > > > return ret; > > } > > @@ -357,7 +357,7 @@ static int etnaviv_ioctl_gem_info(struct drm_device *dev, void *data, > > return -ENOENT; > > > > ret = etnaviv_gem_mmap_offset(obj, &args->offset); > > - drm_gem_object_unreference_unlocked(obj); > > + drm_gem_object_put_unlocked(obj); > > > > return ret; > > } > > @@ -446,7 +446,7 @@ static int etnaviv_ioctl_gem_wait(struct drm_device *dev, void *data, > > > > ret = etnaviv_gem_wait_bo(gpu, obj, timeout); > > > > - drm_gem_object_unreference_unlocked(obj); > > + drm_gem_object_put_unlocked(obj); > > > > return ret; > > } > > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c > > index 9a3bea7..e36fbb9 100644 > > --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c > > +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c > > @@ -265,7 +265,7 @@ void etnaviv_gem_mapping_reference(struct etnaviv_vram_mapping *mapping) > > { > > struct etnaviv_gem_object *etnaviv_obj = mapping->object; > > > > - drm_gem_object_reference(&etnaviv_obj->base); > > + drm_gem_object_get(&etnaviv_obj->base); > > > > mutex_lock(&etnaviv_obj->lock); > > WARN_ON(mapping->use == 0); > > @@ -282,7 +282,7 @@ void etnaviv_gem_mapping_unreference(struct etnaviv_vram_mapping *mapping) > > mapping->use -= 1; > > mutex_unlock(&etnaviv_obj->lock); > > > > - drm_gem_object_unreference_unlocked(&etnaviv_obj->base); > > + drm_gem_object_put_unlocked(&etnaviv_obj->base); > > } > > > > struct etnaviv_vram_mapping *etnaviv_gem_mapping_get( > > @@ -358,7 +358,7 @@ struct etnaviv_vram_mapping *etnaviv_gem_mapping_get( > > return ERR_PTR(ret); > > > > /* Take a reference on the object */ > > - drm_gem_object_reference(obj); > > + drm_gem_object_get(obj); > > return mapping; > > } > > > > @@ -671,7 +671,7 @@ static struct drm_gem_object *__etnaviv_gem_new(struct drm_device *dev, > > return obj; > > > > fail: > > - drm_gem_object_unreference_unlocked(obj); > > + drm_gem_object_put_unlocked(obj); > > return ERR_PTR(ret); > > } > > > > @@ -688,14 +688,14 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file, > > > > ret = etnaviv_gem_obj_add(dev, obj); > > if (ret < 0) { > > - drm_gem_object_unreference_unlocked(obj); > > + drm_gem_object_put_unlocked(obj); > > return ret; > > } > > > > ret = drm_gem_handle_create(file, obj, handle); > > > > /* drop reference from allocate - handle holds it now */ > > - drm_gem_object_unreference_unlocked(obj); > > + drm_gem_object_put_unlocked(obj); > > > > return ret; > > } > > @@ -712,7 +712,7 @@ struct drm_gem_object *etnaviv_gem_new(struct drm_device *dev, > > > > ret = etnaviv_gem_obj_add(dev, obj); > > if (ret < 0) { > > - drm_gem_object_unreference_unlocked(obj); > > + drm_gem_object_put_unlocked(obj); > > return ERR_PTR(ret); > > } > > > > @@ -800,7 +800,7 @@ static void __etnaviv_gem_userptr_get_pages(struct work_struct *_work) > > } > > > > mutex_unlock(&etnaviv_obj->lock); > > - drm_gem_object_unreference_unlocked(&etnaviv_obj->base); > > + drm_gem_object_put_unlocked(&etnaviv_obj->base); > > > > mmput(work->mm); > > put_task_struct(work->task); > > @@ -858,7 +858,7 @@ static int etnaviv_gem_userptr_get_pages(struct etnaviv_gem_object *etnaviv_obj) > > } > > > > get_task_struct(current); > > - drm_gem_object_reference(&etnaviv_obj->base); > > + drm_gem_object_get(&etnaviv_obj->base); > > > > work->mm = mm; > > work->task = current; > > @@ -924,6 +924,6 @@ int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file, > > ret = drm_gem_handle_create(file, &etnaviv_obj->base, handle); > > unreference: > > /* drop reference from allocate - handle holds it now */ > > - drm_gem_object_unreference_unlocked(&etnaviv_obj->base); > > + drm_gem_object_put_unlocked(&etnaviv_obj->base); > > return ret; > > } > > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c > > index e5da4f23..ae88472 100644 > > --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c > > +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c > > @@ -146,7 +146,7 @@ struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev, > > return &etnaviv_obj->base; > > > > fail: > > - drm_gem_object_unreference_unlocked(&etnaviv_obj->base); > > + drm_gem_object_put_unlocked(&etnaviv_obj->base); > > > > return ERR_PTR(ret); > > } > > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c > > index 5bd9316..d456a6b 100644 > > --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c > > +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c > > @@ -88,7 +88,7 @@ static int submit_lookup_objects(struct etnaviv_gem_submit *submit, > > * Take a refcount on the object. The file table lock > > * prevents the object_idr's refcount on this being dropped. > > */ > > - drm_gem_object_reference(obj); > > + drm_gem_object_get(obj); > > > > submit->bos[i].obj = to_etnaviv_bo(obj); > > } > > @@ -291,7 +291,7 @@ static void submit_cleanup(struct etnaviv_gem_submit *submit) > > struct etnaviv_gem_object *etnaviv_obj = submit->bos[i].obj; > > > > submit_unlock_object(submit, i); > > - drm_gem_object_unreference_unlocked(&etnaviv_obj->base); > > + drm_gem_object_put_unlocked(&etnaviv_obj->base); > > } > > > > ww_acquire_fini(&submit->ticket); > >