From patchwork Thu Apr 27 08:19:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 9702505 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0D06D6032C for ; Thu, 27 Apr 2017 08:21:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3E0D2861A for ; Thu, 27 Apr 2017 08:21:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8A3E285EE; Thu, 27 Apr 2017 08:21:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B053D28614 for ; Thu, 27 Apr 2017 08:21:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936779AbdD0IUe (ORCPT ); Thu, 27 Apr 2017 04:20:34 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:38871 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751994AbdD0IUZ (ORCPT ); Thu, 27 Apr 2017 04:20:25 -0400 Received: from w540.lan (unknown [IPv6:2001:b07:6442:1ac4:a1e0:4671:8f61:de6c]) (Authenticated sender: jacopo@jmondi.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 4018B1720C3; Thu, 27 Apr 2017 10:20:17 +0200 (CEST) From: Jacopo Mondi To: linus.walleij@linaro.org, geert+renesas@glider.be, laurent.pinchart@ideasonboard.com, chris.brandt@renesas.com, robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk Cc: linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org 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> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493281194-5200-1-git-send-email-jacopo+renesas@jmondi.org> References: <1493281194-5200-1-git-send-email-jacopo+renesas@jmondi.org> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add PIN_CONF_UNPACK_PARAM and PIN_CONF_UNPACK_ARGS macros useful to unpack generic properties and their arguments Signed-off-by: Jacopo Mondi Reviewed-by: Geert Uytterhoeven --- 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