[PATCH] scsi: arm: list_for_each() -> list_for_each_entry()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: chenqiwu <chenqiwu@xxxxxxxxxx>

Use list_for_each_entry() instead of list_for_each() to
simplify code.

Signed-off-by: chenqiwu <chenqiwu@xxxxxxxxxx>
---
 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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux