linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 2/5] nvme-fc: merge __nvme_fc_schedule_delete_work into __nvme_fc_del_ctrl
Date: Sun, 29 Oct 2017 10:44:28 +0200	[thread overview]
Message-ID: <20171029084431.8702-3-hch@lst.de> (raw)
In-Reply-To: <20171029084431.8702-1-hch@lst.de>

No need to have two functions doing the same thing.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/host/fc.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 50cc17e99475..827e9efbe556 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -2663,22 +2663,14 @@ nvme_fc_delete_ctrl_work(struct work_struct *work)
 	nvme_put_ctrl(&ctrl->ctrl);
 }
 
-static bool
-__nvme_fc_schedule_delete_work(struct nvme_fc_ctrl *ctrl)
-{
-	if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING))
-		return true;
-
-	if (!queue_work(nvme_wq, &ctrl->delete_work))
-		return true;
-
-	return false;
-}
-
 static int
 __nvme_fc_del_ctrl(struct nvme_fc_ctrl *ctrl)
 {
-	return __nvme_fc_schedule_delete_work(ctrl) ? -EBUSY : 0;
+	if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING))
+		return -EBUSY;
+	if (!queue_work(nvme_wq, &ctrl->delete_work))
+		return -EBUSY;
+	return 0;
 }
 
 /*
@@ -2724,7 +2716,7 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status)
 				"NVME-FC{%d}: Max reconnect attempts (%d) "
 				"reached. Removing controller\n",
 				ctrl->cnum, ctrl->ctrl.nr_reconnects);
-		WARN_ON(__nvme_fc_schedule_delete_work(ctrl));
+		WARN_ON(__nvme_fc_del_ctrl(ctrl));
 	}
 }
 
-- 
2.14.2

  parent reply	other threads:[~2017-10-29  8:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-29  8:44 controller deletion consolidation Christoph Hellwig
2017-10-29  8:44 ` [PATCH 1/5] nvme-fc: avoid workqueue flush stalls Christoph Hellwig
2017-10-29  8:44 ` Christoph Hellwig [this message]
2017-10-30 19:52   ` [PATCH 2/5] nvme-fc: merge __nvme_fc_schedule_delete_work into __nvme_fc_del_ctrl James Smart
2017-10-29  8:44 ` [PATCH 3/5] nvme: move controller deletion to common code Christoph Hellwig
2017-10-30 19:58   ` James Smart
2017-10-29  8:44 ` [PATCH 4/5] nvme-rdma: remove nvme_rdma_remove_ctrl Christoph Hellwig
2017-10-29  8:44 ` [PATCH 5/5] nvme: consolidate common code from ->reset_work Christoph Hellwig
2017-10-30 20:00   ` James Smart
2017-10-29 11:57 ` controller deletion consolidation Sagi Grimberg

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=20171029084431.8702-3-hch@lst.de \
    --to=hch@lst.de \
    /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).