From patchwork Fri Nov 1 12:21:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhou Wang X-Patchwork-Id: 178299 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp412794ill; Fri, 1 Nov 2019 05:25:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMA8eFEOyPBj+z7rDk9jkIMWVaoJKNW6brPAq5weWA41tEddXd1GyGi0O3mKEilNkj7xQJ X-Received: by 2002:a17:906:6451:: with SMTP id l17mr9392331ejn.114.1572611128700; Fri, 01 Nov 2019 05:25:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572611128; cv=none; d=google.com; s=arc-20160816; b=q893Jw5+tcUjoVpsaIMs/mzup0cuSuCIsZdIMzpGFaZrj7rY5s1Mz9Jv9cqqfxK/w6 2/6D8b+UsNr9R/ngQwzmfdaWyVObBnmJQQxIHA8uhxP07E7wkJGWEyiwPdWoA82ksNMZ Ub1XqErChi6hca+P8+EHiPjXG/1pUiYYtdVfUjObCjYQmq3d0rwT+scq1TxvF2XcB1ga iuCRlVTQjeSSVcBI/myby20x90d5cjvtMhAMWG/XPl/y0C51z8ORKy7k+s1bXNga4PTX DFRj6SG8vO25ELlkjMe8cSrsjQhCmi9I4cSzzlMOLKM5oemUQn1u2O02m9n5JlBpP/qE Qbhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=KYjFm/x7FTr0FQgj97C9SGtuVlfc2jHVORfmdKl47Pc=; b=TLPodXd6C+EEyExetURgB7f6OKcjqPLNNkoK76HBVisHp+xuHHbQBnS6vnxp1NRTVB pkSZ8gZMJaJ9QSRg4Iw1O3KWFj3ZFmVcC8pnC+ykNEu/wBbomP7gds5Huxif4VyalTvL jdYP2CtuiL7uNA0LtawnrM4rQ/QAnS7mnhure9YrjyWcdn5uln/7uuRMhWQnt4d0w7Yi VyAtdBB8SfPka1u1Q0BGaQTbhx7iFbMgPb16MRgvTNFBRJnV09oFdA9ujPdEHIdluyjE +nq1jnKVIriceG/HB/AJiiE23O77aBmlc5RaZ8C95/OvEqYoBe/GtwmODdkidQ5adzRq 8H8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f24si234837edf.15.2019.11.01.05.25.28; Fri, 01 Nov 2019 05:25:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726622AbfKAMZY (ORCPT + 3 others); Fri, 1 Nov 2019 08:25:24 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5685 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726229AbfKAMZY (ORCPT ); Fri, 1 Nov 2019 08:25:24 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 9BC88EFD4F62366D4492; Fri, 1 Nov 2019 20:25:15 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Fri, 1 Nov 2019 20:25:07 +0800 From: Zhou Wang To: Herbert Xu , "David S. Miller" CC: , Zhou Wang Subject: [PATCH] crypto: hisilicon - replace #ifdef with IS_ENABLED for CONFIG_NUMA Date: Fri, 1 Nov 2019 20:21:49 +0800 Message-ID: <1572610909-91857-1-git-send-email-wangzhou1@hisilicon.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Replace #ifdef CONFIG_NUMA with IS_ENABLED(CONFIG_NUMA) to fix kbuild error. Signed-off-by: Zhou Wang Reported-by: kbuild test robot --- drivers/crypto/hisilicon/zip/zip_main.c | 51 ++++++++++++++++----------------- 1 file changed, 25 insertions(+), 26 deletions(-) -- 2.8.1 Acked-by: Olof Johansson diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c index 255b63c..0605457 100644 --- a/drivers/crypto/hisilicon/zip/zip_main.c +++ b/drivers/crypto/hisilicon/zip/zip_main.c @@ -104,9 +104,8 @@ static void free_list(struct list_head *head) struct hisi_zip *find_zip_device(int node) { - struct hisi_zip *ret = NULL; -#ifdef CONFIG_NUMA struct hisi_zip_resource *res, *tmp; + struct hisi_zip *ret = NULL; struct hisi_zip *hisi_zip; struct list_head *n; struct device *dev; @@ -114,38 +113,38 @@ struct hisi_zip *find_zip_device(int node) mutex_lock(&hisi_zip_list_lock); - list_for_each_entry(hisi_zip, &hisi_zip_list, list) { - res = kzalloc(sizeof(*res), GFP_KERNEL); - if (!res) - goto err; - - dev = &hisi_zip->qm.pdev->dev; - res->hzip = hisi_zip; - res->distance = node_distance(dev->numa_node, node); + if (IS_ENABLED(CONFIG_NUMA)) { + list_for_each_entry(hisi_zip, &hisi_zip_list, list) { + res = kzalloc(sizeof(*res), GFP_KERNEL); + if (!res) + goto err; + + dev = &hisi_zip->qm.pdev->dev; + res->hzip = hisi_zip; + res->distance = node_distance(dev_to_node(dev), node); + + n = &head; + list_for_each_entry(tmp, &head, list) { + if (res->distance < tmp->distance) { + n = &tmp->list; + break; + } + } + list_add_tail(&res->list, n); + } - n = &head; list_for_each_entry(tmp, &head, list) { - if (res->distance < tmp->distance) { - n = &tmp->list; + if (hisi_qm_get_free_qp_num(&tmp->hzip->qm)) { + ret = tmp->hzip; break; } } - list_add_tail(&res->list, n); - } - list_for_each_entry(tmp, &head, list) { - if (hisi_qm_get_free_qp_num(&tmp->hzip->qm)) { - ret = tmp->hzip; - break; - } + free_list(&head); + } else { + ret = list_first_entry(&hisi_zip_list, struct hisi_zip, list); } - free_list(&head); -#else - mutex_lock(&hisi_zip_list_lock); - - ret = list_first_entry(&hisi_zip_list, struct hisi_zip, list); -#endif mutex_unlock(&hisi_zip_list_lock); return ret;