mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 4/4] Staging: rtl8712 : osdep_intf.h: fix macro coding style issue
@ 2017-06-27  7:48 Jaya Durga
  2017-06-27  9:59 ` Frans Klaver
  0 siblings, 1 reply; 2+ messages in thread
From: Jaya Durga @ 2017-06-27  7:48 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, florian.c.schilhabel, robsonde, becher.jannik,
	devel, linux-kernel, Jaya Durga, Jaya Durga

Fix checkpatch.pl warning of the form "CHECK" Macro argument 'x'
may be better as '(x)' to avoid precedence issues.

Signed-off-by: Jaya Durga <jayad@cdac.in>
---
 drivers/staging/rtl8712/osdep_intf.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/osdep_intf.h b/drivers/staging/rtl8712/osdep_intf.h
index 1985423..dac6aed 100644
--- a/drivers/staging/rtl8712/osdep_intf.h
+++ b/drivers/staging/rtl8712/osdep_intf.h
@@ -29,7 +29,10 @@
 #include "osdep_service.h"
 #include "drv_types.h"
 
-#define RND4(x)	((((x) >> 2) + ((((x) & 3) == 0) ?  0 : 1)) << 2)
+static inline unsigned int RND4(unsigned int x)
+{
+	return (((x >> 2) + (((x & 3) == 0) ?  0 : 1)) << 2);
+}
 
 struct intf_priv {
 	u8 *intf_dev;
-- 
1.9.1

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

* Re: [PATCH 4/4] Staging: rtl8712 : osdep_intf.h: fix macro coding style issue
  2017-06-27  7:48 [PATCH 4/4] Staging: rtl8712 : osdep_intf.h: fix macro coding style issue Jaya Durga
@ 2017-06-27  9:59 ` Frans Klaver
  0 siblings, 0 replies; 2+ messages in thread
From: Frans Klaver @ 2017-06-27  9:59 UTC (permalink / raw)
  To: Jaya Durga
  Cc: Greg KH, Larry.Finger, Florian Schilhabel, robsonde,
	becher.jannik, driverdevel, linux-kernel, Jaya Durga

On Tue, Jun 27, 2017 at 9:48 AM, Jaya Durga <rjdurga@gmail.com> wrote:
> Fix checkpatch.pl warning of the form "CHECK" Macro argument 'x'
> may be better as '(x)' to avoid precedence issues.
>
> Signed-off-by: Jaya Durga <jayad@cdac.in>
> ---
>  drivers/staging/rtl8712/osdep_intf.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8712/osdep_intf.h b/drivers/staging/rtl8712/osdep_intf.h
> index 1985423..dac6aed 100644
> --- a/drivers/staging/rtl8712/osdep_intf.h
> +++ b/drivers/staging/rtl8712/osdep_intf.h
> @@ -29,7 +29,10 @@
>  #include "osdep_service.h"
>  #include "drv_types.h"
>
> -#define RND4(x)        ((((x) >> 2) + ((((x) & 3) == 0) ?  0 : 1)) << 2)
> +static inline unsigned int RND4(unsigned int x)
> +{
> +       return (((x >> 2) + (((x & 3) == 0) ?  0 : 1)) << 2);
> +}

Looks like the checkpatch warning has already been addressed, or
checkpatch throws a false positive there.

I like this inline function better than the macro, since

RND(get_some_value());

may return funky results.

Frans

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

end of thread, other threads:[~2017-06-27  9:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27  7:48 [PATCH 4/4] Staging: rtl8712 : osdep_intf.h: fix macro coding style issue Jaya Durga
2017-06-27  9:59 ` Frans Klaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®