From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.67.36.66 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796293949; b=SIJKVSwp0XpK5Z4vwrLTIw/v5jlugsE94GbfY85gP620m4p3Rs0LagkGjA76jvzbPbMw QG6UMLah5jVZEdhKtaMLjHZv5y2h/tsdC67Kc6Ul1uD6YSAX16wGj0WuDzkj8wiCX/n/z 9CjcyGiEdryZVOUzjpSLv09QYZSW9+UkoNAuuzNat0Z4u+az0YDIeIuGjslWTtm5yY4Z7 zHo8sQFPp4a9kw6ANtoKuqgiprfwJwDNIOw7KcrVrAw+1shISHCD9MWVpY1Mh7/DNcTYV pS0ziaG69D2WbGO/R+7eQBYaAzvAj3g7T425GlppHOjjdzm9De6s1S/LuExL77F7zLQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796293949; h=DMARC-Filter:Received:DKIM-Signature:Received:Message-ID:Date: MIME-Version:Subject:To:Cc:References:From:Content-Language: In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=VaMn2TTkeBEnZagRfobdMeMjVIBLVvL+isD4hNJebfQ=; b=EfCmBS3LpM41Qidf7yqRX7r9C1K6jniJPaRZ/hYdjfpZvvk9rWaYGsUwGCU82opsYLRr rklzGmqDy1lyAJJi3sMc8VyySB1BHNrO02VYnKrdXin1ShmN9goVVl2pnG/kqZa+sC505 8+iDozBeHrIgSFgGuR6d1sKY4fZVgh+8KIw5J5ynv7eKdprOtsgHr37TtEujhxSKROr+n l4hRt54PYzXvTpqpNojUMd44M2r1PfJmrTCFAykrBz4QiTDJuqPaKLNr7NgWZTCLRWlev 8MQP4wmPNOgjQ+XBZcuwk3OhPHEKbFlroVtBiXMzww0mnNi9Mj5YH9CDrrsonWyM7Cw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=posteo.net; spf=pass smtp.mailfrom=posteo.net; dkim=pass header.d=posteo.net header.i=@posteo.net header.a=rsa-sha256 header.s=1984.8680eb header.b=YKi1Y23L; arc=none smtp.remote-ip=185.67.36.66 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) (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 4CBF3606A32D for ; Thu, 3 Dec 2026 10:32:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4CBF3606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=posteo.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=posteo.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=posteo.net header.i=@posteo.net header.a=rsa-sha256 header.s=1984.8680eb header.b=YKi1Y23L Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id E0A8B240104 for ; Thu, 3 Dec 2026 11:32:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net; s=1984.8680eb; t=1796293946; bh=VaMn2TTkeBEnZagRfobdMeMjVIBLVvL+isD4hNJebfQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:From:Content-Type: Content-Transfer-Encoding:From; b=YKi1Y23LxZNwjLYh4tGvlZXHKe0pDIVY05eEqEK73GsvroTOTO1aNf0ZG9kJE5hwM GW1b17lxfSkj6P4gTYkHIMEAFSskqc9SdVyw3ON7kW7nhPd5f72GVGnBwlYRk9HHGN uUHn+WWKpjxfzNaBSdBcMXkwIv+pmOu0pUmsecn77r8ZhOwifgr21QR599Zq5vaJhX MlP5zQyViu58Fl5Zx3WOPb7L08GLrPfmzyoJCI+vEisYd6CrXzQIG9zmmfU15afb8P yHfRFmnoELOYIslELEelDPYcnq+m4Jnh/Huh8bLOOiiFrIBAeYYRYl39qwdmpGYsd0 49029enup48GA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4jg9tH6T1wz9rxV; Thu, 3 Dec 2026 11:32:23 +0100 (CET) Message-ID: <9647c127-392e-46e0-87b5-502e05c61e58@posteo.net> Date: Thu, 03 Dec 2026 10:32:25 +0000 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 Subject: Re: [PATCH v3 03/13] pinctrl: berlin: enable module build support To: Jisheng Zhang , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Catalin Marinas , Will Deacon , Mark Rutland , Sebastian Hesselbarth , Stephen Boyd , Brian Masney , Jerome Brunet , Linus Walleij , Philipp Zabel 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 References: <20261130170352.12853-1-jszhang@kernel.org> <20261130170352.12853-4-jszhang@kernel.org> From: Richard GENOUD Content-Language: en-US, fr In-Reply-To: <20261130170352.12853-4-jszhang@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Jisheng, Le 30/11/2026 à 18:03, Jisheng Zhang a écrit : > 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..a0ae75b1d705 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 v2"); checkpatch reports that GPL should be used over "GPL v2" cf commit bf7fbeeae6db ("module: Cure the MODULE_LICENSE "GPL" vs. "GPL v2" bogosity") > +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, \