Skip to contentSkip to conversation

staging: greybus: remove unnecessary parentheses

PATCH In review Will Walsh 4 participants 5 messages Jan 9, 2025

Subsystems (3)
lore
Share & tools
lore

Will Walsh

author
#0 lore raw

PATCH 1/1 staging: greybus: remove unnecessary parentheses

Unnecessary parentheses in boolean comparisons make it harder to read.

Removed the extra parentheses on line 305 for code readability.

---
 drivers/staging/greybus/audio_codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/greybus/audio_codec.c +1 -1
index 2f05e761fb9a..dfb5322964de 100644
@@ -305,7 +305,7 @@ int gbaudio_module_update(struct gbaudio_codec_info *codec,
 	dev_dbg(module->dev, "%s:Module update %s sequence\n", w->name,
 		enable ? "Enable" : "Disable");
 
-	if ((w->id != snd_soc_dapm_aif_in) && (w->id != snd_soc_dapm_aif_out)) {
+	if (w->id != snd_soc_dapm_aif_in && w->id != snd_soc_dapm_aif_out) {
 		dev_dbg(codec->dev, "No action required for %s\n", w->name);
 		return 0;
 	}
Signature · 1 line
2.45.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Will Walsh

Unnecessary parentheses in boolean comparisons make it harder to read.

Removed the extra parentheses on line 305 for code readability.

I'm not sure this makes a big difference in readability but I personally avoid extra parentheses unless adding them makes a compiler warning go away.

Quoted 17 lines
---
  drivers/staging/greybus/audio_codec.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/greybus/audio_codec.c +1 -1
index 2f05e761fb9a..dfb5322964de 100644
@@ -305,7 +305,7 @@ int gbaudio_module_update(struct gbaudio_codec_info *codec,
  	dev_dbg(module->dev, "%s:Module update %s sequence\n", w->name,
  		enable ? "Enable" : "Disable");
 
-	if ((w->id != snd_soc_dapm_aif_in) && (w->id != snd_soc_dapm_aif_out)) {
+	if (w->id != snd_soc_dapm_aif_in && w->id != snd_soc_dapm_aif_out) {
  		dev_dbg(codec->dev, "No action required for %s\n", w->name);
  		return 0;
  	}
#2 lore raw
Quoted 10 lines · Alex Elder
Quoted 5 lines · Will Walsh

Unnecessary parentheses in boolean comparisons make it harder to read.

Removed the extra parentheses on line 305 for code readability.

I'm not sure this makes a big difference in readability but I personally avoid extra parentheses unless adding them makes a compiler warning go away.

It's not a compiler warning, it checkpatch.

regards,
dan carpenter

#3 lore raw
Quoted 6 lines · Dan Carpenter
Quoted 5 lines · Alex Elder
Quoted 4 lines · Will Walsh

Unnecessary parentheses in boolean comparisons make it harder to read.

Removed the extra parentheses on line 305 for code readability.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I'm not sure this makes a big difference in readability but I personally avoid extra parentheses unless adding them makes a compiler warning go away.

It's not a compiler warning, it checkpatch.

And it is a checkpatch warning that I HATE and keep rejecting, here's where I did so yesterday:

	https://lore.kernel.org/r/2025010738-gong-rewind-2583@gregkh

Will, sorry, but I don't want to take this.

greg k-h

#4 lore raw
In reply to Dan Carpenter
Quoted 6 lines · Dan Carpenter
Quoted 5 lines · Alex Elder
Quoted 4 lines · Will Walsh

Unnecessary parentheses in boolean comparisons make it harder to read.

Removed the extra parentheses on line 305 for code readability.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I'm not sure this makes a big difference in readability but I personally avoid extra parentheses unless adding them makes a compiler warning go away.

It's not a compiler warning, it checkpatch.

I meant compiler "-Wparentheses" warnings, like "suggest parentheses around ‘+’ inside ‘<<’".

But anyway, I have no problem with this being rejected, it doesn't really add value, and to some, it subtracts.

-Alex

Quoted 4 lines

regards,
dan carpenter