All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return
@ 2015-07-27 13:59 ` Shraddha Barke
  0 siblings, 0 replies; 8+ messages in thread
From: Shraddha Barke @ 2015-07-27 13:59 UTC (permalink / raw
  To: Lidza Louina
  Cc: Mark Hounschell, Greg Kroah-Hartman, driverdev-devel, devel,
	Julia Lawall, linux-kernel, Shraddha Barke

This patch compresses two lines into a single line if immediate return
is found. Variable rc is dropped as it is no longer needed.

Semantic patch used for this is as follows:

@@
type T;
identifier i,f;
constant C;
@@
- T i;
  ...when != i
     when strict
(
  return -C;
|
- i =
+ return
     f(...);
- return i;
)

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/dgnc/dgnc_neo.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 900e3ae..321783c 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -1316,7 +1316,6 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
 	unsigned long flags;
 	struct channel_t *ch;
 	struct un_t *un;
-	int rc = 0;
 
 	if (!tty || tty->magic != TTY_MAGIC)
 		return -ENXIO;
@@ -1339,10 +1338,7 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
 	 *
 	 * NOTE: TODO: Do something with time passed in.
 	 */
-	rc = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
-
-	/* If ret is non-zero, user ctrl-c'ed us */
-	return rc;
+	return wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
 }
 
 
-- 
2.1.0


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

* [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return
@ 2015-07-27 13:59 ` Shraddha Barke
  0 siblings, 0 replies; 8+ messages in thread
From: Shraddha Barke @ 2015-07-27 13:59 UTC (permalink / raw
  To: Lidza Louina
  Cc: devel, Greg Kroah-Hartman, driverdev-devel, linux-kernel,
	Julia Lawall, Shraddha Barke

This patch compresses two lines into a single line if immediate return
is found. Variable rc is dropped as it is no longer needed.

Semantic patch used for this is as follows:

@@
type T;
identifier i,f;
constant C;
@@
- T i;
  ...when != i
     when strict
(
  return -C;
|
- i =
+ return
     f(...);
- return i;
)

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/dgnc/dgnc_neo.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 900e3ae..321783c 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -1316,7 +1316,6 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
 	unsigned long flags;
 	struct channel_t *ch;
 	struct un_t *un;
-	int rc = 0;
 
 	if (!tty || tty->magic != TTY_MAGIC)
 		return -ENXIO;
@@ -1339,10 +1338,7 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
 	 *
 	 * NOTE: TODO: Do something with time passed in.
 	 */
-	rc = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
-
-	/* If ret is non-zero, user ctrl-c'ed us */
-	return rc;
+	return wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
 }
 
 
-- 
2.1.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return
@ 2015-07-27 14:05 ` Shraddha Barke
  0 siblings, 0 replies; 8+ messages in thread
From: Shraddha Barke @ 2015-07-27 14:05 UTC (permalink / raw
  To: Lidza Louina, Mark Hounschell, Greg Kroah-Hartman, Julia Lawall
  Cc: driverdev-devel, devel, linux-kernel, Shraddha Barke

This patch compresses two lines into a single line if immediate return
is found. Variable rc is dropped as it is no longer needed.

Semantic patch used for this is as follows:

@@
type T;
identifier i,f;
constant C;
@@
- T i;
  ...when != i
     when strict
(
  return -C;
|
- i =
+ return
     f(...);
- return i;
)

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/dgnc/dgnc_neo.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 900e3ae..321783c 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -1316,7 +1316,6 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
 	unsigned long flags;
 	struct channel_t *ch;
 	struct un_t *un;
-	int rc = 0;
 
 	if (!tty || tty->magic != TTY_MAGIC)
 		return -ENXIO;
@@ -1339,10 +1338,7 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
 	 *
 	 * NOTE: TODO: Do something with time passed in.
 	 */
-	rc = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
-
-	/* If ret is non-zero, user ctrl-c'ed us */
-	return rc;
+	return wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
 }
 
 
-- 
2.1.0


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

* [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return
@ 2015-07-27 14:05 ` Shraddha Barke
  0 siblings, 0 replies; 8+ messages in thread
From: Shraddha Barke @ 2015-07-27 14:05 UTC (permalink / raw
  To: Lidza Louina, Mark Hounschell, Greg Kroah-Hartman, Julia Lawall
  Cc: devel, driverdev-devel, linux-kernel, Shraddha Barke

This patch compresses two lines into a single line if immediate return
is found. Variable rc is dropped as it is no longer needed.

Semantic patch used for this is as follows:

@@
type T;
identifier i,f;
constant C;
@@
- T i;
  ...when != i
     when strict
(
  return -C;
|
- i =
+ return
     f(...);
- return i;
)

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/dgnc/dgnc_neo.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 900e3ae..321783c 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -1316,7 +1316,6 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
 	unsigned long flags;
 	struct channel_t *ch;
 	struct un_t *un;
-	int rc = 0;
 
 	if (!tty || tty->magic != TTY_MAGIC)
 		return -ENXIO;
@@ -1339,10 +1338,7 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
 	 *
 	 * NOTE: TODO: Do something with time passed in.
 	 */
-	rc = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
-
-	/* If ret is non-zero, user ctrl-c'ed us */
-	return rc;
+	return wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
 }
 
 
-- 
2.1.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return
  2015-07-27 13:59 ` Shraddha Barke
@ 2015-07-28 11:11   ` Sudip Mukherjee
  -1 siblings, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-07-28 11:11 UTC (permalink / raw
  To: Shraddha Barke
  Cc: Lidza Louina, devel, Greg Kroah-Hartman, driverdev-devel,
	linux-kernel, Julia Lawall

On Mon, Jul 27, 2015 at 07:29:36PM +0530, Shraddha Barke wrote:
> This patch compresses two lines into a single line if immediate return
> is found. Variable rc is dropped as it is no longer needed.
> 
<snip>
> -	return rc;
> +	return wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
This is introducing new checkpatch warning about line more than 80 char.

regards
sudip

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

* Re: [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return
@ 2015-07-28 11:11   ` Sudip Mukherjee
  0 siblings, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-07-28 11:11 UTC (permalink / raw
  To: Shraddha Barke
  Cc: devel, Lidza Louina, driverdev-devel, linux-kernel, Julia Lawall,
	Greg Kroah-Hartman

On Mon, Jul 27, 2015 at 07:29:36PM +0530, Shraddha Barke wrote:
> This patch compresses two lines into a single line if immediate return
> is found. Variable rc is dropped as it is no longer needed.
> 
<snip>
> -	return rc;
> +	return wait_event_interruptible(un->un_flags_wait, ((un->un_flags & UN_EMPTY) == 0));
This is introducing new checkpatch warning about line more than 80 char.

regards
sudip
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return
  2015-07-27 14:05 ` Shraddha Barke
@ 2015-07-28 11:14   ` Sudip Mukherjee
  -1 siblings, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-07-28 11:14 UTC (permalink / raw
  To: Shraddha Barke
  Cc: Lidza Louina, Mark Hounschell, Greg Kroah-Hartman, Julia Lawall,
	devel, driverdev-devel, linux-kernel

On Mon, Jul 27, 2015 at 07:35:15PM +0530, Shraddha Barke wrote:
> This patch compresses two lines into a single line if immediate return
> is found. Variable rc is dropped as it is no longer needed.

same patch again?

regards
sudip

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

* Re: [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return
@ 2015-07-28 11:14   ` Sudip Mukherjee
  0 siblings, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-07-28 11:14 UTC (permalink / raw
  To: Shraddha Barke
  Cc: devel, Lidza Louina, driverdev-devel, linux-kernel, Julia Lawall,
	Greg Kroah-Hartman

On Mon, Jul 27, 2015 at 07:35:15PM +0530, Shraddha Barke wrote:
> This patch compresses two lines into a single line if immediate return
> is found. Variable rc is dropped as it is no longer needed.

same patch again?

regards
sudip
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2015-07-28 11:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-27 14:05 [PATCH] Staging: dgnc: Merge lines and remove unused variable for immediate return Shraddha Barke
2015-07-27 14:05 ` Shraddha Barke
2015-07-28 11:14 ` Sudip Mukherjee
2015-07-28 11:14   ` Sudip Mukherjee
  -- strict thread matches above, loose matches on Subject: below --
2015-07-27 13:59 Shraddha Barke
2015-07-27 13:59 ` Shraddha Barke
2015-07-28 11:11 ` Sudip Mukherjee
2015-07-28 11:11   ` Sudip Mukherjee

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.