Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1675393 > unrolled thread

[PATCH 4/4] Staging: rtl8712 : osdep_intf.h: fix macro coding style issue

Started byJaya Durga <rjdurga@gmail.com>
First post2017-06-27 10:00 +0200
Last post2017-06-27 12:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 4/4] Staging: rtl8712 : osdep_intf.h: fix macro coding style issue Jaya Durga <rjdurga@gmail.com> - 2017-06-27 10:00 +0200
    Re: [PATCH 4/4] Staging: rtl8712 : osdep_intf.h: fix macro coding  style issue Frans Klaver <fransklaver@gmail.com> - 2017-06-27 12:10 +0200

#1675393 — [PATCH 4/4] Staging: rtl8712 : osdep_intf.h: fix macro coding style issue

FromJaya Durga <rjdurga@gmail.com>
Date2017-06-27 10:00 +0200
Subject[PATCH 4/4] Staging: rtl8712 : osdep_intf.h: fix macro coding style issue
Message-ID<tWTzJ-5PY-25@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1675489 — Re: [PATCH 4/4] Staging: rtl8712 : osdep_intf.h: fix macro coding style issue

FromFrans Klaver <fransklaver@gmail.com>
Date2017-06-27 12:10 +0200
SubjectRe: [PATCH 4/4] Staging: rtl8712 : osdep_intf.h: fix macro coding style issue
Message-ID<tWVBv-7pX-3@gated-at.bofh.it>
In reply to#1675393
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web