summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamaljit Singh <kamaljit.singh@opensource.wdc.com>2025-09-05 16:25:49 -0700
committerKeith Busch <kbusch@kernel.org>2025-09-23 15:38:28 -0700
commita5b852797411a65b99b467766a03be8f24284ddc (patch)
tree06b035ccc9721788a83cd35d6eed61d8164a8592
parenteeaed48980a7aeb0d3d8b438185d4b5a66154ff9 (diff)
nvme-core: add method to check for an I/O controller
Add nvme_is_io_ctrl() to check if the controller is of type I/O controller. Uses negative logic by excluding an administrative controller and a discovery controller. Signed-off-by: Kamaljit Singh <kamaljit.singh@opensource.wdc.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
-rw-r--r--drivers/nvme/host/core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 812c1565114f..0f20adcebcf1 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3163,6 +3163,11 @@ static inline bool nvme_admin_ctrl(struct nvme_ctrl *ctrl)
return ctrl->cntrltype == NVME_CTRL_ADMIN;
}
+static inline bool nvme_is_io_ctrl(struct nvme_ctrl *ctrl)
+{
+ return !nvme_discovery_ctrl(ctrl) && !nvme_admin_ctrl(ctrl);
+}
+
static bool nvme_validate_cntlid(struct nvme_subsystem *subsys,
struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
{