Skip to contentSkip to conversation

staging: greybus: Add brackets to avoid precedence issues

PATCH In review Nishka Dasgupta 4 participants 5 messages Mar 4, 2019 – Mar 5, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: greybus: Add brackets to avoid precedence issues

Add parentheses around arguments to avoid precedence issues. Issue found by Checkpatch.

---
 drivers/staging/greybus/camera.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/greybus/camera.c +3 -3
index 615c8e7fd51e..7b653a4fd63f 100644
@@ -180,9 +180,9 @@ static const struct gb_camera_fmt_info *gb_camera_get_format_info(u16 gb_fmt)
 
 #define GB_CAMERA_MAX_SETTINGS_SIZE	8192
 
-#define gcam_dbg(gcam, format...)	dev_dbg(&gcam->bundle->dev, format)
-#define gcam_info(gcam, format...)	dev_info(&gcam->bundle->dev, format)
-#define gcam_err(gcam, format...)	dev_err(&gcam->bundle->dev, format)
+#define gcam_dbg((gcam), format...)	dev_dbg(&gcam->bundle->dev, format)
+#define gcam_info((gcam), format...)	dev_info(&gcam->bundle->dev, format)
+#define gcam_err((gcam), format...)	dev_err(&gcam->bundle->dev, format)
 
 static int gb_camera_operation_sync_flags(struct gb_connection *connection,
 					  int type, unsigned int flags,
Signature · 1 line
2.19.1
maintainer
#1 lore raw
Quoted 13 lines · Nishka Dasgupta

Add parentheses around arguments to avoid precedence issues. Issue found by Checkpatch.

---
 drivers/staging/greybus/camera.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/greybus/camera.c +0 -0
index 615c8e7fd51e..7b653a4fd63f 100644

drivers/staging/greybus/camera.c static const struct gb_camera_fmt_info *gb_camera_get_format_info(u16 gb_fmt) · line 185

Quoted 9 lines
drivers/staging/greybus/camera.c +3 -3
@@ -180,9 +180,9 @@ static const struct gb_camera_fmt_info *gb_camera_get_format_info(u16 gb_fmt)
 
 #define GB_CAMERA_MAX_SETTINGS_SIZE	8192
 
-#define gcam_dbg(gcam, format...)	dev_dbg(&gcam->bundle->dev, format)
-#define gcam_info(gcam, format...)	dev_info(&gcam->bundle->dev, format)
-#define gcam_err(gcam, format...)	dev_err(&gcam->bundle->dev, format)
+#define gcam_dbg((gcam), format...)	dev_dbg(&gcam->bundle->dev, format)
+#define gcam_info((gcam), format...)	dev_info(&gcam->bundle->dev, format)
+#define gcam_err((gcam), format...)	dev_err(&gcam->bundle->dev, format)

Please explain how adding an extra () helps anything here.

I think checkpatch is very confused. Always use your brain when running it, as it is just a perl script and sometimes gets things wrong (like here.)

thanks,

greg k-h

#2 lore raw
Quoted 27 lines · Greg KH
Quoted 13 lines · Nishka Dasgupta

Add parentheses around arguments to avoid precedence issues. Issue found by Checkpatch.

---
 drivers/staging/greybus/camera.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/greybus/camera.c +0 -0
index 615c8e7fd51e..7b653a4fd63f 100644

drivers/staging/greybus/camera.c static const struct gb_camera_fmt_info *gb_camera_get_format_info(u16 gb_fmt) · line 185

Quoted 9 lines
drivers/staging/greybus/camera.c +3 -3
@@ -180,9 +180,9 @@ static const struct gb_camera_fmt_info *gb_camera_get_format_info(u16 gb_fmt)
 
 #define GB_CAMERA_MAX_SETTINGS_SIZE  8192
 
-#define gcam_dbg(gcam, format...)    dev_dbg(&gcam->bundle->dev, format)
-#define gcam_info(gcam, format...)   dev_info(&gcam->bundle->dev, format)
-#define gcam_err(gcam, format...)    dev_err(&gcam->bundle->dev, format)
+#define gcam_dbg((gcam), format...)  dev_dbg(&gcam->bundle->dev, format)
+#define gcam_info((gcam), format...) dev_info(&gcam->bundle->dev, format)
+#define gcam_err((gcam), format...)  dev_err(&gcam->bundle->dev, format)

Please explain how adding an extra () helps anything here.

Quoted 3 lines

I think checkpatch is very confused. Always use your brain when running it, as it is just a perl script and sometimes gets things wrong (like here.)

I thought adding brackets just demarcates the parameter(s)? If that is not necessary or useful, then I won't submit this patch in future.

Quoted 10 lines

thanks,

greg k-h

--
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/20190304190228.GD13830%40kroah.com.
For more options, visit https://groups.google.com/d/optout.

- Nishka

#3 lore raw
Quoted 28 lines · Nishka Dasgupta
Quoted 27 lines · Greg KH
Quoted 13 lines · Nishka Dasgupta

Add parentheses around arguments to avoid precedence issues. Issue found by Checkpatch.

---
 drivers/staging/greybus/camera.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/greybus/camera.c +0 -0
index 615c8e7fd51e..7b653a4fd63f 100644

drivers/staging/greybus/camera.c static const struct gb_camera_fmt_info *gb_camera_get_format_info(u16 gb_fmt) · line 185

Quoted 9 lines
drivers/staging/greybus/camera.c +3 -3
@@ -180,9 +180,9 @@ static const struct gb_camera_fmt_info *gb_camera_get_format_info(u16 gb_fmt)
 
 #define GB_CAMERA_MAX_SETTINGS_SIZE  8192
 
-#define gcam_dbg(gcam, format...)    dev_dbg(&gcam->bundle->dev, format)
-#define gcam_info(gcam, format...)   dev_info(&gcam->bundle->dev, format)
-#define gcam_err(gcam, format...)    dev_err(&gcam->bundle->dev, format)
+#define gcam_dbg((gcam), format...)  dev_dbg(&gcam->bundle->dev, format)
+#define gcam_info((gcam), format...) dev_info(&gcam->bundle->dev, format)
+#define gcam_err((gcam), format...)  dev_err(&gcam->bundle->dev, format)

Please explain how adding an extra () helps anything here.

Quoted 5 lines
Quoted 3 lines

I think checkpatch is very confused. Always use your brain when running it, as it is just a perl script and sometimes gets things wrong (like here.)

I thought adding brackets just demarcates the parameter(s)? If that is not necessary or useful, then I won't submit this patch in future.

I'm not sure what this does. A macro parameter list shouldn't have parentheses in it. I wonder if cpp sees the parentheses and decides it is not a paramater list, but rather part of the macro body? Are these macros actually used? If not you can just remove them.

julia

Quoted 20 lines
Quoted 11 lines

thanks,

greg k-h

--
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/20190304190228.GD13830%40kroah.com.
For more options, visit https://groups.google.com/d/optout.

- Nishka

--
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/CAC4%2B%2BKAwPEjSSTbgnRYXCU%3Dz_WNJAs3rbAtL0XboZ-OCmjCmrg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

#4 lore raw
Quoted 35 lines · Julia Lawall
Quoted 31 lines · Nishka Dasgupta
Quoted 30 lines · Greg KH
Quoted 13 lines · Nishka Dasgupta

Add parentheses around arguments to avoid precedence issues. Issue found by Checkpatch.

---
  drivers/staging/greybus/camera.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/greybus/camera.c +0 -0
index 615c8e7fd51e..7b653a4fd63f 100644

drivers/staging/greybus/camera.c static const struct gb_camera_fmt_info *gb_camera_get_format_info(u16 gb_fmt) · line 185

Quoted 9 lines
drivers/staging/greybus/camera.c +3 -3
@@ -180,9 +180,9 @@ static const struct gb_camera_fmt_info *gb_camera_get_format_info(u16 gb_fmt)
 
  #define GB_CAMERA_MAX_SETTINGS_SIZE  8192
 
-#define gcam_dbg(gcam, format...)    dev_dbg(&gcam->bundle->dev, format)
-#define gcam_info(gcam, format...)   dev_info(&gcam->bundle->dev, format)
-#define gcam_err(gcam, format...)    dev_err(&gcam->bundle->dev, format)
+#define gcam_dbg((gcam), format...)  dev_dbg(&gcam->bundle->dev, format)
+#define gcam_info((gcam), format...) dev_info(&gcam->bundle->dev, format)
+#define gcam_err((gcam), format...)  dev_err(&gcam->bundle->dev, format)

Please explain how adding an extra () helps anything here.

I think checkpatch is very confused. Always use your brain when running it, as it is just a perl script and sometimes gets things wrong (like here.)

Quoted 7 lines
Quoted 2 lines

I thought adding brackets just demarcates the parameter(s)? If that is not necessary or useful, then I won't submit this patch in future.

I'm not sure what this does. A macro parameter list shouldn't have parentheses in it. I wonder if cpp sees the parentheses and decides it is not a paramater list, but rather part of the macro body? Are these macros actually used? If not you can just remove them.

Ah, okay, I'll look into whether these macros are actually used.
- Nishka

Quoted 23 lines

julia

Quoted 20 lines
Quoted 11 lines

thanks,

greg k-h

--
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/20190304190228.GD13830%40kroah.com.
For more options, visit https://groups.google.com/d/optout.

- Nishka

--
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/CAC4%2B%2BKAwPEjSSTbgnRYXCU%3Dz_WNJAs3rbAtL0XboZ-OCmjCmrg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.