scsi: arm: list_for_each() -> list_for_each_entry()
Subsystems (2)
PATCH 1/1 scsi: arm: list_for_each() -> list_for_each_entry()
From: chenqiwu <[email protected]>
Use list_for_each_entry() instead of list_for_each() to simplify code.
--- drivers/scsi/arm/queue.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
drivers/scsi/arm/queue.c +10 -15
@@ -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 ;
Signature · 1 line
1.9.1
kbuild test robot
build botThank you for the patch! Yet something to improve:
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on scsi/for-next v5.6-rc2 next-20200221] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/qiwuchen55-gmail-com/scsi-arm-list_for_each-list_for_each_entry/20200223-140506 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: arm-rpc_defconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
drivers/scsi/arm/queue.c: In function 'queue_remove_exclude':
>> drivers/scsi/arm/queue.c:168:34: error: 'l' undeclared (first use in this function)
SCpnt = __queue_remove(queue, l);
^
drivers/scsi/arm/queue.c:168:34: note: each undeclared identifier is reported only once for each function it appears in
drivers/scsi/arm/queue.c: In function 'queue_remove_tgtluntag':
drivers/scsi/arm/queue.c:216:34: error: 'l' undeclared (first use in this function)
SCpnt = __queue_remove(queue, l);
^
drivers/scsi/arm/queue.c: In function 'queue_remove_all_target':
drivers/scsi/arm/queue.c:240:26: error: 'l' undeclared (first use in this function)
__queue_remove(queue, l);
^
drivers/scsi/arm/queue.c: In function 'queue_remove_cmd':
drivers/scsi/arm/queue.c:288:26: error: 'l' undeclared (first use in this function)
__queue_remove(queue, l);
^vim +/l +168 drivers/scsi/arm/queue.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 150
^1da177e4c3f41 Linus Torvalds 2005-04-16 151 /*
ee0ca6bab394fe Henrik Kretzschmar 2006-10-01 152 * Function: struct scsi_cmnd *queue_remove_exclude (queue, exclude)
^1da177e4c3f41 Linus Torvalds 2005-04-16 153 * Purpose : remove a SCSI command from a queue
^1da177e4c3f41 Linus Torvalds 2005-04-16 154 * Params : queue - queue to remove command from
^1da177e4c3f41 Linus Torvalds 2005-04-16 155 * exclude - bit array of target&lun which is busy
ee0ca6bab394fe Henrik Kretzschmar 2006-10-01 156 * Returns : struct scsi_cmnd if successful (and a reference), or NULL if no command available
^1da177e4c3f41 Linus Torvalds 2005-04-16 157 */
ee0ca6bab394fe Henrik Kretzschmar 2006-10-01 158 struct scsi_cmnd *queue_remove_exclude(Queue_t *queue, unsigned long *exclude)
^1da177e4c3f41 Linus Torvalds 2005-04-16 159 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 160 unsigned long flags;
a88583c893a94c chenqiwu 2020-02-23 161 QE_t *q;
ee0ca6bab394fe Henrik Kretzschmar 2006-10-01 162 struct scsi_cmnd *SCpnt = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 163
^1da177e4c3f41 Linus Torvalds 2005-04-16 164 spin_lock_irqsave(&queue->queue_lock, flags);
a88583c893a94c chenqiwu 2020-02-23 165 list_for_each_entry(q, &queue->head, list) {
9cb78c16f5dade Hannes Reinecke 2014-06-25 166 if (!test_bit(q->SCpnt->device->id * 8 +
9cb78c16f5dade Hannes Reinecke 2014-06-25 167 (u8)(q->SCpnt->device->lun & 0x7), exclude)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 @168 SCpnt = __queue_remove(queue, l);
^1da177e4c3f41 Linus Torvalds 2005-04-16 169 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 170 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 171 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 172 spin_unlock_irqrestore(&queue->queue_lock, flags);
^1da177e4c3f41 Linus Torvalds 2005-04-16 173
^1da177e4c3f41 Linus Torvalds 2005-04-16 174 return SCpnt;
^1da177e4c3f41 Linus Torvalds 2005-04-16 175 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 176 :::::: The code at line 168 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <[email protected]> :::::: CC: Linus Torvalds <[email protected]>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org