Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2287128lqb; Mon, 27 May 2024 14:37:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUEBE1okDgC5WmK8n27vdLwWFMquubrPkbZtqifOZkQQoGctUZeKNdIEv9BzfKpLEq+eTNXkIR2X1p8ZvtkZzsoSV8pGNMNWowTUQnXIg== X-Google-Smtp-Source: AGHT+IHCekuteoD4Ux+Y9ir3fkG48qSNM7Se4tbBwUKTtJSS+n36SrvRcNmyiCBU4P81iBVD93Dm X-Received: by 2002:a05:6808:e84:b0:3c8:61b8:e518 with SMTP id 5614622812f47-3d1a793998dmr12138442b6e.52.1716845864682; Mon, 27 May 2024 14:37:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716845864; cv=pass; d=google.com; s=arc-20160816; b=tTvBVO2CUcrN+672/F5GU0OCFmrXCzKxaiSmO17YKDP3Hzy56ozuhsoa7Z8wgSGCDl gWTjWA58q6SRAN7bFznxBFMihKH43Oz/5PaALftxzLOz4d/KEWlhedIkHOFBPnkXVi06 wb5mhEkNGrpnn6nGEpPmmXw3nR6XtdNn51GdDXiZqW/9jLmPpU40wusF2pj7Zlszc9RP /Sq/ASDWtWIwQdhZ1LhbHjNfgvGDow0ToEJt4WIbhFviSpiPL0F0SfntCZ0XDxl/X6td CYx5FGaVXcTcbSlvjK0fV4p6Ua9ktcoTDgvUkSTWP/qbHcvqu0qQlJsZc/KX0Wm9XUKW o+vA== 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=9rcNQVvM/SLsTeav2Gq2L2irLBZpc2osNiZ16NUnf2A=; fh=z7aMt8lpfvYPczt5cwX+na7WMHaLGVG5OdTmQLvj1BI=; b=tQ35YM3sKCx6KtSkeh1U5b3bjEN6NFY6ecKLVU1+G+9QNeEUQ6PcvcnjXbqlCRJInD ckZ7vJxTs2XNIzdLdxylyBF8VwvbOIC392PG/7jt/9HVYZwRSWYLbAGBtbP+fJd6cye1 7PLEJeuOP0autKJ5TK8jgyqdhdRXRGg8Xc5yc2CJH+RzuUVRtfn3yw9s+EL1xRtXvCVC wJ6MvaVAY365IAiQrnI1pYGl6iSJyoJzhbNWHQyXSsFDCdlXoMcrH1hB4DGL1NoKYuuU JYq5DcpkOiav7W1jCvb90FuwpQjPDkLqYRY08/eNMHyuy2zYxjBlQoKeghSsbr28aBqS dq4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-191457-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191457-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ac1123aa81si88881056d6.332.2024.05.27.14.37.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 14:37:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191457-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-191457-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191457-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 51FA81C21EA2 for ; Mon, 27 May 2024 21:29:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E103169ADC; Mon, 27 May 2024 21:28:02 +0000 (UTC) Received: from fgw20-7.mail.saunalahti.fi (fgw20-7.mail.saunalahti.fi [62.142.5.81]) (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 AA33D168C3F for ; Mon, 27 May 2024 21:27:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716845281; cv=none; b=H0MERWHRshOIkeZdBt6k0Lqc51n7azI9M3jbYuvE/R/FlbsA9c9/h4a0bmOFqu2XxpOSgQyxmXhip0VGp0dAhtoPq9aC8oMNimbuX0veOegLhJzXBdMKNctZX+J9VjWDQmdvC4ZQ1BLOhhJj3GmVuXDV00VQoKWoTxCoCWwxiss= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716845281; c=relaxed/simple; bh=kk8RhK9dejVAoyIbBmlQksohT7MNO5EKhQf+Y1998jI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cxSgHJSawzc+aIu1gs99O1gX2HuLQ1OtqchjLHdFKVixBgUfmECzITFH8e2RNtqEeLLSYpvm8anrxtd4G+4apLKS16+sYfSYdJKejUY+Qe5ngVjOs6/9WeEtMYyusgG8QpuSScIsEfpcDTq1dxVGWlZgLOxiwY3zA/bRnRh9Kn4= 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.81 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 fgw23.mail.saunalahti.fi (Halon) with ESMTP id fa7a8594-1c6f-11ef-80bc-005056bdfda7; Tue, 28 May 2024 00:27:54 +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 06/11] pinctrl: pinmux: Embed struct pinfunction into struct function_desc Date: Tue, 28 May 2024 00:24:41 +0300 Message-ID: <20240527212742.1432960-7-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> 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 struct function_desc is a particular version of the struct pinfunction with associated opaque data. Start switching pin control core and drivers to use it explicitly. Signed-off-by: Andy Shevchenko --- drivers/pinctrl/pinmux.c | 8 ++++---- drivers/pinctrl/pinmux.h | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index 89b42e05f368..ef6334e7eab2 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c @@ -796,7 +796,7 @@ pinmux_generic_get_function_name(struct pinctrl_dev *pctldev, if (!function) return NULL; - return function->name; + return function->func.name; } EXPORT_SYMBOL_GPL(pinmux_generic_get_function_name); @@ -810,7 +810,7 @@ EXPORT_SYMBOL_GPL(pinmux_generic_get_function_name); int pinmux_generic_get_function_groups(struct pinctrl_dev *pctldev, unsigned int selector, const char * const **groups, - unsigned int * const num_groups) + unsigned int * const ngroups) { struct function_desc *function; @@ -821,8 +821,8 @@ int pinmux_generic_get_function_groups(struct pinctrl_dev *pctldev, __func__, selector); return -EINVAL; } - *groups = function->group_names; - *num_groups = function->num_group_names; + *groups = function->func.groups; + *ngroups = function->func.ngroups; return 0; } diff --git a/drivers/pinctrl/pinmux.h b/drivers/pinctrl/pinmux.h index 52e6e4db88b4..9b57c1cc9d50 100644 --- a/drivers/pinctrl/pinmux.h +++ b/drivers/pinctrl/pinmux.h @@ -133,12 +133,14 @@ static inline void pinmux_init_device_debugfs(struct dentry *devroot, /** * struct function_desc - generic function descriptor + * @func: generic data of the pin function (name and groups of pins) * @name: name of the function * @group_names: array of pin group names * @num_group_names: number of pin group names * @data: pin controller driver specific data */ struct function_desc { + struct pinfunction func; const char *name; const char * const *group_names; int num_group_names; @@ -148,6 +150,7 @@ struct function_desc { /* Convenient macro to define a generic pin function descriptor */ #define PINCTRL_FUNCTION_DESC(_name, _grps, _num_grps, _data) \ (struct function_desc) { \ + .func = PINCTRL_PINFUNCTION(_name, _grps, _num_grps), \ .name = _name, \ .group_names = _grps, \ .num_group_names = _num_grps, \ @@ -163,7 +166,7 @@ pinmux_generic_get_function_name(struct pinctrl_dev *pctldev, int pinmux_generic_get_function_groups(struct pinctrl_dev *pctldev, unsigned int selector, const char * const **groups, - unsigned int * const num_groups); + unsigned int * const ngroups); struct function_desc *pinmux_generic_get_function(struct pinctrl_dev *pctldev, unsigned int selector); -- 2.45.1