scsi: mpt3sas: use list_splice_init()
authorHannes Reinecke <hare@suse.de>
Thu, 4 Jan 2018 12:57:02 +0000 (04:57 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 11 Jan 2018 04:24:59 +0000 (23:24 -0500)
Use 'list_splice_init()' instead of hand-crafted function.  No
functional change.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_base.c

index e3857e5fb8ab0f2566761f9a023e3cf0aea07594..464a11e29113d03c071e37ca15fb9f0e5104b5ec 100644 (file)
@@ -2885,20 +2885,13 @@ mpt3sas_base_free_smid(struct MPT3SAS_ADAPTER *ioc, u16 smid)
 {
        unsigned long flags;
        int i;
-       struct chain_tracker *chain_req, *next;
 
        spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
        if (smid < ioc->hi_priority_smid) {
                /* scsiio queue */
                i = smid - 1;
-               if (!list_empty(&ioc->scsi_lookup[i].chain_list)) {
-                       list_for_each_entry_safe(chain_req, next,
-                           &ioc->scsi_lookup[i].chain_list, tracker_list) {
-                               list_del_init(&chain_req->tracker_list);
-                               list_add(&chain_req->tracker_list,
-                                   &ioc->free_chain_list);
-                       }
-               }
+               list_splice_init(&ioc->scsi_lookup[i].chain_list,
+                                &ioc->free_chain_list);
                ioc->scsi_lookup[i].cb_idx = 0xFF;
                ioc->scsi_lookup[i].scmd = NULL;
                ioc->scsi_lookup[i].direct_io = 0;