linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: greybus: avoid macro argument precedence issues
@ 2023-10-21 21:48 Nandha Kumar Singaram
  2023-10-22 10:24 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Nandha Kumar Singaram @ 2023-10-21 21:48 UTC (permalink / raw)
  To: Johan Hovold, Alex Elder, Greg Kroah-Hartman, greybus-dev,
	linux-staging, linux-kernel
  Cc: kumaran.4353

Adhere to linux coding style, added parentheses around
macro argument 'gcam'.
CHECK: Macro argument 'gcam' may be better as '(gcam)' to
avoid precedence issues

Signed-off-by: Nandha Kumar Singaram <nandhakumar.singaram@gmail.com>
---
 drivers/staging/greybus/camera.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
index cdbb42cd413b..ae49e37a87e9 100644
--- a/drivers/staging/greybus/camera.c
+++ b/drivers/staging/greybus/camera.c
@@ -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,
-- 
2.25.1


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

* Re: [PATCH] staging: greybus: avoid macro argument precedence issues
  2023-10-21 21:48 [PATCH] staging: greybus: avoid macro argument precedence issues Nandha Kumar Singaram
@ 2023-10-22 10:24 ` Greg Kroah-Hartman
  2023-10-22 10:34   ` Nandha Kumar Singaram
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2023-10-22 10:24 UTC (permalink / raw)
  To: Nandha Kumar Singaram
  Cc: Johan Hovold, Alex Elder, greybus-dev, linux-staging,
	linux-kernel, kumaran.4353

On Sat, Oct 21, 2023 at 02:48:40PM -0700, Nandha Kumar Singaram wrote:
> Adhere to linux coding style, added parentheses around
> macro argument 'gcam'.
> CHECK: Macro argument 'gcam' may be better as '(gcam)' to
> avoid precedence issues
> 
> Signed-off-by: Nandha Kumar Singaram <nandhakumar.singaram@gmail.com>
> ---
>  drivers/staging/greybus/camera.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
> index cdbb42cd413b..ae49e37a87e9 100644
> --- a/drivers/staging/greybus/camera.c
> +++ b/drivers/staging/greybus/camera.c
> @@ -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)

Sorry, but checkpatch is wrong here, this is not a problem at all.  Look
at what you changed and think about if the macro argument could actually
be anything other than a pointer.

thanks,

greg k-h

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

* Re: [PATCH] staging: greybus: avoid macro argument precedence issues
  2023-10-22 10:24 ` Greg Kroah-Hartman
@ 2023-10-22 10:34   ` Nandha Kumar Singaram
  0 siblings, 0 replies; 3+ messages in thread
From: Nandha Kumar Singaram @ 2023-10-22 10:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Johan Hovold, Alex Elder, greybus-dev, linux-staging,
	linux-kernel, kumaran.4353

On Sun, Oct 22, 2023 at 12:24:48PM +0200, Greg Kroah-Hartman wrote:
> On Sat, Oct 21, 2023 at 02:48:40PM -0700, Nandha Kumar Singaram wrote:
> > Adhere to linux coding style, added parentheses around
> > macro argument 'gcam'.
> > CHECK: Macro argument 'gcam' may be better as '(gcam)' to
> > avoid precedence issues
> > 
> > Signed-off-by: Nandha Kumar Singaram <nandhakumar.singaram@gmail.com>
> > ---
> >  drivers/staging/greybus/camera.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
> > index cdbb42cd413b..ae49e37a87e9 100644
> > --- a/drivers/staging/greybus/camera.c
> > +++ b/drivers/staging/greybus/camera.c
> > @@ -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)
> 
> Sorry, but checkpatch is wrong here, this is not a problem at all.  Look
> at what you changed and think about if the macro argument could actually
> be anything other than a pointer.
> 
> thanks,
> 
> greg k-h

Thanks, I will check it out.

Regards,
Nandha Kumar

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

end of thread, other threads:[~2023-10-22 10:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-21 21:48 [PATCH] staging: greybus: avoid macro argument precedence issues Nandha Kumar Singaram
2023-10-22 10:24 ` Greg Kroah-Hartman
2023-10-22 10:34   ` Nandha Kumar Singaram

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).