All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>, Keith Busch <kbusch@kernel.org>,
	linux-nvme@lists.infradead.org, Hannes Reinecke <hare@suse.de>
Subject: [PATCH 3/3] nvme: make 'at_head' parameter for __nvme_submit_sync_cmd() boolean
Date: Wed,  8 Feb 2023 16:17:20 +0100	[thread overview]
Message-ID: <20230208151720.109130-4-hare@suse.de> (raw)
In-Reply-To: <20230208151720.109130-1-hare@suse.de>

Use a boolean for the 'at_head' parameter in __nvme_submit_sync_cmd()
to improve readability and consistency; it's being converted into a
boolean anyway.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/nvme/host/auth.c    |  2 +-
 drivers/nvme/host/core.c    |  8 ++++----
 drivers/nvme/host/fabrics.c | 12 +++++-------
 drivers/nvme/host/nvme.h    |  2 +-
 4 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
index 8a1edbf69b47..d4002845064a 100644
--- a/drivers/nvme/host/auth.c
+++ b/drivers/nvme/host/auth.c
@@ -83,7 +83,7 @@ static int nvme_auth_submit(struct nvme_ctrl *ctrl, int qid,
 
 	/* Clear failfast flag to allow for retries */
 	req->cmd_flags &= ~REQ_FAILFAST_DRIVER;
-	ret = __nvme_submit_sync_cmd(req, NULL, data, data_len, 0);
+	ret = __nvme_submit_sync_cmd(req, NULL, data, data_len, false);
 	if (ret > 0)
 		dev_warn(ctrl->device,
 			"qid %d auth_send failed with status %d\n", qid, ret);
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 278f7aa674c6..3a4b5e99e648 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1040,7 +1040,7 @@ EXPORT_SYMBOL_GPL(__nvme_alloc_rq);
  * if the result is positive, it's an NVM Express status code
  */
 int __nvme_submit_sync_cmd(struct request *req, union nvme_result *result,
-			   void *buffer, unsigned bufflen, int at_head)
+			   void *buffer, unsigned bufflen, bool at_head)
 {
 	int ret;
 
@@ -1068,7 +1068,7 @@ int nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
-	return __nvme_submit_sync_cmd(req, NULL, buffer, bufflen, 0);
+	return __nvme_submit_sync_cmd(req, NULL, buffer, bufflen, false);
 }
 EXPORT_SYMBOL_GPL(nvme_submit_sync_cmd);
 
@@ -1498,7 +1498,7 @@ static int nvme_features(struct nvme_ctrl *dev, u8 op, unsigned int fid,
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
-	ret = __nvme_submit_sync_cmd(req, &res, buffer, buflen, 0);
+	ret = __nvme_submit_sync_cmd(req, &res, buffer, buflen, false);
 	if (ret >= 0 && result)
 		*result = le32_to_cpu(res.u32);
 	return ret;
@@ -2234,7 +2234,7 @@ static int nvme_sec_submit(void *data, u16 spsp, u8 secp, void *buffer, size_t l
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
-	return __nvme_submit_sync_cmd(req, NULL, buffer, len, 1);
+	return __nvme_submit_sync_cmd(req, NULL, buffer, len, true);
 }
 
 static void nvme_configure_opal(struct nvme_ctrl *ctrl, bool was_suspended)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 7d2fd4b83bbc..db11c54b8d0e 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -157,8 +157,7 @@ int nvmf_reg_read32(struct nvme_ctrl *ctrl, u32 off, u32 *val)
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
-	ret = __nvme_submit_sync_cmd(req, &res, NULL, 0, 0);
-
+	ret = __nvme_submit_sync_cmd(req, &res, NULL, 0, false);
 	if (ret >= 0)
 		*val = le64_to_cpu(res.u64);
 	if (unlikely(ret != 0))
@@ -207,8 +206,7 @@ int nvmf_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val)
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
-	ret = __nvme_submit_sync_cmd(req, &res, NULL, 0, 0);
-
+	ret = __nvme_submit_sync_cmd(req, &res, NULL, 0, false);
 	if (ret >= 0)
 		*val = le64_to_cpu(res.u64);
 	if (unlikely(ret != 0))
@@ -256,7 +254,7 @@ int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val)
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
-	ret = __nvme_submit_sync_cmd(req, NULL, NULL, 0, 0);
+	ret = __nvme_submit_sync_cmd(req, NULL, NULL, 0, false);
 	if (unlikely(ret))
 		dev_err(ctrl->device,
 			"Property Set error: %d, offset %#x\n",
@@ -417,7 +415,7 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl)
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
-	ret = __nvme_submit_sync_cmd(req, &res, data, sizeof(*data), 1);
+	ret = __nvme_submit_sync_cmd(req, &res, data, sizeof(*data), true);
 	if (ret) {
 		nvmf_log_connect_error(ctrl, ret, le32_to_cpu(res.u32),
 				       &cmd, data);
@@ -507,7 +505,7 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid)
 	if (IS_ERR(req))
 		return PTR_ERR(req);
 
-	ret = __nvme_submit_sync_cmd(req, &res, data, sizeof(*data), 1);
+	ret = __nvme_submit_sync_cmd(req, &res, data, sizeof(*data), true);
 	if (ret) {
 		nvmf_log_connect_error(ctrl, ret, le32_to_cpu(res.u32),
 				       &cmd, data);
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index d10f930d1edb..bf984ae5cf04 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -816,7 +816,7 @@ int nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
 struct request *__nvme_alloc_rq(struct request_queue *q,
 		struct nvme_command *cmd, int qid, blk_mq_req_flags_t flags);
 int __nvme_submit_sync_cmd(struct request *req, union nvme_result *result,
-		void *buffer, unsigned bufflen, int at_head);
+		void *buffer, unsigned bufflen, bool at_head);
 int nvme_set_features(struct nvme_ctrl *dev, unsigned int fid,
 		      unsigned int dword11, void *buffer, size_t buflen,
 		      u32 *result);
-- 
2.35.3



  parent reply	other threads:[~2023-02-08 15:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08 15:17 [PATCHv2 0/3] nvme: rework __nvme_submit_sync_cmd() Hannes Reinecke
2023-02-08 15:17 ` [PATCH 1/3] nvme: split __nvme_submit_sync_cmd() Hannes Reinecke
2023-02-09  5:33   ` Christoph Hellwig
2023-02-09  7:58     ` Hannes Reinecke
2023-02-08 15:17 ` [PATCH 2/3] nvme: retry authentication commands if DNR status bit is not set Hannes Reinecke
2023-02-08 15:17 ` Hannes Reinecke [this message]
2023-02-09  5:20   ` [PATCH 3/3] nvme: make 'at_head' parameter for __nvme_submit_sync_cmd() boolean Christoph Hellwig
2023-02-09 10:59     ` Hannes Reinecke
2023-02-09 14:24       ` Kanchan Joshi
2023-02-08 15:30 ` [PATCHv2 0/3] nvme: rework __nvme_submit_sync_cmd() Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2023-02-08  8:49 [PATCH " Hannes Reinecke
2023-02-08  8:49 ` [PATCH 3/3] nvme: make 'at_head' parameter for __nvme_submit_sync_cmd() boolean Hannes Reinecke

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=20230208151720.109130-4-hare@suse.de \
    --to=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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.