Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp220744lqb; Tue, 28 May 2024 13:32:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYfi/JW4INvlGOwbjMcNrt9wc4LAvddsMpCt2jNZATHOTInh/LGm7RLQ1E21PzROnzN+s9pkKaE11cA9LxxnN1dbsZEacMMF8TCeA8cA== X-Google-Smtp-Source: AGHT+IFgNzXJlyMPW3yEXdyJtQ3F4lo3xaoQG7ZCKApVEq71QQt9OUj3+FA3LPXX94QzvH/GHaOB X-Received: by 2002:a05:6a20:a124:b0:1a9:3cda:dc3c with SMTP id adf61e73a8af0-1b212f94ef1mr14298640637.61.1716928373455; Tue, 28 May 2024 13:32:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716928373; cv=pass; d=google.com; s=arc-20160816; b=wRPBo3nY007+CU+I/NmT30n7i/NkHawDhtbvqQHCnUpHsVALEwD4KLHI/ud9UUl3sY IRfVc7KF3BlAOCB/og+iIC23DjaAMy5iDH2Gz4ly/TiS2z2dakM8UHweNA+lAv3ad7f8 zUl5EFXqjUCdebnHf4pyO72y2Uq5lcnHIYAehy/aXQIdox5FYhUTsvQXMaTGrGMQgM4Z XXq0Y9UnY07Zp6zEwTodqe0L+MJC+xull4BpQpC26yOy2ywnOAT4CT7TE65rMpI+aY1w gAsGbK1DAD80rK7ilDsTkvnRbT3bhB+nbMrX1bgw8xU4X76aQ3HfdTVcLSgv7hUo3DcN 4PLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=P68p1HEYJ1lmWTQLtyhb1b1Guc+wf5SaQtvljCR8Cac=; fh=7i0PP+tNNxhEqCNt1DaWuCxUYRb0M4WDBE9BrWIvsBQ=; b=VEIm5K/X+Weukaqva4mdGs3WC2JW0dxHPjeD51jckwsCVEOz7kcaHV0Oi7b/ECq5n7 l5OOeYrlfI5d56DX0M014CF5996lThyqVXTDLjB/61JJ4SzaVuf6VBRnuIFZEWMdhmmN dzwZl2YSBZiWPUkVEGfrLNFHkRjl2hRrhewNqvKUuNZwYkof0Exb6qgg6K9PgJuMxomn dngZl5Bs2bNEmlRiDAtVWmYSSbS+TlcVp74TzFcxmIM0MBNEYyAip7GgZdSmi3x/4Jx6 kQckhXxNLjk3ggIBA+mm/vfWVjtBPSO+jQcbHk/MlMEIBXAfVzYin5fmrc2zT/EoEgo/ KyLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-192977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fd9dc0c7si8363679b3a.355.2024.05.28.13.32.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 13:32:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-192977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E9FFEB24659 for ; Tue, 28 May 2024 19:50:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCD3017A932; Tue, 28 May 2024 19:50:05 +0000 (UTC) Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7752178CF5 for ; Tue, 28 May 2024 19:50:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.82 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925805; cv=none; b=VjJHP+WApW5S6YskT1cm+mWh9ig2unDZ9q5Ez9R8WBAmAct6jsw6gUinlvuUhFaul++6PJeQlmfXL0v/YcqEO2vLzAWsxIwIVVOjidKzSYkuaPXvz3lwTMdAURC/byYJfnAINq8fQEVsKnhhcYRYK7vphdz/1eeplf+mCx+7Tqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925805; c=relaxed/simple; bh=A072AS2lgROf98Pwf8Fyliy4tqTS+ybyUetYZctK3UE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mRy2hlhXi0QIPU2ajTHO26WvuBmNek/Qd5fNP6HjKalKi0crVDCNaQ8kdrk3KXy0HLn2YQvZ/fLssnARvrh7y0jwVlfVH7QSaat11fmF6hc1r3Sxa3M8Iqw9bCEzlhdZebB/4xnURCG+5i1T1RHOD2jclo+acUTw+bQaVFMI6Kc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-230.elisa-laajakaista.fi [88.113.26.230]) by fgw22.mail.saunalahti.fi (Halon) with ESMTP id 7893f7c5-1d2b-11ef-8e2b-005056bdf889; Tue, 28 May 2024 22:50:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Linus Walleij , Daniel Golle , 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 v2 05/11] pinctrl: pinmux: Add a convenient define PINCTRL_FUNCTION_DESC() Date: Tue, 28 May 2024 22:44:56 +0300 Message-ID: <20240528194951.1489887-6-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240528194951.1489887-1-andy.shevchenko@gmail.com> References: <20240528194951.1489887-1-andy.shevchenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 | 9 +++------ drivers/pinctrl/pinmux.h | 11 ++++++++++- 3 files changed, 14 insertions(+), 8 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..8d69fa1b0bff 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c @@ -852,13 +852,13 @@ EXPORT_SYMBOL_GPL(pinmux_generic_get_function); * @pctldev: pin controller device * @name: name of the function * @groups: array of pin groups - * @num_groups: number of pin groups + * @ngroups: number of pin groups * @data: pin controller driver specific data */ 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, -- 2.45.1