From: "Ville Syrjälä" <ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Felix Kuehling <felix.kuehling-5C7GfCeVMHo@public.gmane.org>
Cc: Tom St Denis <tom.stdenis-5C7GfCeVMHo@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 02/12] drm/ttm: Add a default BO destructor to simplify code
Date: Fri, 26 Jan 2018 21:34:19 +0200 [thread overview]
Message-ID: <20180126193419.GL5453@intel.com> (raw)
In-Reply-To: <07937612-0595-d204-4408-56b029863c1f-5C7GfCeVMHo@public.gmane.org>
On Fri, Jan 26, 2018 at 02:23:39PM -0500, Felix Kuehling wrote:
> On 2018-01-26 01:29 PM, Tom St Denis wrote:
> > Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
> > ---
> > drivers/gpu/drm/ttm/ttm_bo.c | 14 +++++++++-----
> > 1 file changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> > index 8cf89da7030d..4e85c32fea26 100644
> > --- a/drivers/gpu/drm/ttm/ttm_bo.c
> > +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> > @@ -49,6 +49,12 @@ static struct attribute ttm_bo_count = {
> > .mode = S_IRUGO
> > };
> >
> > +/* default destructor */
> > +static void ttm_bo_default_destroy(struct ttm_buffer_object *bo)
> > +{
> > + kfree(bo);
> > +};
>
> Stray semicolon.
>
> > +
> > static inline int ttm_mem_type_from_place(const struct ttm_place *place,
> > uint32_t *mem_type)
> > {
> > @@ -147,10 +153,7 @@ static void ttm_bo_release_list(struct kref *list_kref)
> > dma_fence_put(bo->moving);
> > reservation_object_fini(&bo->ttm_resv);
> > mutex_destroy(&bo->wu_mutex);
> > - if (bo->destroy)
> > - bo->destroy(bo);
> > - else
> > - kfree(bo);
> > + bo->destroy(bo);
> > ttm_mem_global_free(bdev->glob->mem_glob, acc_size);
> > }
> >
> > @@ -1176,7 +1179,8 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
> > ttm_mem_global_free(mem_glob, acc_size);
> > return -EINVAL;
> > }
> > - bo->destroy = destroy;
> > + bo->destroy =
> > + (destroy == NULL) ? ttm_bo_default_destroy : destroy;
>
> This could be written shorter as "!destroy ? ttm_bo_default_destroy :
> destroy", or even "destroy ? destroy : ttm_bo_default_destroy".
Or even 'destroy ?: ttm_bo_default_destroy' if you think
the gcc extension is cool enough. It is used elsewhere in
the kernel.
--
Ville Syrjälä
Intel OTC
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2018-01-26 19:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-26 18:28 Various TTM cleanups/fixes Tom St Denis
2018-01-26 18:29 ` [PATCH 03/12] drm/ttm: Change ttm_tt page allocations to return errors Tom St Denis
2018-01-26 18:29 ` [PATCH 04/12] drm/ttm: Fix indentation in ttm_tt_swapout() Tom St Denis
[not found] ` <20180126182911.20761-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
2018-01-26 18:29 ` [PATCH 01/12] drm/ttm: Clean up indentation in ttm_bo.c Tom St Denis
2018-01-26 18:29 ` [PATCH 02/12] drm/ttm: Add a default BO destructor to simplify code Tom St Denis
[not found] ` <20180126182911.20761-3-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
2018-01-26 19:23 ` Felix Kuehling
[not found] ` <07937612-0595-d204-4408-56b029863c1f-5C7GfCeVMHo@public.gmane.org>
2018-01-26 19:34 ` Ville Syrjälä [this message]
2018-01-26 18:29 ` [PATCH 05/12] drm/ttm: Fix indentation in ttm_pool_store() Tom St Denis
2018-01-26 18:29 ` [PATCH 06/12] drm/ttm: Simplify ttm_dma_page_put() Tom St Denis
2018-01-26 18:29 ` [PATCH 07/12] drm/ttm: Simplify ttm_dma_find_pool() Tom St Denis
[not found] ` <20180126182911.20761-8-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
2018-01-26 19:26 ` Felix Kuehling
2018-01-26 18:29 ` [PATCH 08/12] drm/ttm: Fix indentation in ttm_dma_pool_alloc_new_pages() Tom St Denis
2018-01-26 18:29 ` [PATCH 09/12] drm/ttm: Fix indentation in ttm_bo_move_memcpy() Tom St Denis
2018-01-26 18:29 ` [PATCH 10/12] drm/ttm: Remove unncessary retval from ttm_bo_vm_fault() Tom St Denis
2018-01-26 18:29 ` [PATCH 12/12] drm/ttm: Simplify ttm_eu_reserve_buffers() Tom St Denis
2018-01-26 18:38 ` Various TTM cleanups/fixes Christian König
2018-01-26 18:40 ` Tom St Denis
2018-01-26 18:29 ` [PATCH 11/12] drm/ttm: Fix 'buf' pointer update in ttm_bo_vm_access_kmap() Tom St Denis
[not found] ` <20180126182911.20761-12-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
2018-01-26 19:20 ` Felix Kuehling
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=20180126193419.GL5453@intel.com \
--to=ville.syrjala-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=felix.kuehling-5C7GfCeVMHo@public.gmane.org \
--cc=tom.stdenis-5C7GfCeVMHo@public.gmane.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.