diff mbox

[V2,2/6] ARM: keystone2: psc-defs: use adequate () for macros

Message ID 1456426427-23166-3-git-send-email-nm@ti.com
State Accepted
Commit 7ca12b97001a1d45623b98f54ba5bf789146b71b
Headers show

Commit Message

Nishanth Menon Feb. 25, 2016, 6:53 p.m. UTC
'#define X a | b' is better defined as '#define X (a | b)' for obvious
reasons.

Signed-off-by: Nishanth Menon <nm@ti.com>

---
V2: No change
V1: https://patchwork.ozlabs.org/patch/510211/
 arch/arm/mach-keystone/include/mach/psc_defs.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.7.0

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Comments

Nishanth Menon Feb. 27, 2016, 12:13 a.m. UTC | #1
On Fri, Feb 26, 2016 at 12:17 PM, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Feb 25, 2016 at 12:53:43PM -0600, Nishanth Menon wrote:

>

>> '#define X a | b' is better defined as '#define X (a | b)' for obvious

>> reasons.

>>

>> Signed-off-by: Nishanth Menon <nm@ti.com>

>

> Reviewed-by: Tom Rini <trini@konsulko.com>

>

> But this makes my head hurt.  Can we somehow do any of that with less

> parenthesis?  Like, is this really something we must macro? Or can we

> re-factor it?  I had to highlight every open/close to be happy it was

> correct, which is not a good sign.


I will try and give it a shot and repost - yeah - it was pretty
convoluted in the first place might be changing it to a static inline
might be a simpler approach..


-- 
---
Regards,
Nishanth Menon
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
diff mbox

Patch

diff --git a/arch/arm/mach-keystone/include/mach/psc_defs.h b/arch/arm/mach-keystone/include/mach/psc_defs.h
index 70d22cf21787..2202946be5ea 100644
--- a/arch/arm/mach-keystone/include/mach/psc_defs.h
+++ b/arch/arm/mach-keystone/include/mach/psc_defs.h
@@ -30,9 +30,9 @@ 
 #define BOOTBITMASK(x, y)     ((((((u32)1 << (((u32)x) - ((u32)y) + (u32)1)) - \
 				  (u32)1)) << ((u32)y)))
 
-#define BOOT_READ_BITFIELD(z, x, y)    (((u32)z) & BOOTBITMASK(x, y)) >> (y)
-#define BOOT_SET_BITFIELD(z, f, x, y)  (((u32)z) & ~BOOTBITMASK(x, y)) | \
-					 ((((u32)f) << (y)) & BOOTBITMASK(x, y))
+#define BOOT_READ_BITFIELD(z, x, y)    ((((u32)z) & BOOTBITMASK(x, y)) >> (y))
+#define BOOT_SET_BITFIELD(z, f, x, y)  ((((u32)z) & ~BOOTBITMASK(x, y)) | \
+					((((u32)f) << (y)) & BOOTBITMASK(x, y)))
 
 /* PDCTL */
 #define PSC_REG_PDCTL_SET_NEXT(x, y)        BOOT_SET_BITFIELD((x), (y), 0, 0)