Linux-Crypto Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] crypto: hisilicon - replace #ifdef with IS_ENABLED for CONFIG_NUMA
@ 2019-11-01 12:21 Zhou Wang
  2019-11-07 20:53 ` Olof Johansson
  2019-11-08 15:20 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Zhou Wang @ 2019-11-01 12:21 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: linux-crypto, Zhou Wang

Replace #ifdef CONFIG_NUMA with IS_ENABLED(CONFIG_NUMA) to fix kbuild error.

Signed-off-by: Zhou Wang <wangzhou1@hisilicon.com>
Reported-by: kbuild test robot <lkp@intel.com>
---
 drivers/crypto/hisilicon/zip/zip_main.c | 51 ++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 26 deletions(-)

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;
-- 
2.8.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: hisilicon - replace #ifdef with IS_ENABLED for CONFIG_NUMA
  2019-11-01 12:21 [PATCH] crypto: hisilicon - replace #ifdef with IS_ENABLED for CONFIG_NUMA Zhou Wang
@ 2019-11-07 20:53 ` Olof Johansson
  2019-11-08 15:20 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Olof Johansson @ 2019-11-07 20:53 UTC (permalink / raw)
  To: Zhou Wang; +Cc: Herbert Xu, David S. Miller, linux-crypto

On Fri, Nov 1, 2019 at 5:25 AM Zhou Wang <wangzhou1@hisilicon.com> wrote:
>
> Replace #ifdef CONFIG_NUMA with IS_ENABLED(CONFIG_NUMA) to fix kbuild error.
>
> Signed-off-by: Zhou Wang <wangzhou1@hisilicon.com>
> Reported-by: kbuild test robot <lkp@intel.com>

Acked-by: Olof Johansson <olof@lixom.net>

Confirmed that this also fixes riscv allmodconfig build breakage on
linux-next. Herbert, can you pick it up so we keep -next building?
Thanks!



-Olof

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: hisilicon - replace #ifdef with IS_ENABLED for CONFIG_NUMA
  2019-11-01 12:21 [PATCH] crypto: hisilicon - replace #ifdef with IS_ENABLED for CONFIG_NUMA Zhou Wang
  2019-11-07 20:53 ` Olof Johansson
@ 2019-11-08 15:20 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2019-11-08 15:20 UTC (permalink / raw)
  To: Zhou Wang; +Cc: David S. Miller, linux-crypto

On Fri, Nov 01, 2019 at 08:21:49PM +0800, Zhou Wang wrote:
> Replace #ifdef CONFIG_NUMA with IS_ENABLED(CONFIG_NUMA) to fix kbuild error.
> 
> Signed-off-by: Zhou Wang <wangzhou1@hisilicon.com>
> Reported-by: kbuild test robot <lkp@intel.com>
> ---
>  drivers/crypto/hisilicon/zip/zip_main.c | 51 ++++++++++++++++-----------------
>  1 file changed, 25 insertions(+), 26 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-01 12:21 [PATCH] crypto: hisilicon - replace #ifdef with IS_ENABLED for CONFIG_NUMA Zhou Wang
2019-11-07 20:53 ` Olof Johansson
2019-11-08 15:20 ` Herbert Xu

Linux-Crypto Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-crypto/0 linux-crypto/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-crypto linux-crypto/ https://lore.kernel.org/linux-crypto \
		linux-crypto@vger.kernel.org
	public-inbox-index linux-crypto

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-crypto


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git