All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sudarsana Reddy Kalluru <skalluru@marvell.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <mkalderon@marvell.com>, <aelior@marvell.com>
Subject: [PATCH net-next 2/4] qed: Perform devlink registration after the hardware init.
Date: Mon, 17 Jun 2019 04:45:26 -0700	[thread overview]
Message-ID: <20190617114528.17086-3-skalluru@marvell.com> (raw)
In-Reply-To: <20190617114528.17086-1-skalluru@marvell.com>

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@marvell.com>
Signed-off-by: Ariel Elior <aelior@marvell.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


  parent reply	other threads:[~2019-06-17 11:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 11:45 [PATCH net-next 0/4] qed: Devlink support for config attributes management Sudarsana Reddy Kalluru
2019-06-17 11:45 ` [PATCH net-next 1/4] qed: Add APIs for device attributes configuration Sudarsana Reddy Kalluru
2019-06-17 11:45 ` Sudarsana Reddy Kalluru [this message]
2019-06-17 11:45 ` [PATCH net-next 3/4] qed: Add new file for devlink implementation Sudarsana Reddy Kalluru
2019-06-17 11:45 ` [PATCH net-next 4/4] qed: Add devlink support for configuration attributes Sudarsana Reddy Kalluru
2019-06-17 22:54   ` Jakub Kicinski
2019-06-20 12:09     ` [EXT] " Sudarsana Reddy Kalluru
2019-06-20 13:37       ` Jiri Pirko
2019-06-26  6:46         ` Sudarsana Reddy Kalluru
2019-07-03 12:56         ` Sudarsana Reddy Kalluru
2019-07-03 17:42           ` Jakub Kicinski
2019-07-04  5:49             ` Sudarsana Reddy Kalluru

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=20190617114528.17086-3-skalluru@marvell.com \
    --to=skalluru@marvell.com \
    --cc=aelior@marvell.com \
    --cc=davem@davemloft.net \
    --cc=mkalderon@marvell.com \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.