[CRIU] [PATCH 04/12] cpuinfo: x86 -- Drop redundant cpu_has helper

Cyrill Gorcunov gorcunov at openvz.org
Tue Sep 30 10:18:47 PDT 2014


It's simply a wrapper over cpu_has_feature,
so use this it directly instead.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 arch/x86/cpu.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/x86/cpu.c b/arch/x86/cpu.c
index e180d2306e9e..47f41fc1fcb7 100644
--- a/arch/x86/cpu.c
+++ b/arch/x86/cpu.c
@@ -29,7 +29,6 @@ const char * const x86_cap_flags[NCAPINTS_BITS] = {
 };
 
 static DECLARE_BITMAP(cpu_features, NCAPINTS_BITS);
-#define cpu_has(bit)	test_bit(bit, cpu_features)
 
 void cpu_set_feature(unsigned int feature)
 {
@@ -40,7 +39,7 @@ void cpu_set_feature(unsigned int feature)
 bool cpu_has_feature(unsigned int feature)
 {
 	if (likely(feature < NCAPINTS_BITS))
-		return cpu_has(feature);
+		return test_bit(feature, cpu_features);
 	return false;
 }
 
@@ -67,17 +66,17 @@ int cpu_init(void)
 	 * Make sure that at least FPU is onboard
 	 * and fxsave is supported.
 	 */
-	if (cpu_has(X86_FEATURE_FPU)) {
-		if (!cpu_has(X86_FEATURE_FXSR)) {
+	if (cpu_has_feature(X86_FEATURE_FPU)) {
+		if (!cpu_has_feature(X86_FEATURE_FXSR)) {
 			pr_err("missing support fxsave/restore insns\n");
 			return -1;
 		}
 	}
 
 	pr_debug("fpu:%d fxsr:%d xsave:%d\n",
-		 !!cpu_has(X86_FEATURE_FPU),
-		 !!cpu_has(X86_FEATURE_FXSR),
-		 !!cpu_has(X86_FEATURE_XSAVE));
+		 !!cpu_has_feature(X86_FEATURE_FPU),
+		 !!cpu_has_feature(X86_FEATURE_FXSR),
+		 !!cpu_has_feature(X86_FEATURE_XSAVE));
 
 	return 0;
 }
-- 
1.9.3



More information about the CRIU mailing list