linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jsmart2021@gmail.com (James Smart)
Subject: [PATCH v2 6/7] nvme_fc: move remote port get/put/free location
Date: Tue, 26 Sep 2017 21:50:45 -0700	[thread overview]
Message-ID: <20170927045046.22238-7-jsmart2021@gmail.com> (raw)
In-Reply-To: <20170927045046.22238-1-jsmart2021@gmail.com>

move nvme_fc_rport_get/put and rport free to higher in the file to
avoid adding prototypes to resolve references in upcoming code additions

Signed-off-by: James Smart <james.smart at broadcom.com>
---
 drivers/nvme/host/fc.c | 78 +++++++++++++++++++++++++-------------------------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 740dd471ec7a..608d37d15495 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -457,6 +457,45 @@ nvme_fc_unregister_localport(struct nvme_fc_local_port *portptr)
 }
 EXPORT_SYMBOL_GPL(nvme_fc_unregister_localport);
 
+static void
+nvme_fc_free_rport(struct kref *ref)
+{
+	struct nvme_fc_rport *rport =
+		container_of(ref, struct nvme_fc_rport, ref);
+	struct nvme_fc_lport *lport =
+			localport_to_lport(rport->remoteport.localport);
+	unsigned long flags;
+
+	WARN_ON(rport->remoteport.port_state != FC_OBJSTATE_DELETED);
+	WARN_ON(!list_empty(&rport->ctrl_list));
+
+	/* remove from lport list */
+	spin_lock_irqsave(&nvme_fc_lock, flags);
+	list_del(&rport->endp_list);
+	spin_unlock_irqrestore(&nvme_fc_lock, flags);
+
+	/* let the LLDD know we've finished tearing it down */
+	lport->ops->remoteport_delete(&rport->remoteport);
+
+	ida_simple_remove(&lport->endp_cnt, rport->remoteport.port_num);
+
+	kfree(rport);
+
+	nvme_fc_lport_put(lport);
+}
+
+static void
+nvme_fc_rport_put(struct nvme_fc_rport *rport)
+{
+	kref_put(&rport->ref, nvme_fc_free_rport);
+}
+
+static int
+nvme_fc_rport_get(struct nvme_fc_rport *rport)
+{
+	return kref_get_unless_zero(&rport->ref);
+}
+
 /**
  * nvme_fc_register_remoteport - transport entry point called by an
  *                              LLDD to register the existence of a NVME
@@ -544,45 +583,6 @@ nvme_fc_register_remoteport(struct nvme_fc_local_port *localport,
 }
 EXPORT_SYMBOL_GPL(nvme_fc_register_remoteport);
 
-static void
-nvme_fc_free_rport(struct kref *ref)
-{
-	struct nvme_fc_rport *rport =
-		container_of(ref, struct nvme_fc_rport, ref);
-	struct nvme_fc_lport *lport =
-			localport_to_lport(rport->remoteport.localport);
-	unsigned long flags;
-
-	WARN_ON(rport->remoteport.port_state != FC_OBJSTATE_DELETED);
-	WARN_ON(!list_empty(&rport->ctrl_list));
-
-	/* remove from lport list */
-	spin_lock_irqsave(&nvme_fc_lock, flags);
-	list_del(&rport->endp_list);
-	spin_unlock_irqrestore(&nvme_fc_lock, flags);
-
-	/* let the LLDD know we've finished tearing it down */
-	lport->ops->remoteport_delete(&rport->remoteport);
-
-	ida_simple_remove(&lport->endp_cnt, rport->remoteport.port_num);
-
-	kfree(rport);
-
-	nvme_fc_lport_put(lport);
-}
-
-static void
-nvme_fc_rport_put(struct nvme_fc_rport *rport)
-{
-	kref_put(&rport->ref, nvme_fc_free_rport);
-}
-
-static int
-nvme_fc_rport_get(struct nvme_fc_rport *rport)
-{
-	return kref_get_unless_zero(&rport->ref);
-}
-
 static int
 nvme_fc_abort_lsops(struct nvme_fc_rport *rport)
 {
-- 
2.13.1

  parent reply	other threads:[~2017-09-27  4:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27  4:50 [PATCH v2 0/7] nvme_fc: add dev_loss_tmo support James Smart
2017-09-27  4:50 ` [PATCH v2 1/7] nvme core: allow controller RESETTING to RECONNECTING transition James Smart
2017-10-04  8:28   ` Christoph Hellwig
2017-10-11 10:02     ` Sagi Grimberg
2017-09-27  4:50 ` [PATCH v2 2/7] nvme_fc: change ctlr state assignments during reset/reconnect James Smart
2017-10-05  7:57   ` Christoph Hellwig
2017-10-07 15:53     ` James Smart
2017-10-11 10:07       ` Sagi Grimberg
2017-10-11 14:29         ` James Smart
2017-09-27  4:50 ` [PATCH v2 3/7] nvme_fc: add a dev_loss_tmo field to the remoteport James Smart
2017-10-11 10:11   ` Sagi Grimberg
2017-10-11 14:35     ` James Smart
2017-09-27  4:50 ` [PATCH v2 4/7] nvme_fc: add dev_loss_tmo to controller James Smart
2017-10-05  8:00   ` Christoph Hellwig
2017-10-07 16:08     ` James Smart
2017-10-11 10:17       ` Sagi Grimberg
2017-10-11 15:10         ` James Smart
2017-10-11 10:14   ` Sagi Grimberg
2017-09-27  4:50 ` [PATCH v2 5/7] nvme_fc: check connectivity before initiating reconnects James Smart
2017-10-05  8:01   ` Christoph Hellwig
2017-09-27  4:50 ` James Smart [this message]
2017-10-05  8:03   ` [PATCH v2 6/7] nvme_fc: move remote port get/put/free location Christoph Hellwig
2017-10-11 10:18   ` Sagi Grimberg
2017-09-27  4:50 ` [PATCH v2 7/7] nvme_fc: add dev_loss_tmo timeout and remoteport resume support James Smart
2017-10-11 10:29   ` Sagi Grimberg
2017-10-11 14:52     ` James Smart

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=20170927045046.22238-7-jsmart2021@gmail.com \
    --to=jsmart2021@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;
as well as URLs for NNTP newsgroup(s).