Skip to content

Commit 1e67ee9

Browse files
Zhou Wangherbertx
authored andcommitted
crypto: hisilicon - replace #ifdef with IS_ENABLED for CONFIG_NUMA
Replace #ifdef CONFIG_NUMA with IS_ENABLED(CONFIG_NUMA) to fix kbuild error. Fixes: 700f7d0 ("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>
1 parent 44eff4a commit 1e67ee9

1 file changed

Lines changed: 25 additions & 26 deletions

File tree

‎drivers/crypto/hisilicon/zip/zip_main.c‎

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -104,48 +104,47 @@ static void free_list(struct list_head *head)
104104

105105
struct hisi_zip *find_zip_device(int node)
106106
{
107-
struct hisi_zip *ret = NULL;
108-
#ifdef CONFIG_NUMA
109107
struct hisi_zip_resource *res, *tmp;
108+
struct hisi_zip *ret = NULL;
110109
struct hisi_zip *hisi_zip;
111110
struct list_head *n;
112111
struct device *dev;
113112
LIST_HEAD(head);
114113

115114
mutex_lock(&hisi_zip_list_lock);
116115

117-
list_for_each_entry(hisi_zip, &hisi_zip_list, list) {
118-
res = kzalloc(sizeof(*res), GFP_KERNEL);
119-
if (!res)
120-
goto err;
121-
122-
dev = &hisi_zip->qm.pdev->dev;
123-
res->hzip = hisi_zip;
124-
res->distance = node_distance(dev->numa_node, node);
116+
if (IS_ENABLED(CONFIG_NUMA)) {
117+
list_for_each_entry(hisi_zip, &hisi_zip_list, list) {
118+
res = kzalloc(sizeof(*res), GFP_KERNEL);
119+
if (!res)
120+
goto err;
121+
122+
dev = &hisi_zip->qm.pdev->dev;
123+
res->hzip = hisi_zip;
124+
res->distance = node_distance(dev_to_node(dev), node);
125+
126+
n = &head;
127+
list_for_each_entry(tmp, &head, list) {
128+
if (res->distance < tmp->distance) {
129+
n = &tmp->list;
130+
break;
131+
}
132+
}
133+
list_add_tail(&res->list, n);
134+
}
125135

126-
n = &head;
127136
list_for_each_entry(tmp, &head, list) {
128-
if (res->distance < tmp->distance) {
129-
n = &tmp->list;
137+
if (hisi_qm_get_free_qp_num(&tmp->hzip->qm)) {
138+
ret = tmp->hzip;
130139
break;
131140
}
132141
}
133-
list_add_tail(&res->list, n);
134-
}
135142

136-
list_for_each_entry(tmp, &head, list) {
137-
if (hisi_qm_get_free_qp_num(&tmp->hzip->qm)) {
138-
ret = tmp->hzip;
139-
break;
140-
}
143+
free_list(&head);
144+
} else {
145+
ret = list_first_entry(&hisi_zip_list, struct hisi_zip, list);
141146
}
142147

143-
free_list(&head);
144-
#else
145-
mutex_lock(&hisi_zip_list_lock);
146-
147-
ret = list_first_entry(&hisi_zip_list, struct hisi_zip, list);
148-
#endif
149148
mutex_unlock(&hisi_zip_list_lock);
150149

151150
return ret;

0 commit comments

Comments
 (0)