All of lore.kernel.org
 help / color / mirror / Atom feed
* [libdrm PATCH 1/4] nouveau: add nouveau_resource_destroy
@ 2010-01-12 14:31 Marcin Slusarz
       [not found] ` <20100112143128.GA2984-OI9uyE9O0yo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Marcin Slusarz @ 2010-01-12 14:31 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [libdrm PATCH] nouveau: add nouveau_resource_destroy

---
 nouveau/nouveau_resource.c |    9 +++++++++
 nouveau/nouveau_resource.h |    3 +++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/nouveau/nouveau_resource.c b/nouveau/nouveau_resource.c
index 6bef756..7acaf7d 100644
--- a/nouveau/nouveau_resource.c
+++ b/nouveau/nouveau_resource.c
@@ -41,6 +41,15 @@ nouveau_resource_init(struct nouveau_resource **heap,
 	return 0;
 }
 
+void
+nouveau_resource_destroy(struct nouveau_resource **heap)
+{
+	if (!*heap)
+		return;
+	free(*heap);
+	*heap = NULL;
+}
+
 int
 nouveau_resource_alloc(struct nouveau_resource *heap, unsigned size, void *priv,
 		       struct nouveau_resource **res)
diff --git a/nouveau/nouveau_resource.h b/nouveau/nouveau_resource.h
index 988d246..b760dfb 100644
--- a/nouveau/nouveau_resource.h
+++ b/nouveau/nouveau_resource.h
@@ -38,6 +38,9 @@ int
 nouveau_resource_init(struct nouveau_resource **heap, unsigned start,
 		      unsigned size);
 
+void
+nouveau_resource_destroy(struct nouveau_resource **heap);
+
 int
 nouveau_resource_alloc(struct nouveau_resource *heap, unsigned size, void *priv,
 		       struct nouveau_resource **);
-- 
1.6.6.rc3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [libdrm PATCH 1/4] nouveau: add nouveau_resource_destroy
       [not found] ` <20100112143128.GA2984-OI9uyE9O0yo@public.gmane.org>
@ 2010-01-14 23:02   ` Maarten Maathuis
       [not found]     ` <6d4bc9fc1001141502l78f40a00n1074cdd4bf00a815-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Maarten Maathuis @ 2010-01-14 23:02 UTC (permalink / raw)
  To: Marcin Slusarz; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Is everyone ok with this api addition (naming ok?)?

On Tue, Jan 12, 2010 at 3:31 PM, Marcin Slusarz
<marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> From: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Subject: [libdrm PATCH] nouveau: add nouveau_resource_destroy
>
> ---
>  nouveau/nouveau_resource.c |    9 +++++++++
>  nouveau/nouveau_resource.h |    3 +++
>  2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/nouveau/nouveau_resource.c b/nouveau/nouveau_resource.c
> index 6bef756..7acaf7d 100644
> --- a/nouveau/nouveau_resource.c
> +++ b/nouveau/nouveau_resource.c
> @@ -41,6 +41,15 @@ nouveau_resource_init(struct nouveau_resource **heap,
>        return 0;
>  }
>
> +void
> +nouveau_resource_destroy(struct nouveau_resource **heap)
> +{
> +       if (!*heap)
> +               return;
> +       free(*heap);
> +       *heap = NULL;
> +}
> +
>  int
>  nouveau_resource_alloc(struct nouveau_resource *heap, unsigned size, void *priv,
>                       struct nouveau_resource **res)
> diff --git a/nouveau/nouveau_resource.h b/nouveau/nouveau_resource.h
> index 988d246..b760dfb 100644
> --- a/nouveau/nouveau_resource.h
> +++ b/nouveau/nouveau_resource.h
> @@ -38,6 +38,9 @@ int
>  nouveau_resource_init(struct nouveau_resource **heap, unsigned start,
>                      unsigned size);
>
> +void
> +nouveau_resource_destroy(struct nouveau_resource **heap);
> +
>  int
>  nouveau_resource_alloc(struct nouveau_resource *heap, unsigned size, void *priv,
>                       struct nouveau_resource **);
> --
> 1.6.6.rc3
>
> _______________________________________________
> Nouveau mailing list
> Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> http://lists.freedesktop.org/mailman/listinfo/nouveau
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [libdrm PATCH 1/4] nouveau: add nouveau_resource_destroy
       [not found]     ` <6d4bc9fc1001141502l78f40a00n1074cdd4bf00a815-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-01-21 21:33       ` Marcin Slusarz
       [not found]         ` <20100121213306.GA2879-OI9uyE9O0yo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Marcin Slusarz @ 2010-01-21 21:33 UTC (permalink / raw)
  To: Maarten Maathuis; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Fri, Jan 15, 2010 at 12:02:25AM +0100, Maarten Maathuis wrote:
> Is everyone ok with this api addition (naming ok?)?

I guess they are...

... Or is there any issue with this patch I'm not aware of?

Marcin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [libdrm PATCH 1/4] nouveau: add nouveau_resource_destroy
       [not found]         ` <20100121213306.GA2879-OI9uyE9O0yo@public.gmane.org>
@ 2010-01-22 10:10           ` Christoph Bumiller
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Bumiller @ 2010-01-22 10:10 UTC (permalink / raw)
  To: Marcin Slusarz; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 21.01.2010 22:33, Marcin Slusarz wrote:
> On Fri, Jan 15, 2010 at 12:02:25AM +0100, Maarten Maathuis wrote:
>   
>> Is everyone ok with this api addition (naming ok?)?
>>     
> I guess they are...
>
> ... Or is there any issue with this patch I'm not aware of?
>
> Marcin
>
>   
In principle I guess we could also make nouveau_resource_free
FREE the resource if (!next && !prev && !in_use), but I prefer
the extra function.

Also, resource_destroy could iterate through all resources still linked
with it and FREE them too, but that would probably not be necessary
since all alloc'd ones should already have been released (but would
produce a deserved segfault otherwise, if they're still used).

If no one speaks in favour of changing anything though, let's push
this as is (?) ...

Christoph
> _______________________________________________
> Nouveau mailing list
> Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> http://lists.freedesktop.org/mailman/listinfo/nouveau
>   

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-01-22 10:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-12 14:31 [libdrm PATCH 1/4] nouveau: add nouveau_resource_destroy Marcin Slusarz
     [not found] ` <20100112143128.GA2984-OI9uyE9O0yo@public.gmane.org>
2010-01-14 23:02   ` Maarten Maathuis
     [not found]     ` <6d4bc9fc1001141502l78f40a00n1074cdd4bf00a815-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-21 21:33       ` Marcin Slusarz
     [not found]         ` <20100121213306.GA2879-OI9uyE9O0yo@public.gmane.org>
2010-01-22 10:10           ` Christoph Bumiller

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.