Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1634856 > unrolled thread
| Started by | Lucas Stach <l.stach@pengutronix.de> |
|---|---|
| First post | 2017-05-03 12:30 +0200 |
| Last post | 2017-05-03 18:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v2 4/5] drm/etnaviv: Reuse dma_fence_release. Lucas Stach <l.stach@pengutronix.de> - 2017-05-03 12:30 +0200
Re: [PATCH v2 4/5] drm/etnaviv: Reuse dma_fence_release. Eric Anholt <eric@anholt.net> - 2017-05-03 18:10 +0200
| From | Lucas Stach <l.stach@pengutronix.de> |
|---|---|
| Date | 2017-05-03 12:30 +0200 |
| Subject | Re: [PATCH v2 4/5] drm/etnaviv: Reuse dma_fence_release. |
| Message-ID | <tCZHI-3W3-17@gated-at.bofh.it> |
Hi Eric,
Am Mittwoch, den 12.04.2017, 12:12 -0700 schrieb Eric Anholt:
> If we follow the typical pattern of the base class being the first
> member, we can use the default dma_fence_free function.
Sorry, I don't like this change.
While it provides a bit of code simplification, it also bakes the
implicit assumption into the code that dma_fence is the first struct
member without any checks to validate this assumption. I would at least
expect a build bug assert, but then the current bit of code to keep this
explicit and self-documenting is probably just as good.
Regards,
Lucas
> Signed-off-by: Eric Anholt <eric@anholt.net>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
> Cc: etnaviv@lists.freedesktop.org
> ---
> drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index da48819ff2e6..0d26ca56e94b 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -998,8 +998,8 @@ static void hangcheck_disable(struct etnaviv_gpu *gpu)
>
> /* fence object management */
> struct etnaviv_fence {
> - struct etnaviv_gpu *gpu;
> struct dma_fence base;
> + struct etnaviv_gpu *gpu;
> };
>
> static inline struct etnaviv_fence *to_etnaviv_fence(struct dma_fence *fence)
> @@ -1031,20 +1031,13 @@ static bool etnaviv_fence_signaled(struct dma_fence *fence)
> return fence_completed(f->gpu, f->base.seqno);
> }
>
> -static void etnaviv_fence_release(struct dma_fence *fence)
> -{
> - struct etnaviv_fence *f = to_etnaviv_fence(fence);
> -
> - kfree_rcu(f, base.rcu);
> -}
> -
> static const struct dma_fence_ops etnaviv_fence_ops = {
> .get_driver_name = etnaviv_fence_get_driver_name,
> .get_timeline_name = etnaviv_fence_get_timeline_name,
> .enable_signaling = etnaviv_fence_enable_signaling,
> .signaled = etnaviv_fence_signaled,
> .wait = dma_fence_default_wait,
> - .release = etnaviv_fence_release,
> + .release = dma_fence_free,
> };
>
> static struct dma_fence *etnaviv_gpu_fence_alloc(struct etnaviv_gpu *gpu)
[toc] | [next] | [standalone]
| From | Eric Anholt <eric@anholt.net> |
|---|---|
| Date | 2017-05-03 18:10 +0200 |
| Message-ID | <tD50K-7GP-43@gated-at.bofh.it> |
| In reply to | #1634856 |
[Multipart message — attachments visible in raw view] — view raw
Lucas Stach <l.stach@pengutronix.de> writes: > Hi Eric, > > Am Mittwoch, den 12.04.2017, 12:12 -0700 schrieb Eric Anholt: >> If we follow the typical pattern of the base class being the first >> member, we can use the default dma_fence_free function. > > Sorry, I don't like this change. > While it provides a bit of code simplification, it also bakes the > implicit assumption into the code that dma_fence is the first struct > member without any checks to validate this assumption. I would at least > expect a build bug assert, but then the current bit of code to keep this > explicit and self-documenting is probably just as good. Fine with me. Please make sure you grab patch 2, though.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web