Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] nvme: change return type of nvme_poll_cq() to bool
@ 2024-12-23  1:05 Yongsoo Joo
  2024-12-23  8:53 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yongsoo Joo @ 2024-12-23  1:05 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi; +Cc: linux-nvme, Yongsoo Joo

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@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


-- 



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] nvme: change return type of nvme_poll_cq() to bool
  2024-12-23  1:05 [PATCH v3] nvme: change return type of nvme_poll_cq() to bool Yongsoo Joo
@ 2024-12-23  8:53 ` Christoph Hellwig
  2024-12-24 10:07 ` Sagi Grimberg
  2025-01-07 16:48 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2024-12-23  8:53 UTC (permalink / raw)
  To: Yongsoo Joo; +Cc: kbusch, axboe, hch, sagi, linux-nvme

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] nvme: change return type of nvme_poll_cq() to bool
  2024-12-23  1:05 [PATCH v3] nvme: change return type of nvme_poll_cq() to bool Yongsoo Joo
  2024-12-23  8:53 ` Christoph Hellwig
@ 2024-12-24 10:07 ` Sagi Grimberg
  2025-01-07 16:48 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2024-12-24 10:07 UTC (permalink / raw)
  To: Yongsoo Joo, kbusch, axboe, hch; +Cc: linux-nvme

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] nvme: change return type of nvme_poll_cq() to bool
  2024-12-23  1:05 [PATCH v3] nvme: change return type of nvme_poll_cq() to bool Yongsoo Joo
  2024-12-23  8:53 ` Christoph Hellwig
  2024-12-24 10:07 ` Sagi Grimberg
@ 2025-01-07 16:48 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2025-01-07 16:48 UTC (permalink / raw)
  To: Yongsoo Joo; +Cc: axboe, hch, sagi, linux-nvme

On Mon, Dec 23, 2024 at 01:05:17AM +0000, Yongsoo Joo wrote:
> 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.

Thanks, applied to nvme-6.14.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-07 17:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-23  1:05 [PATCH v3] nvme: change return type of nvme_poll_cq() to bool Yongsoo Joo
2024-12-23  8:53 ` Christoph Hellwig
2024-12-24 10:07 ` Sagi Grimberg
2025-01-07 16:48 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox