[PATCH] scsi: arm: list_for_each() -> list_for_each_entry()
From: <hidden>
Date: 2020-02-23 05:42:37
Also in:
linux-scsi
Subsystem:
arm/riscpc architecture, scsi subsystem, the rest · Maintainers:
Russell King, "James E.J. Bottomley", "Martin K. Petersen", Linus Torvalds
From: chenqiwu <redacted> Use list_for_each_entry() instead of list_for_each() to simplify code. Signed-off-by: chenqiwu <redacted> --- drivers/scsi/arm/queue.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/drivers/scsi/arm/queue.c b/drivers/scsi/arm/queue.c
index e5559f2..da39597 100644
--- a/drivers/scsi/arm/queue.c
+++ b/drivers/scsi/arm/queue.c@@ -158,12 +158,11 @@ static struct scsi_cmnd *__queue_remove(Queue_t *queue, struct list_head *ent) struct scsi_cmnd *queue_remove_exclude(Queue_t *queue, unsigned long *exclude) { unsigned long flags; - struct list_head *l; + QE_t *q; struct scsi_cmnd *SCpnt = NULL; spin_lock_irqsave(&queue->queue_lock, flags); - list_for_each(l, &queue->head) { - QE_t *q = list_entry(l, QE_t, list); + list_for_each_entry(q, &queue->head, list) { if (!test_bit(q->SCpnt->device->id * 8 + (u8)(q->SCpnt->device->lun & 0x7), exclude)) { SCpnt = __queue_remove(queue, l);
@@ -207,12 +206,11 @@ struct scsi_cmnd *queue_remove_tgtluntag(Queue_t *queue, int target, int lun, int tag) { unsigned long flags; - struct list_head *l; + QE_t *q; struct scsi_cmnd *SCpnt = NULL; spin_lock_irqsave(&queue->queue_lock, flags); - list_for_each(l, &queue->head) { - QE_t *q = list_entry(l, QE_t, list); + list_for_each_entry(q, &queue->head, list) { if (q->SCpnt->device->id == target && q->SCpnt->device->lun == lun && q->SCpnt->tag == tag) { SCpnt = __queue_remove(queue, l);
@@ -234,11 +232,10 @@ struct scsi_cmnd *queue_remove_tgtluntag(Queue_t *queue, int target, int lun, void queue_remove_all_target(Queue_t *queue, int target) { unsigned long flags; - struct list_head *l; + QE_t *q; spin_lock_irqsave(&queue->queue_lock, flags); - list_for_each(l, &queue->head) { - QE_t *q = list_entry(l, QE_t, list); + list_for_each_entry(q, &queue->head, list) { if (q->SCpnt->device->id == target) __queue_remove(queue, l); }
@@ -257,12 +254,11 @@ void queue_remove_all_target(Queue_t *queue, int target) int queue_probetgtlun (Queue_t *queue, int target, int lun) { unsigned long flags; - struct list_head *l; + QE_t *q; int found = 0; spin_lock_irqsave(&queue->queue_lock, flags); - list_for_each(l, &queue->head) { - QE_t *q = list_entry(l, QE_t, list); + list_for_each_entry(q, &queue->head, list) { if (q->SCpnt->device->id == target && q->SCpnt->device->lun == lun) { found = 1; break;
@@ -283,12 +279,11 @@ int queue_probetgtlun (Queue_t *queue, int target, int lun) int queue_remove_cmd(Queue_t *queue, struct scsi_cmnd *SCpnt) { unsigned long flags; - struct list_head *l; + QE_t *q; int found = 0; spin_lock_irqsave(&queue->queue_lock, flags); - list_for_each(l, &queue->head) { - QE_t *q = list_entry(l, QE_t, list); + list_for_each_entry(q, &queue->head, list) { if (q->SCpnt == SCpnt) { __queue_remove(queue, l); found = 1;
--
1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel