From: Kamaljit Singh Date: Fri, 5 Sep 2025 23:25:49 +0000 (-0700) Subject: nvme-core: add method to check for an I/O controller X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a5b852797411a65b99b467766a03be8f24284ddc;p=thirdparty%2Fkernel%2Fstable.git 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 Reviewed-by: Hannes Reinecke Signed-off-by: Keith Busch --- diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 812c1565114fd..0f20adcebcf15 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) {