mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 12:31:52 -04:00
net: sparx5: move VCAP initialization to probe
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> Link: https://patch.msgid.link/20260227-sparx5-init-deinit-v2-2-10ba54ccf005@microchip.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
b8909aad5b
commit
3a95973e7c
@@ -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) {
|
||||
@@ -1002,12 +998,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);
|
||||
@@ -1020,6 +1022,8 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
|
||||
|
||||
cleanup_netdevs:
|
||||
sparx5_unregister_netdevs(sparx5);
|
||||
cleanup_vcap:
|
||||
sparx5_vcap_deinit(sparx5);
|
||||
cleanup_ptp:
|
||||
sparx5_ptp_deinit(sparx5);
|
||||
cleanup_ports:
|
||||
@@ -1049,9 +1053,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);
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user