[PATCH 10/14] nvme-core: remove one liner wrappers for streams
Chaitanya Kulkarni
chaitanya.kulkarni at wdc.com
Tue Feb 16 19:10:28 EST 2021
The functions nvme_[enable|disable]_streams() are just one line wrapper
to the nvme_toggel_streams(). Also, there is only one call exist for
them.
Instead of maintaining one liners, rename original function
nvme_toggle_streams() -> nvme_ctrl_allow_streams() and pass the boolean
value to the function to enable/disable streams. While we are at it
remove the memset() call and zero initialize the structure just like in
nvme_identify_ctrl().
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
drivers/nvme/host/core.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index b43557ebc564..139cbeb11c7d 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -686,11 +686,9 @@ static struct request *nvme_alloc_request_qid(struct request_queue *q,
return req;
}
-static int nvme_toggle_streams(struct nvme_ctrl *ctrl, bool enable)
+static int nvme_ctrl_allow_streams(struct nvme_ctrl *ctrl, bool enable)
{
- struct nvme_command c;
-
- memset(&c, 0, sizeof(c));
+ struct nvme_command c = { };
c.directive.opcode = nvme_admin_directive_send;
c.directive.nsid = cpu_to_le32(NVME_NSID_ALL);
@@ -702,16 +700,6 @@ static int nvme_toggle_streams(struct nvme_ctrl *ctrl, bool enable)
return nvme_submit_sync_cmd(ctrl->admin_q, &c, NULL, 0);
}
-static int nvme_disable_streams(struct nvme_ctrl *ctrl)
-{
- return nvme_toggle_streams(ctrl, false);
-}
-
-static int nvme_enable_streams(struct nvme_ctrl *ctrl)
-{
- return nvme_toggle_streams(ctrl, true);
-}
-
static int nvme_get_stream_params(struct nvme_ctrl *ctrl,
struct streams_directive_params *s, u32 nsid)
{
@@ -739,7 +727,7 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl)
if (!streams)
return 0;
- ret = nvme_enable_streams(ctrl);
+ ret = nvme_ctrl_allow_streams(ctrl, true);
if (ret)
return ret;
@@ -759,7 +747,7 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl)
return 0;
out_disable_stream:
- nvme_disable_streams(ctrl);
+ nvme_ctrl_allow_streams(ctrl, false);
return ret;
}
--
2.22.1
More information about the Linux-nvme
mailing list