From: Daniel Machon <daniel.machon@microchip.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Steen Hegelund <Steen.Hegelund@microchip.com>,
<UNGLinuxDriver@microchip.com>,
"Richard Cochran" <richardcochran@gmail.com>
Cc: <netdev@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH net-next 3/7] net: sparx5: move VCAP initialization to probe
Date: Wed, 25 Feb 2026 10:05:26 +0100 [thread overview]
Message-ID: <20260225-sparx5-init-deinit-v1-3-97036580b9f0@microchip.com> (raw)
In-Reply-To: <20260225-sparx5-init-deinit-v1-0-97036580b9f0@microchip.com>
Move the VCAP initialization code from sparx5_start() to probe(). Add
proper error handling with a cleanup_vcap label and sparx5_vcap_deinit()
call.
Also, rename sparx5_vcap_destroy() to sparx5_vcap_deinit() to stay
consistent with the naming.
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 16 ++++++++++------
drivers/net/ethernet/microchip/sparx5/sparx5_main.h | 2 +-
drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c | 2 +-
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
index 9887a260bafc..28ee45815c7f 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
@@ -775,10 +775,6 @@ static int sparx5_start(struct sparx5 *sparx5)
sparx5_board_init(sparx5);
- err = sparx5_vcap_init(sparx5);
- if (err)
- return err;
-
/* Start Frame DMA with fallback to register based INJ/XTR */
err = -ENXIO;
if (sparx5->fdma_irq >= 0) {
@@ -985,12 +981,18 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
goto cleanup_ports;
}
+ err = sparx5_vcap_init(sparx5);
+ if (err) {
+ dev_err(sparx5->dev, "Failed to initialize VCAP\n");
+ goto cleanup_ptp;
+ }
+
INIT_LIST_HEAD(&sparx5->mall_entries);
err = sparx5_register_netdevs(sparx5);
if (err) {
dev_err(sparx5->dev, "Failed to register net devices\n");
- goto cleanup_ptp;
+ goto cleanup_vcap;
}
err = sparx5_register_notifier_blocks(sparx5);
@@ -1014,6 +1016,8 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
sparx5_unregister_notifier_blocks(sparx5);
cleanup_netdevs:
sparx5_unregister_netdevs(sparx5);
+cleanup_vcap:
+ sparx5_vcap_deinit(sparx5);
cleanup_ptp:
sparx5_ptp_deinit(sparx5);
cleanup_ports:
@@ -1047,9 +1051,9 @@ static void mchp_sparx5_remove(struct platform_device *pdev)
}
sparx5_unregister_notifier_blocks(sparx5);
sparx5_unregister_netdevs(sparx5);
+ sparx5_vcap_deinit(sparx5);
sparx5_ptp_deinit(sparx5);
ops->fdma_deinit(sparx5);
- sparx5_vcap_destroy(sparx5);
sparx5_destroy_netdevs(sparx5);
destroy_workqueue(sparx5->mact_queue);
}
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.h b/drivers/net/ethernet/microchip/sparx5/sparx5_main.h
index fe7d8bcc0cd9..6a069434fca6 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.h
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.h
@@ -563,7 +563,7 @@ void sparx5_get_hwtimestamp(struct sparx5 *sparx5,
/* sparx5_vcap_impl.c */
int sparx5_vcap_init(struct sparx5 *sparx5);
-void sparx5_vcap_destroy(struct sparx5 *sparx5);
+void sparx5_vcap_deinit(struct sparx5 *sparx5);
/* sparx5_pgid.c */
enum sparx5_pgid_type {
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c b/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c
index 25066ddb8d4d..9b4ea3e22ef8 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_vcap_impl.c
@@ -2083,7 +2083,7 @@ int sparx5_vcap_init(struct sparx5 *sparx5)
return err;
}
-void sparx5_vcap_destroy(struct sparx5 *sparx5)
+void sparx5_vcap_deinit(struct sparx5 *sparx5)
{
struct vcap_control *ctrl = sparx5->vcap_ctrl;
struct vcap_admin *admin, *admin_next;
--
2.34.1
next prev parent reply other threads:[~2026-02-25 9:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 9:05 [PATCH net-next 0/7] net: sparx5: clean up probe/remove init and deinit paths Daniel Machon
2026-02-25 9:05 ` [PATCH net-next 1/7] net: sparx5: call sparx5_start() last in probe() Daniel Machon
2026-02-25 9:05 ` [PATCH net-next 2/7] net: sparx5: move netdev and notifier block registration to probe Daniel Machon
2026-02-25 9:05 ` Daniel Machon [this message]
2026-02-25 9:05 ` [PATCH net-next 4/7] net: sparx5: move MAC table initialization and add deinit function Daniel Machon
2026-02-25 9:05 ` [PATCH net-next 5/7] net: sparx5: move stats " Daniel Machon
2026-02-25 9:05 ` [PATCH net-next 6/7] net: sparx5: move calendar initialization to probe Daniel Machon
2026-02-25 9:05 ` [PATCH net-next 7/7] net: sparx5: move remaining init functions from start() to probe() Daniel Machon
2026-02-25 9:15 ` [PATCH net-next 0/7] net: sparx5: clean up probe/remove init and deinit paths Russell King (Oracle)
2026-02-26 20:12 ` Daniel Machon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260225-sparx5-init-deinit-v1-3-97036580b9f0@microchip.com \
--to=daniel.machon@microchip.com \
--cc=Steen.Hegelund@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®