scsi: qla2xxx: edif: Replace list_for_each_safe with list_for_each_entry_safe
authorQuinn Tran <qutran@marvell.com>
Tue, 26 Oct 2021 11:54:06 +0000 (04:54 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jul 2022 14:34:59 +0000 (16:34 +0200)
[ Upstream commit 8062b742d3bd336ca10ab5a1db1629d33700f9c6 ]

This patch is per review comment by Hannes Reinecke from previous
submission to replace list_for_each_safe with list_for_each_entry_safe.

Link: https://lore.kernel.org/r/20211026115412.27691-8-njavali@marvell.com
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/qla2xxx/qla_edif.c
drivers/scsi/qla2xxx/qla_edif.h
drivers/scsi/qla2xxx/qla_os.c

index a00fe88c60218c573fa55720f0b8ea50ecffd6f5..e40b9cc382146bc2a9628a30ffd00261123d1488 100644 (file)
@@ -1684,41 +1684,25 @@ static struct enode *
 qla_enode_find(scsi_qla_host_t *vha, uint32_t ntype, uint32_t p1, uint32_t p2)
 {
        struct enode            *node_rtn = NULL;
-       struct enode            *list_node = NULL;
+       struct enode            *list_node, *q;
        unsigned long           flags;
-       struct list_head        *pos, *q;
        uint32_t                sid;
-       uint32_t                rw_flag;
        struct purexevent       *purex;
 
        /* secure the list from moving under us */
        spin_lock_irqsave(&vha->pur_cinfo.pur_lock, flags);
 
-       list_for_each_safe(pos, q, &vha->pur_cinfo.head) {
-               list_node = list_entry(pos, struct enode, list);
+       list_for_each_entry_safe(list_node, q, &vha->pur_cinfo.head, list) {
 
                /* node type determines what p1 and p2 are */
                purex = &list_node->u.purexinfo;
                sid = p1;
-               rw_flag = p2;
 
                if (purex->pur_info.pur_sid.b24 == sid) {
-                       if (purex->pur_info.pur_pend == 1 &&
-                           rw_flag == PUR_GET) {
-                               /*
-                                * if the receive is in progress
-                                * and its a read/get then can't
-                                * transfer yet
-                                */
-                               ql_dbg(ql_dbg_edif, vha, 0x9106,
-                                   "%s purex xfer in progress for sid=%x\n",
-                                   __func__, sid);
-                       } else {
-                               /* found it and its complete */
-                               node_rtn = list_node;
-                               list_del(pos);
-                               break;
-                       }
+                       /* found it and its complete */
+                       node_rtn = list_node;
+                       list_del(&list_node->list);
+                       break;
                }
        }
 
@@ -2428,7 +2412,6 @@ void qla24xx_auth_els(scsi_qla_host_t *vha, void **pkt, struct rsp_que **rsp)
 
        purex = &ptr->u.purexinfo;
        purex->pur_info.pur_sid = a.did;
-       purex->pur_info.pur_pend = 0;
        purex->pur_info.pur_bytes_rcvd = totlen;
        purex->pur_info.pur_rx_xchg_address = le32_to_cpu(p->rx_xchg_addr);
        purex->pur_info.pur_nphdl = le16_to_cpu(p->nport_handle);
@@ -3180,18 +3163,14 @@ static uint16_t qla_edif_sadb_get_sa_index(fc_port_t *fcport,
 /* release any sadb entries -- only done at teardown */
 void qla_edif_sadb_release(struct qla_hw_data *ha)
 {
-       struct list_head *pos;
-       struct list_head *tmp;
-       struct edif_sa_index_entry *entry;
+       struct edif_sa_index_entry *entry, *tmp;
 
-       list_for_each_safe(pos, tmp, &ha->sadb_rx_index_list) {
-               entry = list_entry(pos, struct edif_sa_index_entry, next);
+       list_for_each_entry_safe(entry, tmp, &ha->sadb_rx_index_list, next) {
                list_del(&entry->next);
                kfree(entry);
        }
 
-       list_for_each_safe(pos, tmp, &ha->sadb_tx_index_list) {
-               entry = list_entry(pos, struct edif_sa_index_entry, next);
+       list_for_each_entry_safe(entry, tmp, &ha->sadb_tx_index_list, next) {
                list_del(&entry->next);
                kfree(entry);
        }
index 45cf87e337780724e73009fe7486f747d9ccc297..32800bfb32a380ce2fda1e9eeaecc83a3e95b13e 100644 (file)
@@ -101,7 +101,6 @@ struct dinfo {
 };
 
 struct pur_ninfo {
-       unsigned int    pur_pend:1;
        port_id_t       pur_sid;
        port_id_t       pur_did;
        uint8_t         vp_idx;
index 12958aea893f301612c50a5c7224d05df003adeb..c7ab8a8be24c720f744c2b2af159e805f12d130e 100644 (file)
@@ -3886,13 +3886,13 @@ qla2x00_remove_one(struct pci_dev *pdev)
 static inline void
 qla24xx_free_purex_list(struct purex_list *list)
 {
-       struct list_head *item, *next;
+       struct purex_item *item, *next;
        ulong flags;
 
        spin_lock_irqsave(&list->lock, flags);
-       list_for_each_safe(item, next, &list->head) {
-               list_del(item);
-               kfree(list_entry(item, struct purex_item, list));
+       list_for_each_entry_safe(item, next, &list->head, list) {
+               list_del(&item->list);
+               kfree(item);
        }
        spin_unlock_irqrestore(&list->lock, flags);
 }