Skip to contentSkip to conversation

staging: goldfish: Remove unneeded parentheses in assignment

PATCH In review Janani Ravichandran 3 participants 6 messages Feb 11, 2016 – Feb 12, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: goldfish: Remove unneeded parentheses in assignment

Remove parentheses around the right hand side of assignments as they are not needed. Semantic patch used:

@@
expression a, b, c;
@@

(
a = (b == c)
|
a =
- (
b
- )
)

---
Changes since v1:
*Lined up the expression on the right hand side in one of the assignment statements modified.

 drivers/staging/goldfish/goldfish_audio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/goldfish/goldfish_audio.c +3 -3
index f1e1838..eea7bbf 100644
@@ -122,7 +122,7 @@ static ssize_t goldfish_audio_read(struct file *fp, char __user *buf,
 		return -ENODEV;
 
 	while (count > 0) {
-		length = (count > READ_BUFFER_SIZE ? READ_BUFFER_SIZE : count);
+		length = count > READ_BUFFER_SIZE ? READ_BUFFER_SIZE : count;
 		AUDIO_WRITE(data, AUDIO_START_READ, length);
 
 		wait_event_interruptible(data->wait, data->buffer_status &
@@ -197,8 +197,8 @@ static int goldfish_audio_open(struct inode *ip, struct file *fp)
 
 	if (atomic_inc_return(&open_count) == 1) {
 		fp->private_data = audio_data;
-		audio_data->buffer_status = (AUDIO_INT_WRITE_BUFFER_1_EMPTY |
-					     AUDIO_INT_WRITE_BUFFER_2_EMPTY);
+		audio_data->buffer_status = AUDIO_INT_WRITE_BUFFER_1_EMPTY |
+					     AUDIO_INT_WRITE_BUFFER_2_EMPTY;
 		AUDIO_WRITE(audio_data, AUDIO_INT_ENABLE, AUDIO_INT_MASK);
 		return 0;
 	}
Signature · 1 line
2.5.0
#1 lore raw
Quoted 39 lines · Janani Ravichandran

Remove parentheses around the right hand side of assignments as they are not needed. Semantic patch used:

@@
expression a, b, c;
@@

(
a = (b == c)
|
a =
- (
b
- )
)

---
Changes since v1:
*Lined up the expression on the right hand side in one of the assignment statements modified.

 drivers/staging/goldfish/goldfish_audio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/goldfish/goldfish_audio.c +1 -1
index f1e1838..eea7bbf 100644
@@ -122,7 +122,7 @@ static ssize_t goldfish_audio_read(struct file *fp, char __user *buf,
 		return -ENODEV;
 
 	while (count > 0) {
-		length = (count > READ_BUFFER_SIZE ? READ_BUFFER_SIZE : count);
+		length = count > READ_BUFFER_SIZE ? READ_BUFFER_SIZE : count;
 		AUDIO_WRITE(data, AUDIO_START_READ, length);
 
 		wait_event_interruptible(data->wait, data->buffer_status &

drivers/staging/goldfish/goldfish_audio.c static int goldfish_audio_open(struct inode *ip, struct file *fp) · line 201

Quoted 7 lines
drivers/staging/goldfish/goldfish_audio.c +2 -2
@@ -197,8 +197,8 @@ static int goldfish_audio_open(struct inode *ip, struct file *fp)
 
 	if (atomic_inc_return(&open_count) == 1) {
 		fp->private_data = audio_data;
-		audio_data->buffer_status = (AUDIO_INT_WRITE_BUFFER_1_EMPTY |
-					     AUDIO_INT_WRITE_BUFFER_2_EMPTY);
+		audio_data->buffer_status = AUDIO_INT_WRITE_BUFFER_1_EMPTY |
+					     AUDIO_INT_WRITE_BUFFER_2_EMPTY;

It looks like nothing changed?

julia

Quoted 13 lines
drivers/staging/goldfish/goldfish_audio.c +0 -0
 		AUDIO_WRITE(audio_data, AUDIO_INT_ENABLE, AUDIO_INT_MASK);
 		return 0;
 	}
Signature · 8 lines
2.5.0

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160212002435.GA5778%40janani-Inspiron-3521.
For more options, visit https://groups.google.com/d/optout.
maintainer
#2 lore raw
Quoted 44 lines · Julia Lawall
Quoted 40 lines · Janani Ravichandran

Remove parentheses around the right hand side of assignments as they are not needed. Semantic patch used:

@@
expression a, b, c;
@@

(
a = (b == c)
|
a =
- (
b
- )
)

---
Changes since v1:
*Lined up the expression on the right hand side in one of the assignment statements modified.

 drivers/staging/goldfish/goldfish_audio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/goldfish/goldfish_audio.c +1 -1
index f1e1838..eea7bbf 100644
@@ -122,7 +122,7 @@ static ssize_t goldfish_audio_read(struct file *fp, char __user *buf,
 		return -ENODEV;
 
 	while (count > 0) {
-		length = (count > READ_BUFFER_SIZE ? READ_BUFFER_SIZE : count);
+		length = count > READ_BUFFER_SIZE ? READ_BUFFER_SIZE : count;
 		AUDIO_WRITE(data, AUDIO_START_READ, length);
 
 		wait_event_interruptible(data->wait, data->buffer_status &
@@ -197,8 +197,8 @@ static int goldfish_audio_open(struct inode *ip, struct file *fp)
 
Quoted 8 lines

drivers/staging/goldfish/goldfish_audio.c static int goldfish_audio_open(struct inode *ip, struct file *fp) · line 201

Quoted 6 lines
drivers/staging/goldfish/goldfish_audio.c +2 -2
 	if (atomic_inc_return(&open_count) == 1) {
 		fp->private_data = audio_data;
-		audio_data->buffer_status = (AUDIO_INT_WRITE_BUFFER_1_EMPTY |
-					     AUDIO_INT_WRITE_BUFFER_2_EMPTY);
+		audio_data->buffer_status = AUDIO_INT_WRITE_BUFFER_1_EMPTY |
+					     AUDIO_INT_WRITE_BUFFER_2_EMPTY;

It looks like nothing changed?

The ( ) are gone.

#3 lore raw
Quoted 7 lines
Quoted 4 lines

It looks like nothing changed?

The ( ) are gone.

Greg, I think Julia meant that nothing had changed since my previous patch, ie, v1 and v2 were the same.

Janani

maintainer
#4 lore raw
Quoted 9 lines · Janani Ravichandran

������

Quoted 2 lines

It looks like nothing changed?

The ( ) are gone.

Greg, I think Julia meant that nothing had changed since my previous patch, ie, v1 and v2 were the same.

Ah, yes, not good, please fix, sorry for the noise...

#5 lore raw
Quoted 7 lines · gregkh
Quoted 5 lines · Janani Ravichandran
Quoted 4 lines

It looks like nothing changed?

Quoted 7 lines
Quoted 3 lines

The ( ) are gone.

Greg, I think Julia meant that nothing had changed since my previous

patch, ie,

Quoted 1 line

v1 and v2 were the same.

Ah, yes, not good, please fix, sorry for the noise...

Actually, the alignment looks okay in the text editor but not in the patch. I sent v2 because I
thought I had accidentally modified the alignment while removing the parentheses.
And Julia seems to think it could be a tab issue.

Janani.