diff mbox

[02/29] drm/i915: Rework drop caches for checkpatch

Message ID 1375315222-4785-3-git-send-email-ben@bwidawsk.net (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky July 31, 2013, 11:59 p.m. UTC
With an upcoming change to bind, to make checkpatch happy and keep the
code clean, we need to rework this code a bit.

This should have no functional impact.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Chris Wilson Aug. 3, 2013, 11:32 a.m. UTC | #1
On Wed, Jul 31, 2013 at 04:59:55PM -0700, Ben Widawsky wrote:
> With an upcoming change to bind, to make checkpatch happy and keep the
> code clean, we need to rework this code a bit.
> 
> This should have no functional impact.
> 
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index be69807..61ffa71 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1781,12 +1781,13 @@ i915_drop_caches_set(void *data, u64 val)
>  
>  	if (val & DROP_BOUND) {
>  		list_for_each_entry_safe(obj, next, &vm->inactive_list,
> -					 mm_list)
> -			if (obj->pin_count == 0) {
> -				ret = i915_gem_object_unbind(obj);
> -				if (ret)
> -					goto unlock;
> -			}
> +					 mm_list) {
> +			if (obj->pin_count)
> +				continue;

Give me a newline here, and I'm sold.

> +			ret = i915_gem_object_unbind(obj);
> +			if (ret)
> +				goto unlock;
> +		}
>  	}
Ben Widawsky Aug. 3, 2013, 10:10 p.m. UTC | #2
On Sat, Aug 03, 2013 at 12:32:35PM +0100, Chris Wilson wrote:
> On Wed, Jul 31, 2013 at 04:59:55PM -0700, Ben Widawsky wrote:
> > With an upcoming change to bind, to make checkpatch happy and keep the
> > code clean, we need to rework this code a bit.
> > 
> > This should have no functional impact.
> > 
> > Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> > ---
> >  drivers/gpu/drm/i915/i915_debugfs.c | 13 +++++++------
> >  1 file changed, 7 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> > index be69807..61ffa71 100644
> > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > @@ -1781,12 +1781,13 @@ i915_drop_caches_set(void *data, u64 val)
> >  
> >  	if (val & DROP_BOUND) {
> >  		list_for_each_entry_safe(obj, next, &vm->inactive_list,
> > -					 mm_list)
> > -			if (obj->pin_count == 0) {
> > -				ret = i915_gem_object_unbind(obj);
> > -				if (ret)
> > -					goto unlock;
> > -			}
> > +					 mm_list) {
> > +			if (obj->pin_count)
> > +				continue;
> 
> Give me a newline here, and I'm sold.
> 

Got it. As you may have noticed, this was already fixed in patch 20 of
the series.

> > +			ret = i915_gem_object_unbind(obj);
> > +			if (ret)
> > +				goto unlock;
> > +		}
> >  	}
> 
> -- 
> Chris Wilson, Intel Open Source Technology Centre
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index be69807..61ffa71 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1781,12 +1781,13 @@  i915_drop_caches_set(void *data, u64 val)
 
 	if (val & DROP_BOUND) {
 		list_for_each_entry_safe(obj, next, &vm->inactive_list,
-					 mm_list)
-			if (obj->pin_count == 0) {
-				ret = i915_gem_object_unbind(obj);
-				if (ret)
-					goto unlock;
-			}
+					 mm_list) {
+			if (obj->pin_count)
+				continue;
+			ret = i915_gem_object_unbind(obj);
+			if (ret)
+				goto unlock;
+		}
 	}
 
 	if (val & DROP_UNBOUND) {