From patchwork Mon May 27 21:24:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13675875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B76EEC25B79 for ; Mon, 27 May 2024 21:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Qg3YlwY4YDla2sD3i0gck9/kqmomVE2V4HaHyv4Rpqg=; b=l6WiooJN+GOZYJdXPFolcO27eh XQbj55Ix0d57+v5oH8GkhRkfA/3Mlu2V1nQgjIParqyVg1cNm3xZ7V5yrT/iPf0wANtiD7bxrcvNS gZo0xK64sb8fWUxpUjwXDn1BkVb4+RkIUJUEQH8LUe5fbPnP21fbRgz90Yvw7DXe5VRrqDzPCmmTP AVG0uofq/29uWiXV8RWMUSPmTqRgjJGUdc2OPI3bVQVsDm6pajjc55vMn0kKpB9MbeyFqPV8rGEyO PCT6wAghld9MvldEOFKRibYFP/L3QyTRFHO7ryq/urUCnE3itGGggT6jjcMMvLenZq7c21Rfk+ISK 2D+cqpow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBhtQ-0000000GO7T-1VlW; Mon, 27 May 2024 21:28:32 +0000 Received: from fgw22-7.mail.saunalahti.fi ([62.142.5.83]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBhsq-0000000GNkt-1HfC for linux-mediatek@lists.infradead.org; Mon, 27 May 2024 21:28:00 +0000 Received: from localhost (88-113-26-230.elisa-laajakaista.fi [88.113.26.230]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id fa1daa3f-1c6f-11ef-aaf3-005056bdd08f; Tue, 28 May 2024 00:27:53 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-mips@vger.kernel.org Cc: Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Sascha Hauer , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Paul Cercueil , Lakshmi Sowjanya D , Andy Shevchenko Subject: [PATCH v1 05/11] pinctrl: pinmux: Add a convenient define PINCTRL_FUNCTION_DESC() Date: Tue, 28 May 2024 00:24:40 +0300 Message-ID: <20240527212742.1432960-6-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240527212742.1432960-1-andy.shevchenko@gmail.com> References: <20240527212742.1432960-1-andy.shevchenko@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240527_142756_582577_AF48AA6B X-CRM114-Status: GOOD ( 10.44 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Andy Shevchenko Add PINCTRL_FUNCTION_DESC() macro for inline use. While at it, fix adjective form in the comment of PINCTRL_GROUP_DESC(). Signed-off-by: Andy Shevchenko --- drivers/pinctrl/core.h | 2 +- drivers/pinctrl/pinmux.c | 7 ++----- drivers/pinctrl/pinmux.h | 11 ++++++++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h index 837fd5bd903d..4e07707d2435 100644 --- a/drivers/pinctrl/core.h +++ b/drivers/pinctrl/core.h @@ -206,7 +206,7 @@ struct group_desc { void *data; }; -/* Convenience macro to define a generic pin group descriptor */ +/* Convenient macro to define a generic pin group descriptor */ #define PINCTRL_GROUP_DESC(_name, _pins, _num_pins, _data) \ (struct group_desc) { \ .grp = PINCTRL_PINGROUP(_name, _pins, _num_pins), \ diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index addba55334d9..89b42e05f368 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c @@ -858,7 +858,7 @@ EXPORT_SYMBOL_GPL(pinmux_generic_get_function); int pinmux_generic_add_function(struct pinctrl_dev *pctldev, const char *name, const char * const *groups, - const unsigned int num_groups, + const unsigned int ngroups, void *data) { struct function_desc *function; @@ -877,10 +877,7 @@ int pinmux_generic_add_function(struct pinctrl_dev *pctldev, if (!function) return -ENOMEM; - function->name = name; - function->group_names = groups; - function->num_group_names = num_groups; - function->data = data; + function = PINCTRL_FUNCTION_DESC(name, groups, ngroups, data); error = radix_tree_insert(&pctldev->pin_function_tree, selector, function); if (error) diff --git a/drivers/pinctrl/pinmux.h b/drivers/pinctrl/pinmux.h index 7c8aa25ccc80..52e6e4db88b4 100644 --- a/drivers/pinctrl/pinmux.h +++ b/drivers/pinctrl/pinmux.h @@ -145,6 +145,15 @@ struct function_desc { void *data; }; +/* Convenient macro to define a generic pin function descriptor */ +#define PINCTRL_FUNCTION_DESC(_name, _grps, _num_grps, _data) \ +(struct function_desc) { \ + .name = _name, \ + .group_names = _grps, \ + .num_group_names = _num_grps, \ + .data = _data, \ +} + int pinmux_generic_get_function_count(struct pinctrl_dev *pctldev); const char * @@ -162,7 +171,7 @@ struct function_desc *pinmux_generic_get_function(struct pinctrl_dev *pctldev, int pinmux_generic_add_function(struct pinctrl_dev *pctldev, const char *name, const char * const *groups, - unsigned int const num_groups, + unsigned int const ngroups, void *data); int pinmux_generic_remove_function(struct pinctrl_dev *pctldev,