From patchwork Mon Mar 27 06:27:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chester Lin X-Patchwork-Id: 75231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1313825vqo; Sun, 26 Mar 2023 23:49:20 -0700 (PDT) X-Google-Smtp-Source: AKy350amEgNVj5/BzDzmhoDquRuvflLyF3lx2U4oXFdZxZPpC6apeUu+t9/0qhgj5j2o3qiykRBl X-Received: by 2002:aa7:dc10:0:b0:502:1d19:d252 with SMTP id b16-20020aa7dc10000000b005021d19d252mr10031570edu.17.1679899759949; Sun, 26 Mar 2023 23:49:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679899759; cv=pass; d=google.com; s=arc-20160816; b=CuiZZnQdnqJG3H+MRitCTSF7raRECaKjXtg8WiQ0ZzUhyvmKp0uCrFPUM+VSpABMez wZqE6OT4FABh+6dCFsfp0JIFCNyD2+hbjdASZEpZ0bsMJGo5DyJEbz6yfQk0uVqBZ76G ooI1MvzN9/RG8N0kTl0dsmIeV5/PGHCiJRbY5Xl0qhAtTIxgeX4TJP3fyC7KEY9t0Qi+ rbdXdX8B2x8+J8GXoBM1FROl05x4TMNfsuE7TRz+Ha9FAAVDLaM8AGbWBkUm0GaJWG/4 5I9YeUkmFmDudJoznix7Q78+aTN/33/KzhiIeinrpTlOuFApH3ME5juk4KRF05YCUl5X iFgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fN4oSk/fg6PFOW23zvTHHTxM97j8i0UUQgD086d68p0=; b=Ay03ZCRNA1pMtT9jgSDV1ZanlAjAh2eRENws0cOPK6gVYCFgDNCjexOZt0Ufcc4oFm sMoyQI+KJbtAqhpobG+paJXL0hvEtrMyjvwggmsR81y83WrAowrxVFHjswyrRlpgzUhA J7+HaP9VhCbGWDw59Om323PtGLLJRBtpvUamNwtMqJWdqjDfILtJmSFX6GMoHNx3tCBQ Ei5rhkP54cvCSv/yhAzaOKe7NVDCLhD5VvAjtwDgHZiCaGSHfTkV41jyOpXRCT8ttr/f Ii7fcg0qqpM0wkSpkG8KaVMvQmNaiEVqbKlNEARc7qL+mPvMYkCttmm8N9OMCdxi/agS Lhbw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=RulfTfXo; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o21-20020aa7c515000000b005002ebedfc7si11146995edq.403.2023.03.26.23.48.56; Sun, 26 Mar 2023 23:49:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=RulfTfXo; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232248AbjC0G3W (ORCPT + 99 others); Mon, 27 Mar 2023 02:29:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232071AbjC0G3U (ORCPT ); Mon, 27 Mar 2023 02:29:20 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071.outbound.protection.outlook.com [40.107.20.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82D6346BC; Sun, 26 Mar 2023 23:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AmWrdSz18eS+akcJ+Ad2W1rHiMuZP48RnLe5Qhs3kho7apUhQS+BGU2E+zOp6WheRHuMOqC2RD8i4EzNX71K84iCEof8igrfiCQdNN+b7x+GPBV6W2siljjc3oQDIz/N1Fbg6qAl+DrlcnqLEHPOR4KMHFWtWe8MbjQ1lTZ0M0DLfku+/LmiwrSV/fkQfKyOCxJUBlmcbF0UVg6uT4CyHK+svgbeymIFRbqaG7kQSf6VAjjf+RnVaXFPxulTWX0KgkjimKziRc819lng+67nPr7IRJuJsiEXhywgEe+Vi/2LMqGKsjtQDIW0zbPNwPr3CpjBlcEoI0ZuuQfFHdVCmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fN4oSk/fg6PFOW23zvTHHTxM97j8i0UUQgD086d68p0=; b=DwZf4fRSizcXMmXEl32sLHKi5zYx7XE5zxker9q12N3zTzBJm8WAZlcrtY35KmHCXC56J/u8VI9GtWtlIP4R1f9XsSyQJIUo/Az6+XDNYgoOMnVzEJmIWPY8prTjqMQWIYOdPEsdBZqa6V2WQ7GQL4bNXiF0pzFm/5UBHQjU1fFtQeoTy8iyvof09BrKmomcOK1Gw7WtRrGzHuLv9fo72eBqc0QoYUUdcLkkmrzhK3F3DRf/5NczcxPmTRu39ymRIl5rojxzDRZ7QCErAP31ID4eHKTteRDYJ1yjafRtRifspwNd/0HjWJXLw2GKofyKuEFgia8ELNiYQok9PVulYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fN4oSk/fg6PFOW23zvTHHTxM97j8i0UUQgD086d68p0=; b=RulfTfXoQRGsdRYjSVXKnI12GeFriDIBxz5xgCGbHFtk4uvH+wajeNyNLis6TWmb+Tf7de9DSIH7ar6SEWPqipWDHIYHyNpAPMcEpuetkxS5NxzV3paANbq5nC/VHVaj7Lz8mlIPzNSqWLwtCxWzwCW13pGTY4Mke2CLtP6ZGsOV23JSYhIEktRXqnMQI1v3yWWhDz2Qz4AX7Un80w4xc8zJ5xuemtNv/g/o2eebJ5bYjP88vyjKphKKyICOhJUwaKh8QYwqWP8kF8avQ03WwOQzB/zz33ZLHGAV1oCNU9PSgSegL+d3n2nzNk8m9b11t4JlmP2uSpAQa1/Jw4KSmg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from VI1PR0402MB3439.eurprd04.prod.outlook.com (2603:10a6:803:4::13) by DBBPR04MB7930.eurprd04.prod.outlook.com (2603:10a6:10:1ea::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.30; Mon, 27 Mar 2023 06:28:47 +0000 Received: from VI1PR0402MB3439.eurprd04.prod.outlook.com ([fe80::6802:b2c3:5f12:8f9f]) by VI1PR0402MB3439.eurprd04.prod.outlook.com ([fe80::6802:b2c3:5f12:8f9f%2]) with mapi id 15.20.6178.041; Mon, 27 Mar 2023 06:28:47 +0000 From: Chester Lin To: Linus Walleij , Andy Shevchenko Cc: Chester Lin , NXP S32 Linux Team , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ghennadi Procopciuc , Andrei Stefanescu , Radu Pirea , =?utf-8?q?Andreas_F=C3=A4rber?= , Matthias Brugger Subject: [PATCH v5 4/5] pinctrl: s32cc: Use generic struct data to describe pin function Date: Mon, 27 Mar 2023 14:27:53 +0800 Message-Id: <20230327062754.3326-5-clin@suse.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230327062754.3326-1-clin@suse.com> References: <20230327062754.3326-1-clin@suse.com> X-ClientProxiedBy: TY2PR06CA0004.apcprd06.prod.outlook.com (2603:1096:404:42::16) To VI1PR0402MB3439.eurprd04.prod.outlook.com (2603:10a6:803:4::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR0402MB3439:EE_|DBBPR04MB7930:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ce31f70-f071-4686-55fa-08db2e8c857d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wpNhkx2Wg+60O6Nje15ghYLqqjDUaMXlSviXiLkFiA3M1PyR7G2mvcVD85SLSKIe0SVxhmm3opF9AVc3v6d3btSTaIOlOV7GeVogswlP7uNQxCXNtKSs+c1FR97151mYuFdFs31WHI1cnB3+YmrL3I9FXNx3WDjIMKHxG1igY17TgM6G9bCNFc8QW7Mz02kDdlcmL05ZxQrHFRcJny2NFSayuwWUOv/bpMX2X9vOkdQFZigChaEkcJHZi/oPCTdayk1k7DOVHdAyS9Nd+1NzLt+7VC/tIdXuTpp0kNWRWhh8FdDGAv7eoaipLtvrA/0mB16TmUIwPNDxhPZ5gqCVP5JL0QAH0BRzX0oGl2ZfljkGhWDT3yDCeSU1FOJeWBA7cgn7gpnjb10ZxbKX/8XfT7m7oej1pyhPjWphksMFaS2ay+Gz/e7Akhm8ts5Z7LflpYXhRoHHb09mynUM4VyANBLugrABYvqVbNgA9yt/lrVLnnqX3V7/g2aKgWLzQU+rA/vUd6XOOtnZLOYr4VUsKCCCqibr/rqTZzp1uXWz3I2BDtpQ82tPT2kcZDwEzWuKyEEP6xGf7Q2fN9unHcwapcKkZyTDrCMqOWNY31FtOuY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR0402MB3439.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(376002)(396003)(346002)(366004)(136003)(451199021)(316002)(110136005)(54906003)(478600001)(5660300002)(8936002)(36756003)(86362001)(38100700002)(7416002)(2906002)(4326008)(66556008)(66476007)(8676002)(66946007)(41300700001)(107886003)(6666004)(186003)(6512007)(6506007)(1076003)(26005)(2616005)(83380400001)(6486002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: y+pAZPUX+WHnikZ1eTtjmunUzFPVJ9u2GDcO5FH1msr1a9plv/s9CHeJ6HwpqdMT74gMFOojN23PlnC8WI0Pk4839cp/B3Z0DqCEszHI9uwLwp1YtPCqGMqdMxaSSUaAZCeGNuS7dtOx3ImDlrDgBpqB4vEEK3kIg+7vE448g2cbwQn6uPapcBSWUGdORca5O5K+k90qzXsSU+m8XpuRvTzhSqBHIbIctFb5VjSrHzN6XyJLLCLMg8vmKA5/o0tkpZq9LRJDEpyKCCO10zYEv38JPuDaGzxHuhzjPC3gETvCzZWh9fomfbmiP3zYdCi9VU07ZUoUN8R/1xqXoKYQhX2nG4/y0AINH+5nKxUXP15S8pFg8mbd5bkQ/Ph6LhipVVpkN1hT7WN+2/GWymjxv7BYJNhFOQNITnrayj9cMIGi98jHnL6jNiVHSkM4Zt4ZdowN/ClqpRBsW8bd7m87MnthKuBMGF4J4h1qCT2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E0= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ce31f70-f071-4686-55fa-08db2e8c857d X-MS-Exchange-CrossTenant-AuthSource: VI1PR0402MB3439.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2023 06:28:47.6377 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5QJqKXnsyNCiPe5k4Va6vf5PSPNenJoSoUHo8kq6sb4epe0QrscWrDsJrYvgTT2/ X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7930 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761502570812323370?= X-GMAIL-MSGID: =?utf-8?q?1761502570812323370?= Replace struct s32_pmx_func with generic struct pinfunction since they have the same data fields. Suggested-by: Andy Shevchenko Signed-off-by: Chester Lin Reviewed-by: Andy Shevchenko --- (No change since v3) drivers/pinctrl/nxp/pinctrl-s32.h | 14 +------------- drivers/pinctrl/nxp/pinctrl-s32cc.c | 18 +++++++++++------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/pinctrl/nxp/pinctrl-s32.h b/drivers/pinctrl/nxp/pinctrl-s32.h index 850cd668f406..2f7aecd462e4 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32.h +++ b/drivers/pinctrl/nxp/pinctrl-s32.h @@ -24,18 +24,6 @@ struct s32_pin_group { unsigned int *pin_sss; }; -/** - * struct s32_pmx_func - describes S32 pinmux functions - * @name: the name of this specific function - * @groups: corresponding pin groups - * @num_groups: the number of groups - */ -struct s32_pmx_func { - const char *name; - const char **groups; - unsigned int num_groups; -}; - /** * struct s32_pin_range - pin ID range for each memory region. * @start: start pin ID @@ -52,7 +40,7 @@ struct s32_pinctrl_soc_info { unsigned int npins; struct s32_pin_group *groups; unsigned int ngroups; - struct s32_pmx_func *functions; + struct pinfunction *functions; unsigned int nfunctions; unsigned int grp_index; const struct s32_pin_range *mem_pin_ranges; diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c index e65c88162d7f..8373468719b6 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32cc.c +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c @@ -364,7 +364,7 @@ static int s32_pmx_get_groups(struct pinctrl_dev *pctldev, const struct s32_pinctrl_soc_info *info = ipctl->info; *groups = info->functions[selector].groups; - *num_groups = info->functions[selector].num_groups; + *num_groups = info->functions[selector].ngroups; return 0; } @@ -785,8 +785,9 @@ static int s32_pinctrl_parse_functions(struct device_node *np, u32 index) { struct device_node *child; - struct s32_pmx_func *func; + struct pinfunction *func; struct s32_pin_group *grp; + const char **groups; u32 i = 0; int ret = 0; @@ -796,18 +797,19 @@ static int s32_pinctrl_parse_functions(struct device_node *np, /* Initialise function */ func->name = np->name; - func->num_groups = of_get_child_count(np); - if (func->num_groups == 0) { + func->ngroups = of_get_child_count(np); + if (func->ngroups == 0) { dev_err(info->dev, "no groups defined in %pOF\n", np); return -EINVAL; } - func->groups = devm_kcalloc(info->dev, func->num_groups, + + groups = devm_kcalloc(info->dev, func->ngroups, sizeof(*func->groups), GFP_KERNEL); - if (!func->groups) + if (!groups) return -ENOMEM; for_each_child_of_node(np, child) { - func->groups[i] = child->name; + groups[i] = child->name; grp = &info->groups[info->grp_index++]; ret = s32_pinctrl_parse_groups(child, grp, info); if (ret) @@ -815,6 +817,8 @@ static int s32_pinctrl_parse_functions(struct device_node *np, i++; } + func->groups = groups; + return 0; }