Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp199287lqb; Tue, 28 May 2024 12:50:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5lwA9uBlUFMm7WBtV5eRSF7ja0717itdIsTKnMguLdE9MfsmzxadxawkRNnjZ9ibB43yWSRXBhzxdNYdVVNRTMuDB3F0+phG1ciJzpw== X-Google-Smtp-Source: AGHT+IGDuXzmbVzV3O+gOtklVzf5xXjMA1vssp75IpAZyR64+8k8lyetNubaRKL9bGmEJXzq+Z53 X-Received: by 2002:ac2:4e70:0:b0:523:5dcc:c72 with SMTP id 2adb3069b0e04-52966ca8c26mr7088774e87.57.1716925818157; Tue, 28 May 2024 12:50:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716925818; cv=pass; d=google.com; s=arc-20160816; b=E2c/Ujf+Jkwi/ZmOrfU9gxq56ACgJH88kCXkZyUyNSssesWx/sGjXw0iEDPV3UAFHC 7OG/OmNnOSYpfBspR2T45wIsMC8rP4MX/sUBMu8FIid+/xzpc6ywyxTRhYoxQYXb+K35 rbGrP2TS71WBYn/h21X0jH4pyOni8ztUbn49naEZyoYgx1eDVbvGr1U9vETI8Viytxvm 0AUKUMjLwJ8BVpDx9uGbQ7JIEvrFyYUi1TRRnnD7MlkEmmy9Ym6CMOxQRZbT8J5tSfQx 4mg61FrycDtWIQv1AcxIvK8xxQ7P81xQOixWJBK/sl/ZROnDGQcvwJYYpNac/wC1tMQ2 3EYQ== 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=H9xWEWxro/WWlUrBW/pAGr1CE2Irj1NlpQU8IUuk1xw=; fh=7i0PP+tNNxhEqCNt1DaWuCxUYRb0M4WDBE9BrWIvsBQ=; b=zUYZ/D4Ax2VWvK3ASeuUZBdeThqDQceSiRXBODLKORVP/7plN61XqgMAzf7rEy7cEa 4B9Pn4baqgplolob4Yw3RDvQYLmY1CrBsBKSzLffqIlwol4WZU2uE1WdAmSs1RiE2Arm G26YGIr9xCC6juTdAedPv1Unhjs/ct6ZEdICjEdM3fAhhLnnP52qBa+gMgdXgpx4UYJn r7FQWmJ2Z9cY4uysw8H6V3Ft7Weo21HgHNfXytjhLWeGzKGhSJMA5iTMEd9okFVkMucV hu3KzfYc7RNc++GGn7KPLAuaSFMgb/pPV5K9Fa7qcJlE7+wjMHz4ew71lkoZkbVzm84t Lllw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-192975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192975-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a634e6b4849si79091166b.738.2024.05.28.12.50.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 12:50:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-192975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192975-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 78E541F242F6 for ; Tue, 28 May 2024 19:50:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35BB5178CC3; Tue, 28 May 2024 19:50:01 +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 2C826178383 for ; Tue, 28 May 2024 19:49:58 +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=1716925800; cv=none; b=f9uw4rl/1MvUF0ehr1HeJNRirg8M2yXzfnzWN8XIfq/PZKXdgCwgjn4zEtrC75IxqawkKGpMuFhNu49/iIirRhBVFXRf+hqXX6I9cCUeEGXFrcsmn3OQaZeqrNbR8vLeota+N7QbmjlkS1aU42sOKQbEEdvw39SFlDLHaDH/tbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925800; c=relaxed/simple; bh=1XtJWJ5PeRCirDjIxVIenINEe49dxjFUvbLv8ITaSpM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EbZiPle9/ewdN9n/9IFRvre7eP8EORr35Zevr1GtJJDhvoKqecgYEOu59trYTpw3w3wnQG/Gd+GR0b0qnd5sw/6DC/dTm4O4z6vvFJSVxm6bhcmhsd9kJR38tdw/SO667vhz5Zbf6jVGSAcpixL+BgneemxL6NEQwkSNO37qraw= 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 fgw20.mail.saunalahti.fi (Halon) with ESMTP id 74d7eea0-1d2b-11ef-8d3a-005056bd6ce9; Tue, 28 May 2024 22:49:56 +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 01/11] pinctrl: berlin: Make use of struct pinfunction Date: Tue, 28 May 2024 22:44:52 +0300 Message-ID: <20240528194951.1489887-2-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 Since pin control provides a generic data type for the pin function, use it in the driver. Signed-off-by: Andy Shevchenko --- drivers/pinctrl/berlin/berlin.c | 21 +++++++++------------ drivers/pinctrl/berlin/berlin.h | 6 ------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/pinctrl/berlin/berlin.c b/drivers/pinctrl/berlin/berlin.c index 9550cc8095c2..c372a2a24be4 100644 --- a/drivers/pinctrl/berlin/berlin.c +++ b/drivers/pinctrl/berlin/berlin.c @@ -27,7 +27,7 @@ struct berlin_pinctrl { struct regmap *regmap; struct device *dev; const struct berlin_pinctrl_desc *desc; - struct berlin_pinctrl_function *functions; + struct pinfunction *functions; unsigned nfunctions; struct pinctrl_dev *pctrl_dev; }; @@ -120,12 +120,12 @@ static const char *berlin_pinmux_get_function_name(struct pinctrl_dev *pctrl_dev static int berlin_pinmux_get_function_groups(struct pinctrl_dev *pctrl_dev, unsigned function, const char * const **groups, - unsigned * const num_groups) + unsigned * const ngroups) { struct berlin_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctrl_dev); *groups = pctrl->functions[function].groups; - *num_groups = pctrl->functions[function].ngroups; + *ngroups = pctrl->functions[function].ngroups; return 0; } @@ -153,7 +153,7 @@ static int berlin_pinmux_set(struct pinctrl_dev *pctrl_dev, { struct berlin_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctrl_dev); const struct berlin_desc_group *group_desc = pctrl->desc->groups + group; - struct berlin_pinctrl_function *func = pctrl->functions + function; + struct pinfunction *func = pctrl->functions + function; struct berlin_desc_function *function_desc = berlin_pinctrl_find_function_by_name(pctrl, group_desc, func->name); @@ -180,7 +180,7 @@ static const struct pinmux_ops berlin_pinmux_ops = { static int berlin_pinctrl_add_function(struct berlin_pinctrl *pctrl, const char *name) { - struct berlin_pinctrl_function *function = pctrl->functions; + struct pinfunction *function = pctrl->functions; while (function->name) { if (!strcmp(function->name, name)) { @@ -214,8 +214,7 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev) } /* we will reallocate later */ - pctrl->functions = kcalloc(max_functions, - sizeof(*pctrl->functions), GFP_KERNEL); + pctrl->functions = kcalloc(max_functions, sizeof(*pctrl->functions), GFP_KERNEL); if (!pctrl->functions) return -ENOMEM; @@ -242,8 +241,7 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev) desc_function = desc_group->functions; while (desc_function->name) { - struct berlin_pinctrl_function - *function = pctrl->functions; + struct pinfunction *function = pctrl->functions; const char **groups; bool found = false; @@ -264,16 +262,15 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev) function->groups = devm_kcalloc(&pdev->dev, function->ngroups, - sizeof(char *), + sizeof(*function->groups), GFP_KERNEL); - if (!function->groups) { kfree(pctrl->functions); return -ENOMEM; } } - groups = function->groups; + groups = (const char **)function->groups; while (*groups) groups++; diff --git a/drivers/pinctrl/berlin/berlin.h b/drivers/pinctrl/berlin/berlin.h index d7787754d1ed..231aab61d415 100644 --- a/drivers/pinctrl/berlin/berlin.h +++ b/drivers/pinctrl/berlin/berlin.h @@ -28,12 +28,6 @@ struct berlin_pinctrl_desc { unsigned ngroups; }; -struct berlin_pinctrl_function { - const char *name; - const char **groups; - unsigned ngroups; -}; - #define BERLIN_PINCTRL_GROUP(_name, _offset, _width, _lsb, ...) \ { \ .name = _name, \ -- 2.45.1