Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3987618rdb; Wed, 30 Aug 2023 11:52:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIaGQ4ink+edGTc7SB9IBOkkRd/uIOUviojZYHS2gL8XRJWANJOuGDNvzNY/nIYwd0R0JA X-Received: by 2002:a17:90b:1e4e:b0:268:b0b:a084 with SMTP id pi14-20020a17090b1e4e00b002680b0ba084mr2972626pjb.46.1693421574298; Wed, 30 Aug 2023 11:52:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693421574; cv=none; d=google.com; s=arc-20160816; b=pU4+sSP069+4UNLW8Rhl3D0iymff0w5pNMPmytnK8+Z21FNjF49ob7AjyOabTeibOQ E2PZVHQOgo2vRuytwiMMVdJ7npOOH/an/sqvJ3ntcQfp0csWuLpvqBOyoSaT/OZnFVEU 5jllqcNirAkQgJlG5XIhfvmgXjKsyGxJifCgEbdUe/MbFB4brvM0DTooiyBpGo5GXhAY bYC7T1XU+VB0l2uaknI4Fp5hJ1UsRe5zD20zR5dsSWy3YZNCRTDN0CNaA+ls+a3JaWHY 5A0ICVqvUQk/wcyBnKru4wDUsxLrn6BwY8GxgjjUAqwuYWMXhc16keHzW24prevJCLlc ByRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=73myhQhGHQiuKNC2YD/G/4fvmJDXmbWkA1XIBFj8XhM=; fh=3kxH/7w6RhtjVXExO0SKBLOol6HuIgmsb7sOFy/Hig4=; b=Tnf3BFZxl8YrRg5U0fRYXA4fPiZ0bKnruexJV7MpknJ6j37rcnvG90HKsqwmZcolSf pdSKDdTwFJuiAILVQ5Lx0bX3agNTMh8m5Rog98Hjcx2vcS2JHaKR0cIIKw+xNjMBdlgo xVq3BSH11pGqrkLEtCDe4qxUMWYuDuek7JC3H0GEIrrACyGq4V+vKas9pNi+tfa8tTYn V8VOurZIOt1Q2QCqIMfOHkIL5eUF49Ob1iiluxy5e6mi+yV1yE9hMBFLbMCW16ffBm29 Av0L+1+e5iilcncQC7SWwy5QjFQrAKuJdxIU8rLvObC4FcU/5edQ0gqlnI/w5gGnl+lY 6czw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w17-20020a17090a8a1100b00263c7cadb73si2240921pjn.152.2023.08.30.11.52.29; Wed, 30 Aug 2023 11:52:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240246AbjH3SoO (ORCPT + 99 others); Wed, 30 Aug 2023 14:44:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242297AbjH3HzD (ORCPT ); Wed, 30 Aug 2023 03:55:03 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DC99193 for ; Wed, 30 Aug 2023 00:54:59 -0700 (PDT) Received: from kwepemi500008.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RbGjV64ZnzVkWn; Wed, 30 Aug 2023 15:52:30 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 30 Aug 2023 15:54:56 +0800 From: Jinjie Ruan To: , , , , , , Giovanni Cabiddu , Herbert Xu , "David S. Miller" CC: Subject: [PATCH -next] crypto: qat - Use list_for_each_entry() helper Date: Wed, 30 Aug 2023 15:54:51 +0800 Message-ID: <20230830075451.293379-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500008.china.huawei.com (7.221.188.139) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Convert list_for_each() to list_for_each_entry() so that the list_itr list_head pointer and list_entry() call are no longer needed, which can reduce a few lines of code. No functional changed. Signed-off-by: Jinjie Ruan --- .../crypto/intel/qat/qat_common/adf_init.c | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/crypto/intel/qat/qat_common/adf_init.c b/drivers/crypto/intel/qat/qat_common/adf_init.c index 89001fe92e76..79a81e25de97 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_init.c +++ b/drivers/crypto/intel/qat/qat_common/adf_init.c @@ -61,7 +61,6 @@ int adf_service_unregister(struct service_hndl *service) static int adf_dev_init(struct adf_accel_dev *accel_dev) { struct service_hndl *service; - struct list_head *list_itr; struct adf_hw_device_data *hw_data = accel_dev->hw_device; int ret; @@ -137,8 +136,7 @@ static int adf_dev_init(struct adf_accel_dev *accel_dev) * This is to facilitate any ordering dependencies between services * prior to starting any of the accelerators. */ - list_for_each(list_itr, &service_table) { - service = list_entry(list_itr, struct service_hndl, list); + list_for_each_entry(service, &service_table, list) { if (service->event_hld(accel_dev, ADF_EVENT_INIT)) { dev_err(&GET_DEV(accel_dev), "Failed to initialise service %s\n", @@ -165,7 +163,6 @@ static int adf_dev_start(struct adf_accel_dev *accel_dev) { struct adf_hw_device_data *hw_data = accel_dev->hw_device; struct service_hndl *service; - struct list_head *list_itr; int ret; set_bit(ADF_STATUS_STARTING, &accel_dev->status); @@ -209,8 +206,7 @@ static int adf_dev_start(struct adf_accel_dev *accel_dev) adf_heartbeat_start(accel_dev); - list_for_each(list_itr, &service_table) { - service = list_entry(list_itr, struct service_hndl, list); + list_for_each_entry(service, &service_table, list) { if (service->event_hld(accel_dev, ADF_EVENT_START)) { dev_err(&GET_DEV(accel_dev), "Failed to start service %s\n", @@ -259,7 +255,6 @@ static void adf_dev_stop(struct adf_accel_dev *accel_dev) { struct adf_hw_device_data *hw_data = accel_dev->hw_device; struct service_hndl *service; - struct list_head *list_itr; bool wait = false; int ret; @@ -280,8 +275,7 @@ static void adf_dev_stop(struct adf_accel_dev *accel_dev) if (!list_empty(&accel_dev->compression_list)) qat_comp_algs_unregister(); - list_for_each(list_itr, &service_table) { - service = list_entry(list_itr, struct service_hndl, list); + list_for_each_entry(service, &service_table, list) { if (!test_bit(accel_dev->accel_id, service->start_status)) continue; ret = service->event_hld(accel_dev, ADF_EVENT_STOP); @@ -318,7 +312,6 @@ static void adf_dev_shutdown(struct adf_accel_dev *accel_dev) { struct adf_hw_device_data *hw_data = accel_dev->hw_device; struct service_hndl *service; - struct list_head *list_itr; if (!hw_data) { dev_err(&GET_DEV(accel_dev), @@ -340,8 +333,7 @@ static void adf_dev_shutdown(struct adf_accel_dev *accel_dev) &accel_dev->status); } - list_for_each(list_itr, &service_table) { - service = list_entry(list_itr, struct service_hndl, list); + list_for_each_entry(service, &service_table, list) { if (!test_bit(accel_dev->accel_id, service->init_status)) continue; if (service->event_hld(accel_dev, ADF_EVENT_SHUTDOWN)) @@ -378,10 +370,8 @@ static void adf_dev_shutdown(struct adf_accel_dev *accel_dev) int adf_dev_restarting_notify(struct adf_accel_dev *accel_dev) { struct service_hndl *service; - struct list_head *list_itr; - list_for_each(list_itr, &service_table) { - service = list_entry(list_itr, struct service_hndl, list); + list_for_each_entry(service, &service_table, list) { if (service->event_hld(accel_dev, ADF_EVENT_RESTARTING)) dev_err(&GET_DEV(accel_dev), "Failed to restart service %s.\n", @@ -393,10 +383,8 @@ int adf_dev_restarting_notify(struct adf_accel_dev *accel_dev) int adf_dev_restarted_notify(struct adf_accel_dev *accel_dev) { struct service_hndl *service; - struct list_head *list_itr; - list_for_each(list_itr, &service_table) { - service = list_entry(list_itr, struct service_hndl, list); + list_for_each_entry(service, &service_table, list) { if (service->event_hld(accel_dev, ADF_EVENT_RESTARTED)) dev_err(&GET_DEV(accel_dev), "Failed to restart service %s.\n", -- 2.34.1