[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190617114528.17086-3-skalluru@marvell.com>
Date: Mon, 17 Jun 2019 04:45:26 -0700
From: Sudarsana Reddy Kalluru <skalluru@...vell.com>
To: <davem@...emloft.net>
CC: <netdev@...r.kernel.org>, <mkalderon@...vell.com>,
<aelior@...vell.com>
Subject: [PATCH net-next 2/4] qed: Perform devlink registration after the hardware init.
Devlink callbacks need access to device resources such as ptt lock, hence
performing the devlink registration after the device initialization.
Signed-off-by: Sudarsana Reddy Kalluru <skalluru@...vell.com>
Signed-off-by: Ariel Elior <aelior@...vell.com>
---
drivers/net/ethernet/qlogic/qed/qed_main.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c
index 829dd60..fdd84f5 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_main.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_main.c
@@ -472,22 +472,24 @@ static struct qed_dev *qed_probe(struct pci_dev *pdev,
}
DP_INFO(cdev, "PCI init completed successfully\n");
- rc = qed_devlink_register(cdev);
+ rc = qed_hw_prepare(cdev, QED_PCI_DEFAULT);
if (rc) {
- DP_INFO(cdev, "Failed to register devlink.\n");
+ DP_ERR(cdev, "hw prepare failed\n");
goto err2;
}
- rc = qed_hw_prepare(cdev, QED_PCI_DEFAULT);
+ rc = qed_devlink_register(cdev);
if (rc) {
- DP_ERR(cdev, "hw prepare failed\n");
- goto err2;
+ DP_INFO(cdev, "Failed to register devlink.\n");
+ goto err3;
}
DP_INFO(cdev, "qed_probe completed successfully\n");
return cdev;
+err3:
+ qed_hw_remove(cdev);
err2:
qed_free_pci(cdev);
err1:
@@ -501,14 +503,14 @@ static void qed_remove(struct qed_dev *cdev)
if (!cdev)
return;
+ qed_devlink_unregister(cdev);
+
qed_hw_remove(cdev);
qed_free_pci(cdev);
qed_set_power_state(cdev, PCI_D3hot);
- qed_devlink_unregister(cdev);
-
qed_free_cdev(cdev);
}
--
1.8.3.1
Powered by blists - more mailing lists