2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

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: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov 2014-09-30 21:18:47 +04:00 committed by Pavel Emelyanov
parent 4ad462b459
commit 4ab2a3ec73

View File

@ -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)
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)
* 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;
} }