[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1527765086-19873-22-git-send-email-xieyisheng1@huawei.com>
Date: Thu, 31 May 2018 19:11:26 +0800
From: Yisheng Xie <xieyisheng1@...wei.com>
To: <linux-kernel@...r.kernel.org>
CC: <andy.shevchenko@...il.com>, Yisheng Xie <xieyisheng1@...wei.com>,
"David S. Miller" <davem@...emloft.net>,
Anthony Yznaga <anthony.yznaga@...cle.com>,
Pavel Tatashin <pasha.tatashin@...cle.com>,
<sparclinux@...r.kernel.org>
Subject: [PATCH v2 21/21] sparc64: use match_string() helper
match_string() returns the index of an array for a matching string,
which can be used instead of open coded variant.
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Anthony Yznaga <anthony.yznaga@...cle.com>
Cc: Pavel Tatashin <pasha.tatashin@...cle.com>
Cc: sparclinux@...r.kernel.org
Signed-off-by: Yisheng Xie <xieyisheng1@...wei.com>
---
arch/sparc/kernel/setup_64.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 7944b3c..7af8c7e 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -512,10 +512,9 @@ static unsigned long __init mdesc_cpu_hwcap_list(void)
break;
}
}
- for (i = 0; i < ARRAY_SIZE(crypto_hwcaps); i++) {
- if (!strcmp(prop, crypto_hwcaps[i]))
- caps |= HWCAP_SPARC_CRYPTO;
- }
+ i = match_string(crypto_hwcaps, ARRAY_SIZE(crypto_hwcaps), prop);
+ if (i >= 0)
+ caps |= HWCAP_SPARC_CRYPTO;
plen = strlen(prop) + 1;
prop += plen;
--
1.7.12.4
Powered by blists - more mailing lists