[PATCH v3] nvme: change return type of nvme_poll_cq() to bool
Yongsoo Joo
ysjoo at kookmin.ac.kr
Sun Dec 22 17:05:17 PST 2024
The nvme_poll_cq() function currently returns the number of CQEs
found, However, only one caller, nvme_poll(), requires a boolean
value to check whether any CQE was completed. The other callers do
not use the return value at all.
To better reflect its usage, update the return type of nvme_poll_cq()
from int to bool.
Signed-off-by: Yongsoo Joo <ysjoo at kookmin.ac.kr>
---
Changes from v2 to v3:
- Changed the return type of nvme_poll_cq() instead of nvme_poll(),
as suggested by Keith Busch.
- Updated the patch subject to reflect this change.
Changes from v1 to v2:
- Changed the return type of nvme_poll() from int to bool, rather than
modifying the internal return variable from bool to int, as
suggested by Christoph Hellwig.
- Updated the patch subject by replacing "fix" with "change", as
suggested by Keith Busch.
drivers/nvme/host/pci.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 1a5ba80f1811..79d9b4c42b95 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1148,13 +1148,13 @@ static inline void nvme_update_cq_head(struct nvme_queue *nvmeq)
}
}
-static inline int nvme_poll_cq(struct nvme_queue *nvmeq,
- struct io_comp_batch *iob)
+static inline bool nvme_poll_cq(struct nvme_queue *nvmeq,
+ struct io_comp_batch *iob)
{
- int found = 0;
+ bool found = false;
while (nvme_cqe_pending(nvmeq)) {
- found++;
+ found = true;
/*
* load-load control dependency between phase and the rest of
* the cqe requires a full read memory barrier
--
2.34.1
--
More information about the Linux-nvme
mailing list