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: 13188661 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 88531C76195 for ; Mon, 27 Mar 2023 06:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EnaRXFAGA45vrZGd9T+OeC4xclTXqB7Ruhdwd7ou6bE=; b=Zy37TYNqsSAD5p MCgZOJKL9anwKFT3pgS5gpsKrq0qW62uxT2TTh7OIxBm8p/EsnN8XDTsOOvlUdLwD1g4CglU0PGSA PdsSDW6Nu/0vnM1Cj+OkZwPngiIun1FPwor9QVrtLwEaOniTDnli/mxEqpY5qpXpaERZ4NbDyTy+6 k+Ly9UdVWzJ1avukswJ45flBLu+cokd8IAhvSD1WkLfecBlKtoCp0M3/Bls2F1DrUTmOC2Gzg2DeJ dH3VeiQnKzst8GaN46HEJSpid2N+HYed8z32oYX++TgESFip5eAnHUiYPfpVchkO6RoLpqqEkkGhv mHmWQds/UTMzl66pm53w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pggLf-009xnN-0E; Mon, 27 Mar 2023 06:28:55 +0000 Received: from mail-db8eur05on2060e.outbound.protection.outlook.com ([2a01:111:f400:7e1a::60e] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pggLa-009xky-1S for linux-arm-kernel@lists.infradead.org; Mon, 27 Mar 2023 06:28:52 +0000 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/ClqpRBsW8bd7m87MnthKuBMGF4J4h1qCT2IVgjL0+9CcmF/06vB8UWHwht7OEj61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-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230326_232850_495056_B90802EE X-CRM114-Status: GOOD ( 14.37 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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; }