]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ibmvnic: Fix completion structure initialization
authorThomas Falcon <tlfalcon@linux.ibm.com>
Mon, 25 Nov 2019 23:12:53 +0000 (17:12 -0600)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Nov 2019 21:19:30 +0000 (13:19 -0800)
Fix multiple calls to init_completion for device completion
structures. Instead, initialize them during device probe and
reinitialize them later as needed.

Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c

index 0686ded7ad3a282a4b8ef4d29086de89672001f3..e1ab2feeae53d23b4da47f9ad2ed4b3e09c7f90b 100644 (file)
@@ -176,7 +176,7 @@ static int alloc_long_term_buff(struct ibmvnic_adapter *adapter,
        ltb->map_id = adapter->map_id;
        adapter->map_id++;
 
-       init_completion(&adapter->fw_done);
+       reinit_completion(&adapter->fw_done);
        rc = send_request_map(adapter, ltb->addr,
                              ltb->size, ltb->map_id);
        if (rc) {
@@ -215,7 +215,7 @@ static int reset_long_term_buff(struct ibmvnic_adapter *adapter,
 
        memset(ltb->buff, 0, ltb->size);
 
-       init_completion(&adapter->fw_done);
+       reinit_completion(&adapter->fw_done);
        rc = send_request_map(adapter, ltb->addr, ltb->size, ltb->map_id);
        if (rc)
                return rc;
@@ -943,7 +943,7 @@ static int ibmvnic_get_vpd(struct ibmvnic_adapter *adapter)
        if (adapter->vpd->buff)
                len = adapter->vpd->len;
 
-       init_completion(&adapter->fw_done);
+       reinit_completion(&adapter->fw_done);
        crq.get_vpd_size.first = IBMVNIC_CRQ_CMD;
        crq.get_vpd_size.cmd = GET_VPD_SIZE;
        rc = ibmvnic_send_crq(adapter, &crq);
@@ -1689,7 +1689,7 @@ static int __ibmvnic_set_mac(struct net_device *netdev, u8 *dev_addr)
        crq.change_mac_addr.cmd = CHANGE_MAC_ADDR;
        ether_addr_copy(&crq.change_mac_addr.mac_addr[0], dev_addr);
 
-       init_completion(&adapter->fw_done);
+       reinit_completion(&adapter->fw_done);
        rc = ibmvnic_send_crq(adapter, &crq);
        if (rc) {
                rc = -EIO;
@@ -2316,7 +2316,7 @@ static int wait_for_reset(struct ibmvnic_adapter *adapter)
        adapter->fallback.rx_entries = adapter->req_rx_add_entries_per_subcrq;
        adapter->fallback.tx_entries = adapter->req_tx_entries_per_subcrq;
 
-       init_completion(&adapter->reset_done);
+       reinit_completion(&adapter->reset_done);
        adapter->wait_for_reset = true;
        rc = ibmvnic_reset(adapter, VNIC_RESET_CHANGE_PARAM);
        if (rc)
@@ -2332,7 +2332,7 @@ static int wait_for_reset(struct ibmvnic_adapter *adapter)
                adapter->desired.rx_entries = adapter->fallback.rx_entries;
                adapter->desired.tx_entries = adapter->fallback.tx_entries;
 
-               init_completion(&adapter->reset_done);
+               reinit_completion(&adapter->reset_done);
                adapter->wait_for_reset = true;
                rc = ibmvnic_reset(adapter, VNIC_RESET_CHANGE_PARAM);
                if (rc)
@@ -2603,7 +2603,7 @@ static void ibmvnic_get_ethtool_stats(struct net_device *dev,
            cpu_to_be32(sizeof(struct ibmvnic_statistics));
 
        /* Wait for data to be written */
-       init_completion(&adapter->stats_done);
+       reinit_completion(&adapter->stats_done);
        rc = ibmvnic_send_crq(adapter, &crq);
        if (rc)
                return;
@@ -4408,7 +4408,7 @@ static int send_query_phys_parms(struct ibmvnic_adapter *adapter)
        memset(&crq, 0, sizeof(crq));
        crq.query_phys_parms.first = IBMVNIC_CRQ_CMD;
        crq.query_phys_parms.cmd = QUERY_PHYS_PARMS;
-       init_completion(&adapter->fw_done);
+       reinit_completion(&adapter->fw_done);
        rc = ibmvnic_send_crq(adapter, &crq);
        if (rc)
                return rc;
@@ -4960,6 +4960,9 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
        INIT_LIST_HEAD(&adapter->rwi_list);
        spin_lock_init(&adapter->rwi_lock);
        init_completion(&adapter->init_done);
+       init_completion(&adapter->fw_done);
+       init_completion(&adapter->reset_done);
+       init_completion(&adapter->stats_done);
        clear_bit(0, &adapter->resetting);
 
        do {