From patchwork Fri Mar 24 14:36:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chester Lin X-Patchwork-Id: 13186828 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 A3D02C761AF for ; Fri, 24 Mar 2023 14:38:42 +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=xS7joMgxxnsvBT IM94D81DYHRORAyrH7I3C3Df986EFWgdOxEiysy70ZfjnkNjV2zMTYVHdqLyBbZKu+JCTCPRICUrM KuwCZJIj/6OfO7UDDTlr78HXEUPuNZZNo970V9FrARy/kLXdqsycTwAQigU7WBH2OH9icud2yRmFg eSNMPuGksJwGQ35G6Zs8y/pnTcucE5HJIYqCz25lKvqD/8MfaQewGyDsacpkA3OC9cMorEWXNDBZn pxsVTgcq/iVrj4OCcoAoI7CLQyrKFIHWbDBx4u8yMLvddRLTwdFSZrvRM/IKuQTqsX7HeNROPvtQi L9eTGk9GjhT/W9kGDcxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pfiYH-004eq3-2v; Fri, 24 Mar 2023 14:37:57 +0000 Received: from mail-vi1eur05on20613.outbound.protection.outlook.com ([2a01:111:f400:7d00::613] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pfiYF-004eo2-1K for linux-arm-kernel@lists.infradead.org; Fri, 24 Mar 2023 14:37:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CPIm3kP34qvliYnAPjgi2IKSFq1EoI0xO+tt7afHeMut40WEmUPWTJXFwgmpXjUR+SxTd6wd0NSF7lhBJgqMVZofi6LiQaHcqCcUgwA14InduolipVFiyltCPHGMZei07d1bsaVP3BODw43fFxUNmdTxM/HWer1SSff+LitLf+LH5dWHwj7aRQB5zkhVScUwEARsyqY36tqKxnsnQVpLI9/ZqRlx+l4PsHu1x2fcgmgNAAr6SL9N2dvJpMA9WN/KnSzj+c5bf8pLzd7C6j6Ep4ME7OZSp9gIyMbuWU2MuCZLFkC/IoOXqWImbWQyQ2MumMCctUCFllTnLTPbdI8m/w== 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=eKOqjj/NxCf/lVC0cQL35ptJjLDia5pwy5eR1KjjfbAGfixemZYNtWlDxZrM/ROgJmJnjHXkQLDkRg+tQRsEkYzu+Sq6FrZSetorpkSzUe/VgLlI98QPyxHAmtHEnz7NaI+uIuuDcN0Kd394ABeXzPNroqZl8tQ5M0H0aaJD1NHlOG8s0s/J8zADXbxaArsRW4YgTSks1dtn8Cu861yRBYkoSEFGZzsEwMAfIz7acXZlo/CJ+XH57vefHEXfPeH1m3GjSxN68dYZII1+F9Cg+xjJlALICmMmkyYfRPIaRpGQdMu4yiGORYxfqUx507gy2jJsRSCeXu1SDN9UjxPxAw== 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=uhY8pVSfxrM8IXC5JnXtJ2/Mjvr9Z/H8F9l8dv3qMH6HqjF4Jek2rDOkdldQEWVJRuzQ24c9zg7q40AvmcQAfvAuI+FHnRDEZTC6Ci5GZILThbQqzpsx1dp42uH7rWKupdMJrhR4p0aPKjjgr9h6d+HHW8If6yOis1SZrDLISKW3CyKNUP1y6f07R8gB88d6hxRuDV6dRm2sPG9SIzps0LpICJ/5rhS14AK0p/KLe6ao77LcJ1mlu32LqFGCa4k0r+yXl5rYS9jY37LdOPgZ4QKrgBk2WEn5iKWAvI8IClkN2EMjmz32qdSDYPzUF11e5zSsopZC6kEQGlJKtNWLMg== 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 PAXPR04MB8623.eurprd04.prod.outlook.com (2603:10a6:102:21a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38; Fri, 24 Mar 2023 14:37:51 +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.038; Fri, 24 Mar 2023 14:37:50 +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 v4 4/5] pinctrl: s32cc: Use generic struct data to describe pin function Date: Fri, 24 Mar 2023 22:36:25 +0800 Message-Id: <20230324143626.16336-5-clin@suse.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230324143626.16336-1-clin@suse.com> References: <20230324143626.16336-1-clin@suse.com> X-ClientProxiedBy: TY2PR0101CA0016.apcprd01.prod.exchangelabs.com (2603:1096:404:92::28) To VI1PR0402MB3439.eurprd04.prod.outlook.com (2603:10a6:803:4::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR0402MB3439:EE_|PAXPR04MB8623:EE_ X-MS-Office365-Filtering-Correlation-Id: bd21aa54-b754-4fad-3f6b-08db2c75580f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oVDi9jb+COb7rjVctMcfAsvZkyUuUdMHCsAmZQMuqIhQS6bQ1gRuUB9r0X3OJVfmgbn4XkKcRqZPDY/7XDjuTXWmdEhethlqPhe+aCZ718rq6mcj06SrMtC/gnTt4XlTEat4W5Z27hIMjdt6nsbKRH9MG8nfwfj5pGtwC2RW2oM7fjxEWM5tjOS1FtWKKyGRyDAk/fS+AovP5ScyZ3rOOd5ukOvcxUVwR2lk+ntGG0DwYGX8raGU7J1yWaq98nNIiJ0cBoUFIkKfVCCjMToUjFM2BUKBt0bbcX7QXgy94nGHhw76oaVeRWPPTc7VHmSjUViOLfyFRuiA23QDgGnacxeW5C8HyOdqe5bfxKMpw8cFe/7tN+QK9hy7H4P67jsoJzZT6htx49zutFVSXQOaSW8QKoT33QPqLe2xyzZJ7y1b32LGQKI5EJ3iuEoyCDVPKySWr6OAYzaxoCF8mEhCJzlM2CHr3sxdS2Vmce2Pn/H2g1LA6vkxoT7XczuVDUzC1SsfQgMcI94gZgYMGksmFdmEH0g/5w3IAHeP93UFTZBURLPEyL6y4WqBAeFPtH3Wg73bwXA6s53PC5M9OEkfu4azU2iYHDniy/H5ZHmrMnRUIR/vuzIMZZwaY0icswn0OcVwPukzC0ftfMkOoKWc92ph9Hc/FrwUzFeaov9OjHwRzCqIhKlkjSavazmydZ+o 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:(13230025)(346002)(376002)(366004)(136003)(396003)(39860400002)(451199018)(38100700002)(2906002)(83380400001)(6486002)(478600001)(186003)(2616005)(86362001)(36756003)(110136005)(54906003)(66556008)(8676002)(4326008)(5660300002)(1076003)(66946007)(66476007)(8936002)(107886003)(6506007)(26005)(6512007)(6666004)(316002)(41300700001)(7416002)(41533002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9SNJ56bAmeNoheMN/U3dPjzXSPwbU3JKpQ28Euq0FTt9HHV8FB4f/HIuT1ZVxCkEUn+kStym/VumMdav8PiFJUhhEEtFNfjkdtFbjsCK7WZ3Jel1DM4veuklOFz/46HBSSqAjimt8wlyPhF93r4IyOIrkCoIef4b3fLrvbqpq1MVxXj3N8kD2uhTyldjk8ZaAigrZWEAwQJRmtXBs7zB+G6shhR/E6MSlDzq2Ac86oEBavOsug39Qqz5OrGJvg4mpS7xC3GK1Lp2/uGxjsYeaqC7mcUZEvcaxjZTIJ4VSOJawV9rWaEi/k3e/p9/8WG4lRdAnmwZacfMJTByUEaayCXxwBsQiaOYgJI4L7s3QHpQBYLZXvWGXb6aVQ68Vb/+OZ71/JaulOe/v5cZV0m9KlajPd3+fIqM1b86/HMurfcXeid6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6l+zblIjz6Ac734xC3I2htB7a+GuZrAWXckS8oJHq5y/eTw0zOEM= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd21aa54-b754-4fad-3f6b-08db2c75580f X-MS-Exchange-CrossTenant-AuthSource: VI1PR0402MB3439.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2023 14:37:50.4653 (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: 26+vXZZ0nTDy17eiOUXcItIuS0aGlFyHCZPA9lW3ukcvdWDhhutcQzPaCZaew30U X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8623 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230324_073755_460812_E7C89604 X-CRM114-Status: GOOD ( 14.53 ) 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; }