Commit 4ab2a3ec authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

cpuinfo: x86 -- Drop redundant cpu_has helper

It's simply a wrapper over cpu_has_feature,
so use this it directly instead.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 4ad462b4
...@@ -29,7 +29,6 @@ const char * const x86_cap_flags[NCAPINTS_BITS] = { ...@@ -29,7 +29,6 @@ const char * const x86_cap_flags[NCAPINTS_BITS] = {
}; };
static DECLARE_BITMAP(cpu_features, 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) void cpu_set_feature(unsigned int feature)
{ {
...@@ -40,7 +39,7 @@ 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) bool cpu_has_feature(unsigned int feature)
{ {
if (likely(feature < NCAPINTS_BITS)) if (likely(feature < NCAPINTS_BITS))
return cpu_has(feature); return test_bit(feature, cpu_features);
return false; return false;
} }
...@@ -67,17 +66,17 @@ int cpu_init(void) ...@@ -67,17 +66,17 @@ int cpu_init(void)
* Make sure that at least FPU is onboard * Make sure that at least FPU is onboard
* and fxsave is supported. * and fxsave is supported.
*/ */
if (cpu_has(X86_FEATURE_FPU)) { if (cpu_has_feature(X86_FEATURE_FPU)) {
if (!cpu_has(X86_FEATURE_FXSR)) { if (!cpu_has_feature(X86_FEATURE_FXSR)) {
pr_err("missing support fxsave/restore insns\n"); pr_err("missing support fxsave/restore insns\n");
return -1; return -1;
} }
} }
pr_debug("fpu:%d fxsr:%d xsave:%d\n", pr_debug("fpu:%d fxsr:%d xsave:%d\n",
!!cpu_has(X86_FEATURE_FPU), !!cpu_has_feature(X86_FEATURE_FPU),
!!cpu_has(X86_FEATURE_FXSR), !!cpu_has_feature(X86_FEATURE_FXSR),
!!cpu_has(X86_FEATURE_XSAVE)); !!cpu_has_feature(X86_FEATURE_XSAVE));
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment