From b1cff440b7755240f4774537def42c721c1fc1b4 Mon Sep 17 00:00:00 2001 From: Xorg Date: Thu, 15 Oct 2015 16:33:50 +0200 Subject: [PATCH] Remove cpu_vendor() function, replaced by cpuid_get_vendor() function --- libcpuid/libcpuid_util.c | 15 --------------- libcpuid/libcpuid_util.h | 6 ------ libcpuid/rdmsr.c | 8 ++++---- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/libcpuid/libcpuid_util.c b/libcpuid/libcpuid_util.c index 6c02783..c907f5c 100644 --- a/libcpuid/libcpuid_util.c +++ b/libcpuid/libcpuid_util.c @@ -174,21 +174,6 @@ int match_pattern(const char* s, const char* p) return 0; } -int cpu_vendor(void) -{ - int r; - struct cpu_raw_data_t raw; - struct cpu_id_t data; - if ((r = cpuid_get_raw_data(&raw)) < 0) - return set_error(r); - if ((r = cpu_identify(&raw, &data)) < 0) - return set_error(r); - if (0 <= data.vendor && data.vendor < NUM_CPU_VENDORS) - return data.vendor; - else - return set_error(r); -} - struct cpu_id_t* get_cached_cpuid(void) { static int initialized = 0; diff --git a/libcpuid/libcpuid_util.h b/libcpuid/libcpuid_util.h index f045db6..34e1efe 100644 --- a/libcpuid/libcpuid_util.h +++ b/libcpuid/libcpuid_util.h @@ -70,12 +70,6 @@ void generic_get_cpu_list(const struct match_entry_t* matchtable, int count, */ int match_pattern(const char* haystack, const char* pattern); -/* - * Get the CPU vendor - * Return val: see enum cpu_vendor_t -*/ -int cpu_vendor(void); - /* * Gets an initialized cpu_id_t. It is cached, so that internal libcpuid * machinery doesn't need to issue cpu_identify more than once. diff --git a/libcpuid/rdmsr.c b/libcpuid/rdmsr.c index 7ae4aef..3256fd8 100644 --- a/libcpuid/rdmsr.c +++ b/libcpuid/rdmsr.c @@ -465,7 +465,7 @@ int cpu_msrinfo(struct msr_driver_t* handle, cpu_msrinfo_request_t which) return perfmsr_measure(handle, 0xe8); case INFO_CUR_MULTIPLIER: { - if(cpu_vendor() == VENDOR_INTEL) + if(cpuid_get_vendor() == VENDOR_INTEL) { if(!bclk) bclk = (double) cpu_msrinfo(handle, INFO_BCLK) / 100; @@ -482,7 +482,7 @@ int cpu_msrinfo(struct msr_driver_t* handle, cpu_msrinfo_request_t which) } case INFO_MAX_MULTIPLIER: { - if(cpu_vendor() == VENDOR_INTEL) + if(cpuid_get_vendor() == VENDOR_INTEL) { if(!multiplier) multiplier = (int) cpu_rdmsr_range(handle, PLATFORM_INFO_MSR, PLATFORM_INFO_MSR_high, PLATFORM_INFO_MSR_low, &error_indx); @@ -494,7 +494,7 @@ int cpu_msrinfo(struct msr_driver_t* handle, cpu_msrinfo_request_t which) return (int) ((r >> 40) & 0x1f) * 100; } case INFO_TEMPERATURE: - if(cpu_vendor() == VENDOR_INTEL) + if(cpuid_get_vendor() == VENDOR_INTEL) { // https://github.com/ajaiantilal/i7z/blob/5023138d7c35c4667c938b853e5ea89737334e92/helper_functions.c#L59 unsigned long val = cpu_rdmsr_range(handle, IA32_THERM_STATUS, 63, 0, &error_indx); @@ -512,7 +512,7 @@ int cpu_msrinfo(struct msr_driver_t* handle, cpu_msrinfo_request_t which) return CPU_INVALID_VALUE; case INFO_VOLTAGE: { - if(cpu_vendor() == VENDOR_INTEL) + if(cpuid_get_vendor() == VENDOR_INTEL) { unsigned long val = cpu_rdmsr_range(handle, MSR_PERF_STATUS, 47, 32, &error_indx); double ret = (double) val / (1 << 13);