[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1493281194-5200-3-git-send-email-jacopo+renesas@jmondi.org>
Date: Thu, 27 Apr 2017 10:19:46 +0200
From: Jacopo Mondi <jacopo+renesas@...ndi.org>
To: linus.walleij@...aro.org, geert+renesas@...der.be,
laurent.pinchart@...asonboard.com, chris.brandt@...esas.com,
robh+dt@...nel.org, mark.rutland@....com, linux@...linux.org.uk
Cc: linux-renesas-soc@...r.kernel.org, linux-gpio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v5 02/10] pinctrl: generic: Add macros to unpack properties
Add PIN_CONF_UNPACK_PARAM and PIN_CONF_UNPACK_ARGS macros useful to
unpack generic properties and their arguments
Signed-off-by: Jacopo Mondi <jacopo+renesas@...ndi.org>
---
include/linux/pinctrl/pinconf-generic.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index 279e3c5..2cd2a03 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -118,7 +118,9 @@ enum pin_config_param {
/*
* Helpful configuration macro to be used in tables etc.
*/
-#define PIN_CONF_PACKED(p, a) ((a << 8) | ((unsigned long) p & 0xffUL))
+#define PIN_CONF_PACKED(p, a) (((a) << 8) | ((unsigned long) (p) & 0xffUL))
+#define PIN_CONF_UNPACK_PARAM(c) ((c) & 0xffUL)
+#define PIN_CONF_UNPACK_ARGS(c) ((c) >> 8)
/*
* The following inlines stuffs a configuration parameter and data value
--
2.7.4
Powered by blists - more mailing lists