Skip to content

Commit 750dde4

Browse files
Christoph HellwigKeith Busch
authored andcommitted
nvme-pci: simplify nvme_cqe_valid
We always look at the current CQ head and phase, so don't pass these as separate arguments, and rename the function to nvme_cqe_pending. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 287a63e commit 750dde4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/nvme/host/pci.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -915,10 +915,10 @@ static void nvme_pci_complete_rq(struct request *req)
915915
}
916916

917917
/* We read the CQE phase first to check if the rest of the entry is valid */
918-
static inline bool nvme_cqe_valid(struct nvme_queue *nvmeq, u16 head,
919-
u16 phase)
918+
static inline bool nvme_cqe_pending(struct nvme_queue *nvmeq)
920919
{
921-
return (le16_to_cpu(nvmeq->cqes[head].status) & 1) == phase;
920+
return (le16_to_cpu(nvmeq->cqes[nvmeq->cq_head].status) & 1) ==
921+
nvmeq->cq_phase;
922922
}
923923

924924
static inline void nvme_ring_cq_doorbell(struct nvme_queue *nvmeq)
@@ -965,7 +965,7 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq,
965965
static inline bool nvme_read_cqe(struct nvme_queue *nvmeq,
966966
struct nvme_completion *cqe)
967967
{
968-
if (nvme_cqe_valid(nvmeq, nvmeq->cq_head, nvmeq->cq_phase)) {
968+
if (nvme_cqe_pending(nvmeq)) {
969969
*cqe = nvmeq->cqes[nvmeq->cq_head];
970970

971971
if (++nvmeq->cq_head == nvmeq->q_depth) {
@@ -1006,7 +1006,7 @@ static irqreturn_t nvme_irq(int irq, void *data)
10061006
static irqreturn_t nvme_irq_check(int irq, void *data)
10071007
{
10081008
struct nvme_queue *nvmeq = data;
1009-
if (nvme_cqe_valid(nvmeq, nvmeq->cq_head, nvmeq->cq_phase))
1009+
if (nvme_cqe_pending(nvmeq))
10101010
return IRQ_WAKE_THREAD;
10111011
return IRQ_NONE;
10121012
}
@@ -1016,7 +1016,7 @@ static int __nvme_poll(struct nvme_queue *nvmeq, unsigned int tag)
10161016
struct nvme_completion cqe;
10171017
int found = 0, consumed = 0;
10181018

1019-
if (!nvme_cqe_valid(nvmeq, nvmeq->cq_head, nvmeq->cq_phase))
1019+
if (!nvme_cqe_pending(nvmeq))
10201020
return 0;
10211021

10221022
spin_lock_irq(&nvmeq->q_lock);

0 commit comments

Comments
 (0)