From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jacopo Mondi Subject: [PATCH v5 02/10] pinctrl: generic: Add macros to unpack properties Date: Thu, 27 Apr 2017 10:19:46 +0200 Message-ID: <1493281194-5200-3-git-send-email-jacopo+renesas@jmondi.org> References: <1493281194-5200-1-git-send-email-jacopo+renesas@jmondi.org> Return-path: In-Reply-To: <1493281194-5200-1-git-send-email-jacopo+renesas-AW8dsiIh9cEdnm+yROfE0A@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org, laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org, chris.brandt-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org Cc: linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-gpio@vger.kernel.org Add PIN_CONF_UNPACK_PARAM and PIN_CONF_UNPACK_ARGS macros useful to unpack generic properties and their arguments Signed-off-by: Jacopo Mondi --- 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 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html