linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 33/33] Staging: android: ion: ion.c: Compression of lines for
@ 2016-07-30  9:50 Nadim almas
  0 siblings, 0 replies; 9+ messages in thread
From: Nadim almas @ 2016-07-30  9:50 UTC (permalink / raw)
  To: labbott; +Cc: gregkh, linux-kernel, devel, Nadim almas

This patch compresses two lines in to a single line in file rtw_android.c
if immediate return statement is found. It also removes variable 
bytes_written as it is no longer needed.

It is done using script Coccinelle. And coccinelle uses following semantic
patch for this compression function:


@@
expression e, ret;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Nadim Almas <nadim.902@gmail.com>
---
 drivers/staging/android/ion/ion.c          | 8 +++-----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 52345df..271395b 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -391,9 +391,7 @@ static int ion_handle_put_nolock(struct ion_handle *handle)
 {
 	int ret;
 
-	ret = kref_put(&handle->ref, ion_handle_destroy);
-
-	return ret;
+        return kref_put(&handle->ref, ion_handle_destroy);
 }
 
 static int ion_handle_put(struct ion_handle *handle)
@@ -597,8 +595,8 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
 		return -ENODEV;
 	}
 	mutex_unlock(&client->lock);
-	ret = buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
-	return ret;
+	
+        return buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
 }
 EXPORT_SYMBOL(ion_phys);
 

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

* Re: [PATCH 33/33] Staging: android: ion: ion.c: Compression of lines for
  2016-07-30 16:11 Nadim almas
@ 2016-07-31  6:23 ` Laura Abbott
  0 siblings, 0 replies; 9+ messages in thread
From: Laura Abbott @ 2016-07-31  6:23 UTC (permalink / raw)
  To: Nadim almas; +Cc: gregkh, linux-kernel, devel

On 07/30/2016 09:11 AM, Nadim almas wrote:
> This patch compresses two lines in to a single line in file ion.c
> if immediate return statement is found. It also removes variable
> bytes_written as it is no longer needed.
>

This still says bytes_written.

None of the patches after your first one apply for me. Plus I think
there is still a warning from ion_phys due to an unused variable.

Please double check your patches before sending and make sure _all_
comments are addressed before resending, especially since some of them
have been mentioned multiple times now.

In the future if you send different versions of the same patch please
number it (PATCH, PATCHv2, PATCHv3 etc.) to make it easier to review.

Apart from all that, I'm going to NAK this for now. I have some clean
up get rid of ion_phys that I'm going to resend after the merge window
ends. After that is sent, if you want to (correctly) send a patch
to clean up ion_handle_put_nolock I will look at it then.

Thanks,
Laura

> It is done using script Coccinelle. And coccinelle uses following semantic
> patch for this compression function:
>
>
> @@
> expression e, ret;
> @@
>
> -ret =
> +return
>      e;
> -return ret;
>
> Signed-off-by: Nadim Almas <nadim.902@gmail.com>
> ---
>  drivers/staging/android/ion/ion.c          | 8 +++-----
>  1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index 52345df..271395b 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -391,9 +391,7 @@ static int ion_handle_put_nolock(struct ion_handle *handle)
>  {
> -	int ret;
>
> -	ret = kref_put(&handle->ref, ion_handle_destroy);
> -
> -	return ret;
> +	return kref_put(&handle->ref, ion_handle_destroy);
>  }
>
>  static int ion_handle_put(struct ion_handle *handle)
> @@ -597,8 +595,8 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
>  		return -ENODEV;
>  	}
>  	mutex_unlock(&client->lock);
> -	ret = buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
> -	return ret;
> +	return buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
>  }
>  EXPORT_SYMBOL(ion_phys);
>
>
>

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

* [PATCH 33/33] Staging: android: ion: ion.c: Compression of lines for
@ 2016-07-30 16:11 Nadim almas
  2016-07-31  6:23 ` Laura Abbott
  0 siblings, 1 reply; 9+ messages in thread
From: Nadim almas @ 2016-07-30 16:11 UTC (permalink / raw)
  To: labbott; +Cc: gregkh, linux-kernel, devel, Nadim almas

This patch compresses two lines in to a single line in file ion.c
if immediate return statement is found. It also removes variable 
bytes_written as it is no longer needed.

It is done using script Coccinelle. And coccinelle uses following semantic
patch for this compression function:


@@
expression e, ret;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Nadim Almas <nadim.902@gmail.com>
---
 drivers/staging/android/ion/ion.c          | 8 +++-----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 52345df..271395b 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -391,9 +391,7 @@ static int ion_handle_put_nolock(struct ion_handle *handle)
 {
-	int ret;
 
-	ret = kref_put(&handle->ref, ion_handle_destroy);
-
-	return ret;
+	return kref_put(&handle->ref, ion_handle_destroy);
 }
 
 static int ion_handle_put(struct ion_handle *handle)
@@ -597,8 +595,8 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
 		return -ENODEV;
 	}
 	mutex_unlock(&client->lock);
-	ret = buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
-	return ret;
+	return buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
 }
 EXPORT_SYMBOL(ion_phys);
 

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

* Re: [PATCH 33/33] Staging: android: ion: ion.c: Compression of lines for
  2016-07-30 11:12 Nadim almas
@ 2016-07-30 15:26 ` Markus Böhme
  0 siblings, 0 replies; 9+ messages in thread
From: Markus Böhme @ 2016-07-30 15:26 UTC (permalink / raw)
  To: Nadim almas, labbott; +Cc: devel, gregkh, linux-kernel

On 07/30/2016 01:12 PM, Nadim almas wrote:
> This patch compresses two lines in to a single line in file rtw_android.c
> if immediate return statement is found. It also removes variable 
> bytes_written as it is no longer needed.

This commit message is wrong. Neither are you editing rtw_android.c, nor
are you doing anything to a variable named bytes_written. Additionally,
the short description in your first line/subject seems to be missing a
word or two at the end.

> 
> It is done using script Coccinelle. And coccinelle uses following semantic
> patch for this compression function:
> 
> 
> @@
> expression e, ret;
> @@
> 
> -ret =
> +return
>      e;
> -return ret;
> 
> Signed-off-by: Nadim Almas <nadim.902@gmail.com>
> ---
>  drivers/staging/android/ion/ion.c          | 8 +++-----
>  1 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index 52345df..271395b 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -391,9 +391,7 @@ static int ion_handle_put_nolock(struct ion_handle *handle)
>  {
> -	int ret;
>  
> -	ret = kref_put(&handle->ref, ion_handle_destroy);
> -
> -	return ret;
> +	return kref_put(&handle->ref, ion_handle_destroy);
>  }
>  
>  static int ion_handle_put(struct ion_handle *handle)
> @@ -597,8 +595,8 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
>  		return -ENODEV;
>  	}
>  	mutex_unlock(&client->lock);
> -	ret = buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
> -	return ret;
> +	return buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
>  }
>  EXPORT_SYMBOL(ion_phys);

What Joe told you about compile-testing, warnings and unused variables
still applies.

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

* [PATCH 33/33] Staging: android: ion: ion.c: Compression of lines for
@ 2016-07-30 11:12 Nadim almas
  2016-07-30 15:26 ` Markus Böhme
  0 siblings, 1 reply; 9+ messages in thread
From: Nadim almas @ 2016-07-30 11:12 UTC (permalink / raw)
  To: labbott; +Cc: gregkh, linux-kernel, devel, Nadim almas

This patch compresses two lines in to a single line in file rtw_android.c
if immediate return statement is found. It also removes variable 
bytes_written as it is no longer needed.

It is done using script Coccinelle. And coccinelle uses following semantic
patch for this compression function:


@@
expression e, ret;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Nadim Almas <nadim.902@gmail.com>
---
 drivers/staging/android/ion/ion.c          | 8 +++-----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 52345df..271395b 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -391,9 +391,7 @@ static int ion_handle_put_nolock(struct ion_handle *handle)
 {
-	int ret;
 
-	ret = kref_put(&handle->ref, ion_handle_destroy);
-
-	return ret;
+	return kref_put(&handle->ref, ion_handle_destroy);
 }
 
 static int ion_handle_put(struct ion_handle *handle)
@@ -597,8 +595,8 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
 		return -ENODEV;
 	}
 	mutex_unlock(&client->lock);
-	ret = buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
-	return ret;
+	return buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
 }
 EXPORT_SYMBOL(ion_phys);
 

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

* Re: [PATCH 33/33] Staging: android: ion: ion.c: Compression of lines for
  2016-07-30  9:54 Nadim almas
@ 2016-07-30 10:58 ` Joe Perches
  0 siblings, 0 replies; 9+ messages in thread
From: Joe Perches @ 2016-07-30 10:58 UTC (permalink / raw)
  To: Nadim almas, labbott; +Cc: gregkh, linux-kernel, devel

On Sat, 2016-07-30 at 02:54 -0700, Nadim almas wrote:
> This patch compresses two lines in to a single line in file rtw_android.c
> if immediate return statement is found. It also removes variable 
> bytes_written as it is no longer needed.
> 
> It is done using script Coccinelle. And coccinelle uses following semantic
> patch for this compression function:
> 
> 
> @@
> expression e, ret;
> @@
> 
> -ret =
> +return
>      e;
> -return ret;
> 
> Signed-off-by: Nadim Almas <nadim.902@gmail.com>
> ---
>  drivers/staging/android/ion/ion.c          | 8 +++-----
>  1 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
[]
> @@ -597,8 +595,8 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
>  		return -ENODEV;
>  	}
>  	mutex_unlock(&client->lock);
> -	ret = buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
> -	return ret;
> +	
> +        return buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
>  }
>  EXPORT_SYMBOL(ion_phys);

How unfortunate you didn't heed the advice given..
I'll bet you didn't compile this.

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

* [PATCH 33/33] Staging: android: ion: ion.c: Compression of lines for
@ 2016-07-30  9:54 Nadim almas
  2016-07-30 10:58 ` Joe Perches
  0 siblings, 1 reply; 9+ messages in thread
From: Nadim almas @ 2016-07-30  9:54 UTC (permalink / raw)
  To: labbott; +Cc: gregkh, linux-kernel, devel, Nadim almas

This patch compresses two lines in to a single line in file rtw_android.c
if immediate return statement is found. It also removes variable 
bytes_written as it is no longer needed.

It is done using script Coccinelle. And coccinelle uses following semantic
patch for this compression function:


@@
expression e, ret;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Nadim Almas <nadim.902@gmail.com>
---
 drivers/staging/android/ion/ion.c          | 8 +++-----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 52345df..271395b 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -391,9 +391,7 @@ static int ion_handle_put_nolock(struct ion_handle *handle)
 {
-	int ret;
 
-	ret = kref_put(&handle->ref, ion_handle_destroy);
-
-	return ret;
+        return kref_put(&handle->ref, ion_handle_destroy);
 }
 
 static int ion_handle_put(struct ion_handle *handle)
@@ -597,8 +595,8 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
 		return -ENODEV;
 	}
 	mutex_unlock(&client->lock);
-	ret = buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
-	return ret;
+	
+        return buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
 }
 EXPORT_SYMBOL(ion_phys);
 

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

* Re: [PATCH 33/33] Staging: android: ion: ion.c: Compression of lines for
  2016-07-29 21:06 Nadim almas
@ 2016-07-29 21:14 ` Joe Perches
  0 siblings, 0 replies; 9+ messages in thread
From: Joe Perches @ 2016-07-29 21:14 UTC (permalink / raw)
  To: Nadim almas, labbott; +Cc: gregkh, linux-kernel, devel

On Fri, 2016-07-29 at 14:06 -0700, Nadim almas wrote:
> This patch compresses two lines in to a single line in file rtw_android.c
> if immediate return statement is found. It also removes variable 
> bytes_written as it is no longer needed.
> 
> It is done using script Coccinelle. And coccinelle uses following semantic
> patch for this compression function:
[]
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
[]
> @@ -391,9 +391,7 @@ static int ion_handle_put_nolock(struct ion_handle *handle)
>  {
>  	int ret;
>  
> -	ret = kref_put(&handle->ref, ion_handle_destroy);
> -
> -	return ret;
> +        return kref_put(&handle->ref, ion_handle_destroy);
>  }

int ret; is now unused.

Please make sure you compile the files modified by any script
and remove any newly introduced warnings.


>  static int ion_handle_put(struct ion_handle *handle)
> @@ -597,8 +595,8 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
>  		return -ENODEV;
>  	}
>  	mutex_unlock(&client->lock);
> -	ret = buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
> -	return ret;
> +	
> +        return buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
>  }
>  EXPORT_SYMBOL(ion_phys);

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

* [PATCH 33/33] Staging: android: ion: ion.c: Compression of lines for
@ 2016-07-29 21:06 Nadim almas
  2016-07-29 21:14 ` Joe Perches
  0 siblings, 1 reply; 9+ messages in thread
From: Nadim almas @ 2016-07-29 21:06 UTC (permalink / raw)
  To: labbott; +Cc: gregkh, linux-kernel, devel, Nadim almas

This patch compresses two lines in to a single line in file rtw_android.c
if immediate return statement is found. It also removes variable 
bytes_written as it is no longer needed.

It is done using script Coccinelle. And coccinelle uses following semantic
patch for this compression function:


@@
expression e, ret;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Nadim Almas <nadim.902@gmail.com>
---
 drivers/staging/android/ion/ion.c          | 8 +++-----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 52345df..271395b 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -391,9 +391,7 @@ static int ion_handle_put_nolock(struct ion_handle *handle)
 {
 	int ret;
 
-	ret = kref_put(&handle->ref, ion_handle_destroy);
-
-	return ret;
+        return kref_put(&handle->ref, ion_handle_destroy);
 }
 
 static int ion_handle_put(struct ion_handle *handle)
@@ -597,8 +595,8 @@ int ion_phys(struct ion_client *client, struct ion_handle *handle,
 		return -ENODEV;
 	}
 	mutex_unlock(&client->lock);
-	ret = buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
-	return ret;
+	
+        return buffer->heap->ops->phys(buffer->heap, buffer, addr, len);
 }
 EXPORT_SYMBOL(ion_phys);
 

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

end of thread, other threads:[~2016-07-31  6:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-30  9:50 [PATCH 33/33] Staging: android: ion: ion.c: Compression of lines for Nadim almas
  -- strict thread matches above, loose matches on Subject: below --
2016-07-30 16:11 Nadim almas
2016-07-31  6:23 ` Laura Abbott
2016-07-30 11:12 Nadim almas
2016-07-30 15:26 ` Markus Böhme
2016-07-30  9:54 Nadim almas
2016-07-30 10:58 ` Joe Perches
2016-07-29 21:06 Nadim almas
2016-07-29 21:14 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).