OSDN Git Service

ibmvnic: Use list_for_each_entry() to simplify code in ibmvnic.c
authorWang Hai <wanghai38@huawei.com>
Thu, 10 Jun 2021 12:54:17 +0000 (20:54 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Jun 2021 21:08:09 +0000 (14:08 -0700)
Convert list_for_each() to list_for_each_entry() where
applicable. This simplifies the code.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Acked-by: Lijun Pan <lijunp213@gmail.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c

index 4d43941..ffd26cd 100644 (file)
@@ -2400,8 +2400,7 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
                goto err;
        }
 
-       list_for_each(entry, &adapter->rwi_list) {
-               tmp = list_entry(entry, struct ibmvnic_rwi, list);
+       list_for_each_entry(tmp, &adapter->rwi_list, list) {
                if (tmp->reset_reason == reason) {
                        netdev_dbg(netdev, "Skipping matching reset, reason=%s\n",
                                   reset_reason_to_string(reason));