]> git.baikalelectronics.ru Git - kernel.git/commitdiff
crypto: hisilicon - replace #ifdef with IS_ENABLED for CONFIG_NUMA
authorZhou Wang <wangzhou1@hisilicon.com>
Fri, 1 Nov 2019 12:21:49 +0000 (20:21 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 8 Nov 2019 15:15:52 +0000 (23:15 +0800)
Replace #ifdef CONFIG_NUMA with IS_ENABLED(CONFIG_NUMA) to fix kbuild error.

Fixes: db7c11d7dec3 ("crypto: hisilicon - fix to return...")
Signed-off-by: Zhou Wang <wangzhou1@hisilicon.com>
Reported-by: kbuild test robot <lkp@intel.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/zip/zip_main.c

index 255b63cfbe1d5d9b23371257ba8728bfaa2b8c56..06054576b0570c8a9e754553ee5053a2ebbb7e78 100644 (file)
@@ -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;