From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796394499; b=ur+rblbgXkNv30p/4NeAEVP6DB2s2SD8R1ZuFV0rzd8+Or8i2dRijl23FBpmqK/Qe44e Vzopru1cWxEG6S2SnF7YE4J9ephPSFeSv/wEU7A/9OztZHGnagpNZjMGTbWY3R7nfHFwC dzmYog+uunUlzkStQGApp8DCMoxP4c0pUocygulpzGMy0MTiyOz0AUgRkhvKBCH9QANhP edFF2GMf8Skmmhmn9Cx7fZ8haA+RMEFUdjI0z0urel3uQxRn/tKQg+zs417CQrpycAqSw 0f6tGbeh+j87syu+OAbInwe6YawKwscSvwY+OdGYi7ybqHzOQ2KCkYhPAvzweXfiRXg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796394499; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=LgpKPTPt2v1GQ59XxfCUusZOWf9yG2jLBa/vEqduB2w=; b=HLm/zPLnUwA0eyjJGPfI0gZq01bX35w6VfwWLchgwvxaLz/0Eu1en9KYfDIqdMhNlJVu c6mgqJ+gjvXcxnjgm0sB2SSCkvoZLQhhmTKZR+4sdIXuZXc+dlukLd+X95ZT7GGohT8WM bYVXOB0OXte/b2UDq14Hs4bYxBthOV1IWcAJJuhVRWxPzr1zG1DrbDBcrTqnd+16wcAPL sjVNBG3eTs53aE387UXVm9GiVvzguqk/syD4IxK/B8xc+0Ll4rCi7Jy8RGoq72mkuw+oS QqS/rR9ODmjGLgHlRf77IKGz0FTxZ4DaVMAJanWpA4L/0KlHRBxail9opcIlfNlWP0w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QTykzOjj; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDD92606A334; Fri, 4 Dec 2026 14:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QTykzOjj Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37F4A1F0092C; Fri, 4 Dec 2026 14:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796394499; bh=LgpKPTPt2v1GQ59XxfCUusZOWf9yG2jLBa/vEqduB2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QTykzOjj57mJgx8WlJFP+0vSs++5s7Pq7JyJrhdJHoj371TN6Tjx0Z/s/pLjmA0ts CYLEmkAcF0LtzLfMm1/nNyCKB3gdR6knKoEYdxgTVRDlm/x7g01y3pVSpLx4ZjuEct b0tZGdh9RW4FkMMEzYkj+1QthOZ7iEFiVTMoWx78JuxmEtXFAlDqGPEBeTVPjbWDS4 Hc2gMT3SuIXdKq3W3l2V1ets9x0hoOHlwhshSIc14TFN9DBC+a/kW61Wy0Cx7tEq62 65U4gZgg+OWkkvJoT1anf1b1xckt1Ob1Zw6CExKiiNSyAtUoaUjsOvGjY/+WTIerOa S7lZhJsNybVmg== From: Jisheng Zhang To: Rob Herring , Conor Dooley , Krzysztof Kozlowski , Catalin Marinas , Will Deacon , Mark Rutland , Sebastian Hesselbarth , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Philipp Zabel , Lee Jones Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, mfd@lists.linux.dev, Richard GENOUD Subject: [PATCH v4 03/13] pinctrl: berlin: enable module build support Date: Fri, 4 Dec 2026 22:07:16 +0800 Message-ID: <20261204140732.31223-4-jszhang@kernel.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261204140732.31223-1-jszhang@kernel.org> References: <20261204140732.31223-1-jszhang@kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit For Android GKI + vendor_dlkm deployments, where vendor-specific drivers must be kept separate from the GKI vmlinux and loaded as modules from the vendor partition, we need to enable module build support for berlin pinctrl drivers. To acchive this goal: 1.Use devm_* APIs to alloc memory, so that we don't need to care free when unloading. 2.Export two symbols which will be used by SoC pinctrl drivers. 3.Add MODULE_LICENSE and MODULE_DESCRIPTION Signed-off-by: Jisheng Zhang --- drivers/pinctrl/berlin/berlin.c | 27 ++++++++++++++------------- drivers/pinctrl/berlin/berlin.h | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/drivers/pinctrl/berlin/berlin.c b/drivers/pinctrl/berlin/berlin.c index 8a612ce2d1d3..9337de1973af 100644 --- a/drivers/pinctrl/berlin/berlin.c +++ b/drivers/pinctrl/berlin/berlin.c @@ -215,7 +215,8 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev) } /* we will reallocate later */ - pctrl->functions = kzalloc_objs(*pctrl->functions, max_functions); + pctrl->functions = devm_kcalloc(&pdev->dev, max_functions, + sizeof(*pctrl->functions), GFP_KERNEL); if (!pctrl->functions) return -ENOMEM; @@ -230,13 +231,11 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev) } } - new_functions = krealloc(pctrl->functions, - pctrl->nfunctions * sizeof(*pctrl->functions), - GFP_KERNEL); - if (!new_functions) { - kfree(pctrl->functions); + new_functions = devm_krealloc(&pdev->dev, pctrl->functions, + pctrl->nfunctions * sizeof(*pctrl->functions), + GFP_KERNEL); + if (!new_functions) return -ENOMEM; - } pctrl->functions = new_functions; /* map functions to theirs groups */ @@ -257,20 +256,17 @@ static int berlin_pinctrl_build_state(struct platform_device *pdev) function++; } - if (!found) { - kfree(pctrl->functions); + if (!found) return -EINVAL; - } if (!function->groups) { function->groups = devm_kzalloc_objs(&pdev->dev, *function->groups, function->ngroups); - if (!function->groups) { - kfree(pctrl->functions); + + if (!function->groups) return -ENOMEM; - } } groups = (const char **)function->groups; @@ -326,6 +322,7 @@ int berlin_pinctrl_probe_regmap(struct platform_device *pdev, return 0; } +EXPORT_SYMBOL_GPL(berlin_pinctrl_probe_regmap); int berlin_pinctrl_probe(struct platform_device *pdev, const struct berlin_pinctrl_desc *desc) @@ -340,3 +337,7 @@ int berlin_pinctrl_probe(struct platform_device *pdev, return berlin_pinctrl_probe_regmap(pdev, desc, regmap); } +EXPORT_SYMBOL_GPL(berlin_pinctrl_probe); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("pinctrl library for Synaptics SoCs"); diff --git a/drivers/pinctrl/berlin/berlin.h b/drivers/pinctrl/berlin/berlin.h index 7e7096842eda..8ff70d682593 100644 --- a/drivers/pinctrl/berlin/berlin.h +++ b/drivers/pinctrl/berlin/berlin.h @@ -20,6 +20,8 @@ struct berlin_desc_group { u16 offset; u8 bit_width; u8 lsb; + u16 conf_offset; + u8 conf_bits; struct berlin_desc_function *functions; }; @@ -28,6 +30,19 @@ struct berlin_pinctrl_desc { unsigned ngroups; }; +#define BERLIN_PINCTRLCONF_GROUP(_name, _offset, _width, _lsb, \ + _conf_offset, _conf_bits, ...) \ + { \ + .name = _name, \ + .offset = _offset, \ + .bit_width = _width, \ + .lsb = _lsb, \ + .conf_offset = _conf_offset, \ + .conf_bits = _conf_bits, \ + .functions = (struct berlin_desc_function[]){ \ + __VA_ARGS__, { } }, \ + } + #define BERLIN_PINCTRL_GROUP(_name, _offset, _width, _lsb, ...) \ { \ .name = _name, \ -- 2.55.0