Article View: linux.kernel.netdev
Article #25443[PATCH net 5/5] nfc: nfcmrvl: do not use devres for the reset GPIO
From: Arina Kharlamova via B4 Relay
Date: Tue, 01 Dec 2026 19:13
Date: Tue, 01 Dec 2026 19:13
112 lines
14517 bytes
14517 bytes
From: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
nfcmrvl_nci_uart_open() runs every time the N_NCI line discipline is
set and passes the tty device to the code that requests the reset GPIO
with devm helpers. The tty device outlives the line discipline, and
nfcmrvl_nci_uart_close() does not release the GPIO. The next open gets
-EBUSY and falls back to the module parameters, without the reset line
and without the DT settings.
This needs a marvell,nfc-uart child node under the UART and a kernel
without serdev ttyport (SERIAL_DEV_CTRL_TTYPORT=n).
Commit 0cbe40112f42 ("NFC: nfcmrvl: do not use device-managed
resources") removed devres from this driver for this reason, and the
conversion to GPIO descriptors brought it back.
Request the GPIO with the unmanaged helpers and put it in
nfcmrvl_nci_unregister_dev() and in the error paths of
nfcmrvl_nci_register_dev().
Fixes: 253350dbf3e7 ("nfc: nfcmrvl: convert to gpio descriptors")
Signed-off-by: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
---
drivers/nfc/nfcmrvl/main.c | 9 +++++++--
drivers/nfc/nfcmrvl/uart.c | 15 +++++++--------
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c
index 6efa83219117..0e2a7f8353b2 100644
--- a/drivers/nfc/nfcmrvl/main.c
+++ b/drivers/nfc/nfcmrvl/main.c
@@ -102,8 +102,10 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
u32 protocols;
priv = kzalloc_obj(*priv);
- if (!priv)
+ if (!priv) {
+ gpiod_put(pdata->reset_gpio);
return ERR_PTR(-ENOMEM);
+ }
priv->drv_data = drv_data;
priv->if_ops = ops;
@@ -114,7 +116,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
if (!priv->config.reset_gpio) {
priv->config.reset_gpio =
- devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
+ gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(priv->config.reset_gpio)) {
priv->config.reset_gpio = NULL;
nfc_err(dev, "failed to get reset gpio\n");
@@ -171,6 +173,7 @@ error_fw_dnld_deinit:
error_free_dev:
nci_free_device(priv->ndev);
error_free:
+ gpiod_put(priv->config.reset_gpio);
kfree(priv);
return ERR_PTR(rc);
}
@@ -186,6 +189,8 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)
nfcmrvl_fw_dnld_deinit(priv);
+ gpiod_put(priv->config.reset_gpio);
+
nci_free_device(ndev);
kfree(priv);
}
diff --git a/drivers/nfc/nfcmrvl/uart.c b/drivers/nfc/nfcmrvl/uart.c
index 9aedd168759c..3023757ab976 100644
--- a/drivers/nfc/nfcmrvl/uart.c
+++ b/drivers/nfc/nfcmrvl/uart.c
@@ -62,8 +62,7 @@ static const struct nfcmrvl_if_ops uart_ops = {
};
static int nfcmrvl_uart_parse_dt(struct device_node *node,
- struct nfcmrvl_platform_data *pdata,
- struct device *dev)
+ struct nfcmrvl_platform_data *pdata)
{
struct device_node *matched_node;
struct gpio_desc *reset_gpio;
@@ -86,11 +85,11 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node,
pdata->flow_control = of_property_read_bool(matched_node, "flow-control");
pdata->break_control = of_property_read_bool(matched_node, "break-control");
- reset_gpio = devm_fwnode_gpiod_get_optional(dev,
- of_fwnode_handle(matched_node),
- "reset", GPIOD_OUT_HIGH,
- "nfcmrvl_reset_n");
- if (IS_ERR(reset_gpio)) {
+ reset_gpio = fwnode_gpiod_get(of_fwnode_handle(matched_node), "reset",
+ GPIOD_OUT_HIGH, "nfcmrvl_reset_n");
+ if (reset_gpio == ERR_PTR(-ENOENT)) {
+ reset_gpio = NULL;
+ } else if (IS_ERR(reset_gpio)) {
of_node_put(matched_node);
return PTR_ERR(reset_gpio);
}
@@ -119,7 +118,7 @@ static int nfcmrvl_nci_uart_open(struct nci_uart *nu)
*/
if (dev && dev->parent && dev->parent->of_node)
- if (nfcmrvl_uart_parse_dt(dev->parent->of_node, &config, dev) == 0)
+ if (nfcmrvl_uart_parse_dt(dev->parent->of_node, &config) == 0)
pdata = &config;
if (!pdata) {
--
Git-157)
Technical Details
Message-ID:
<20261201-s2p-lpr-net-v1-5-6d9279b0f3f1@mbzuai.ac.ae>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375325-linux-kernel-netdev=dewy.ruReferences:
<20261201-s2p-lpr-net-v1-0-6d9279b0f3f1@mbzuai.ac.ae>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375325-linux-kernel-netdev=dewy.ru From: devnull+arina.kharlamova.mbzuai.ac.ae@kernel.org (Arina Kharlamova via B4 Relay) Newsgroups: linux.kernel.netdev Subject: [PATCH net 5/5] nfc: nfcmrvl: do not use devres for the reset GPIO Date: Tue, 01 Dec 2026 23:13:41 +0400 Organization: Usenet Network Message-ID: <20261201-s2p-lpr-net-v1-5-6d9279b0f3f1@mbzuai.ac.ae> References: <20261201-s2p-lpr-net-v1-0-6d9279b0f3f1@mbzuai.ac.ae> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1800171"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:wzoMY0uRT0AhM8kCtXdg85qbO5A= sha256:R+uIb/MU0q4gplOI64AzC4xCqpr9N62vxCVNhweeNv8= sha1:+Ixz8CYAsLwASQDGDhoYDEFzw78= sha256:wYcKZdncwaA4InHasT0nD/Wjpl5J3orD1apiIpDCogQ= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2DEBC117478; Tue, 1 Dec 2026 22:14:18 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.501 X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZuzT-rjnggID; Tue, 1 Dec 2026 22:14:15 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-375325-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 2F7F611747E; Tue, 1 Dec 2026 22:14:06 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 5E3E528F68; Tue, 1 Dec 2026 19:14:02 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796152440; b=CTRmmQ1ABEzUx+S1JVbD87T9T762ZHD0lMKvsGFMISkrpWDzAFDJA7VsTO8+J31FH2uI y0yynaOOM+T8IIvzW+659iHGfItJIaVGiiBQLKv6r1aYsVTZSCjF+X8a0jMtTXxKYb4K+ R+k4XLivU7w9XpYQAPPvhmZxEGNmdTDBu7ZbB4ufg/hiO6EvlhoIVAwImPGJA+og2VqMz ubfc6xLwJcB6bYItKJI/k2ZfqAPoYHyc/lNVrViAnZRVlLKRbNWiFw0Em5FJGkI3eemqd yUvcUYpIlJR28e8zFyeVCcf9JMaqsdQw26JxSXo7fXeafYG0LQCvEewnjrOH7FedvGw== X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796152440; h=X-Original-To:Received:Received:DKIM-Signature:Received:From:Date: Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=kssX9y58vZ3G/eGKRP/mucRkTg69HHUltEtL8vIqJm4=; b=HMjAWPYQXDqYKTsOn3Q26C3nEqJ1JW/Vyyi4Ca3bDW5UmDmMkfp1PuxPMVBsTlHsFpSc rJAkLZOPGkPtcHdhBZ6QfDLqRrgz2g9C82wBvvtszVVR/kGvQOrdWCLoFJPnde7+cg60+ IkhAZnLRWo7aZ1W3qntXlZAbViLZ8Nokl3WbZ3WgYEPY9JIl3jSZCviznVD2iFbC3LsDp x39MQqP6ZX0TmCPsr8F3Vn1X4SPZ8yf+XTtBH9X0zmbcALmdbEXdGvatGDoQKr41H6bB2 RzPQrosir4CTe8OBamhQeTdQnCHV6t7ThrNy5402el8+sM3GMFF2w5VNT34IUa5KC2A== X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OlYCORCs; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E5B9606A327; Tue, 1 Dec 2026 19:14:00 +0000 (UTC) X-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=OlYCORCs X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796152439; b=BW5ECNU8ShcIJ/YMztUchIaGkQZpyeb6Nq9knu7f9gvJfqQndSo4V3g0nNBHB6sseWgK bWgcyTY8QCkz2yThoTm36hvWThxdlsBe9nAVERbFKTpZwxBszIXBzzxH7A194y0LEn2nM t7LMfsgIL97+ntP12ux8bp3/Ed2yy3DhnUc8WT1m/pNONrtsvqui7S9NX9vp4m0XZzx+0 JGy6Lb8vLKbLaZpU2VE1/ocDFXwaWJ+eHDOz6dE9NUbxpzRZdPC18XuRyQKTngjN2bWEe e34p+gKotnogr35O5wkuB0PpOkhx6Xv/Riycas08QwYHk5EF/1G5pJaajLY8B3/s/sQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796152439; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=kssX9y58vZ3G/eGKRP/mucRkTg69HHUltEtL8vIqJm4=; b=HMD5DVeG4tKlYNycYgnwyh9bfL61WB5H3Khd0jFxmRF07z9AdbqcDETNpmDZTTN/iJ+V zjoUINDkpm2vvBR3mlQ/A6yEibEPW/YF01plI8WqfvWAeoOljLxYP4RaA9VUmfLs5Beip 8IEC8G8jMB3u8Dh+xCzRt2aIf71EdxXHRk7T+oiq26OgYseZiHkend7ErEr7RHSPD/p0N ggJcEN7MMEnb9rLFMq0VjzrWEnN0moRPwqgc9e/FdtG1JSIRofG+ipmuLfnr0e7J60Muk QWUI+adPsp2ced8fQX8hD17e05R7m8GDnZTNJV0WHHH7egHN8Wd903vb4CthM2PElpQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OlYCORCs; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 X-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 5DF28606A325; Tue, 1 Dec 2026 19:13:59 +0000 (UTC) X-Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 X-ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796152438; b=nwBHC16/Bb21RGg6sJTtyYqYFpKdcIwh8grTLLPhfKLF0URGDLarF67anFMW5OwDyM7p Fpd52BNEIqSpHcvcoS+mz/npzdQt/INASxnajRfiflbt0xUB6NKqEuSeY2vi2d16sSjoq 1I6Eb1yU0xWOTvSAYXxRcKooAu2H3D4CA9yy8l0wFPlFoJR4ENnBlci63HZKEi9Erhj9K hq4TSYNQKx07cf4eH7Gn2GnI1E/9xc3Wk/GWzLVwthEteLPdJxcTKwB0Qi3PJtfbR/mpN 1a2oALSoVrvYOLSQIdKkMl3sim0rvy1FzZiIn0LuXGHqoHaQ7TG9ZZQ4CKV+iZMF4XQ== X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796152438; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=kssX9y58vZ3G/eGKRP/mucRkTg69HHUltEtL8vIqJm4=; b=glKeaEeTaVl1GXMvdAt4+xX+KU+e38Shhmt6JOLl5qU3Bd/jZCOBQ3OZ8wvRzAXtERRq CUrWkso+TuQTx4cJT6S4l9530lPV43ldyhkjsogPSDUn1Gp2VkL5nNVOmZkPwnMHJD+mU x0pqbmC3AyQ3KLG4A9sF7pqwroByt41WQYHMWmj8x4QBQJIbHA6+pcWN5DLLW7iyVPBsV Cj90m9J2Us/wpbLo81zUupVR4wEfDx/Xm4ZPtqQ2AA4T/jchesrYmcG/0goGasSfOJwmD wUrgVb98Q0dMANZco7x0TBy1YKAETAutvt/JAXLKx+bktJWGwHnn1+c/E5DhcMgYa/A== X-ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 X-Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 7EDBE1F000C1; Tue, 1 Dec 2026 19:13:44 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796152438; bh=kssX9y58vZ3G/eGKRP/mucRkTg69HHUltEtL8vIqJm4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=OlYCORCsEYB9wyGixU7eMGTSiWheMq88vucWT1iz7LlTEGKoz+aHDqok8uZHTO9Dg jEgfZF210prj7AKoo2v5HuF54caAOndRTliBERdGSVJaYUajFdu38s3ag5phLk4tbO 1VUZuxFIiFeLItuMpcwkaBICR3Ru/vNXtP+x/47ZzCAUELK2d60ZZeexRYIQK+LcpN I4Ok7xUgRawrmr+iyLElM5jOQaL0O0/sr4ylTWR+0UDmkph3NZIZnpF7ypezoGBGBb uZp442rWDEh3wuAibWXeZyYRdXPI4jlh+3Viii/U3PXGUIsXLGWhMgsuIwYd3WaIzB MkcROTNYSlbfg== X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 4EEE84EFA8; Tue, 1 Dec 2026 19:13:41 +0000 (UTC) X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261201-s2p-lpr-net-v1-0-6d9279b0f3f1@mbzuai.ac.ae> X-Cc: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>, Andrew Lunn <andrew@lunn.ch>, netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, oe-linux-nfc@lists.linux.dev, Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796152419; l=3969; i=arina.kharlamova@mbzuai.ac.ae; s=20261123; h=from:subject:message-id; bh=JH5b1sfldHtFRK0sPds8PPSA29vbY9imPYfw8QN+g0w=; b=tTV6MaKrBLxVEHN8IwHdO3SooQVYuac1lFgMzzlkTXuPXU2iHJwkP4TlQJhn8w36bQxHlh7TU TC4rUaYXgFQBYlQL9oo50xv/JsZF85yO/K9JsXb4qhEX3LAphJM9Jwp X-Developer-Key: i=arina.kharlamova@mbzuai.ac.ae; a=ed25519; pk=DzQWwMpUtJvSDuzprqvRdbrC72n4Sq8dW6cq3NRt2Mk= X-Endpoint-Received: by B4 Relay for arina.kharlamova@mbzuai.ac.ae/20261123 with auth_id=1625 X-Original-From: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae> X-Reply-To: arina.kharlamova@mbzuai.ac.ae