[PATCH] drm/i915: simplify context_idr_cleanup

2012-06-19 Thread Daniel Vetter
The idr code already passes us the pointer associated with that id, so
no need to look it up again. Also, we'll kill the idr right away, so
there's no issue with leaving these dangling pointers behind - the
current code does the same.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/i915_gem_context.c |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c 
b/drivers/gpu/drm/i915/i915_gem_context.c
index 8f533cf..8694919 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -286,12 +286,9 @@ static int context_idr_cleanup(int id, void *p, void *data)
 {
struct drm_file *file = (struct drm_file *)data;
struct drm_i915_file_private *file_priv = file->driver_priv;
-   struct i915_hw_context *ctx;
+   struct i915_hw_context *ctx = p;

BUG_ON(id == DEFAULT_CONTEXT_ID);
-   ctx = i915_gem_context_get(file_priv, id);
-   if (WARN_ON(ctx == NULL))
-   return -ENXIO;

do_destroy(ctx);

-- 
1.7.10



Re: [PATCH] drm/i915: simplify context_idr_cleanup

2012-06-19 Thread Ben Widawsky
On Tue, 19 Jun 2012 18:56:15 +0200
Daniel Vetter  wrote:

> The idr code already passes us the pointer associated with that id, so
> no need to look it up again. Also, we'll kill the idr right away, so
> there's no issue with leaving these dangling pointers behind - the
> current code does the same.
> 
> Signed-Off-by: Daniel Vetter 

This is a pretty ugly wart I left over. Yet again, this worked a bit
differently in the earlier versions of context support. Back when I had
a spinlock protecting the idr.

The only thing to add to this is I think we can get rid of the data arg
(file), but otherwise this is
Reviewed-by: Ben Widawsky 

> ---
>  drivers/gpu/drm/i915/i915_gem_context.c |5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c 
> b/drivers/gpu/drm/i915/i915_gem_context.c
> index 8f533cf..8694919 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -286,12 +286,9 @@ static int context_idr_cleanup(int id, void *p, void 
> *data)
>  {
>   struct drm_file *file = (struct drm_file *)data;
>   struct drm_i915_file_private *file_priv = file->driver_priv;
> - struct i915_hw_context *ctx;
> + struct i915_hw_context *ctx = p;
>  
>   BUG_ON(id == DEFAULT_CONTEXT_ID);
> - ctx = i915_gem_context_get(file_priv, id);
> - if (WARN_ON(ctx == NULL))
> - return -ENXIO;
>  
>   do_destroy(ctx);
>  



-- 
Ben Widawsky, Intel Open Source Technology Center
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/i915: simplify context_idr_cleanup

2012-06-19 Thread Ben Widawsky
On Tue, 19 Jun 2012 18:56:15 +0200
Daniel Vetter  wrote:

> The idr code already passes us the pointer associated with that id, so
> no need to look it up again. Also, we'll kill the idr right away, so
> there's no issue with leaving these dangling pointers behind - the
> current code does the same.
> 
> Signed-Off-by: Daniel Vetter 

This is a pretty ugly wart I left over. Yet again, this worked a bit
differently in the earlier versions of context support. Back when I had
a spinlock protecting the idr.

The only thing to add to this is I think we can get rid of the data arg
(file), but otherwise this is
Reviewed-by: Ben Widawsky 

> ---
>  drivers/gpu/drm/i915/i915_gem_context.c |5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c 
> b/drivers/gpu/drm/i915/i915_gem_context.c
> index 8f533cf..8694919 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -286,12 +286,9 @@ static int context_idr_cleanup(int id, void *p, void 
> *data)
>  {
>   struct drm_file *file = (struct drm_file *)data;
>   struct drm_i915_file_private *file_priv = file->driver_priv;
> - struct i915_hw_context *ctx;
> + struct i915_hw_context *ctx = p;
>  
>   BUG_ON(id == DEFAULT_CONTEXT_ID);
> - ctx = i915_gem_context_get(file_priv, id);
> - if (WARN_ON(ctx == NULL))
> - return -ENXIO;
>  
>   do_destroy(ctx);
>  



-- 
Ben Widawsky, Intel Open Source Technology Center


[PATCH] drm/i915: simplify context_idr_cleanup

2012-06-19 Thread Daniel Vetter
The idr code already passes us the pointer associated with that id, so
no need to look it up again. Also, we'll kill the idr right away, so
there's no issue with leaving these dangling pointers behind - the
current code does the same.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/i915_gem_context.c |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c 
b/drivers/gpu/drm/i915/i915_gem_context.c
index 8f533cf..8694919 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -286,12 +286,9 @@ static int context_idr_cleanup(int id, void *p, void *data)
 {
struct drm_file *file = (struct drm_file *)data;
struct drm_i915_file_private *file_priv = file->driver_priv;
-   struct i915_hw_context *ctx;
+   struct i915_hw_context *ctx = p;
 
BUG_ON(id == DEFAULT_CONTEXT_ID);
-   ctx = i915_gem_context_get(file_priv, id);
-   if (WARN_ON(ctx == NULL))
-   return -ENXIO;
 
do_destroy(ctx);
 
-- 
1.7.10

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel