1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-12-16 16:35:45 +00:00

Use unsigned type instead of uint8_t as parameter for cpu_msr_driver_open_core()

This commit is contained in:
Xorg 2016-05-19 08:46:19 +02:00
parent c2c32a1a70
commit b067c68073
2 changed files with 7 additions and 7 deletions

View file

@ -832,7 +832,7 @@ struct msr_driver_t* cpu_msr_driver_open(void);
* The error message can be obtained by calling \ref cpuid_error. * The error message can be obtained by calling \ref cpuid_error.
* @see cpu_error_t * @see cpu_error_t
*/ */
struct msr_driver_t* cpu_msr_driver_open_core(uint8_t core_num); struct msr_driver_t* cpu_msr_driver_open_core(unsigned core_num);
/** /**
* @brief Reads a Model-Specific Register (MSR) * @brief Reads a Model-Specific Register (MSR)

View file

@ -46,7 +46,7 @@ struct msr_driver_t* cpu_msr_driver_open(void)
return cpu_msr_driver_open_core(0); return cpu_msr_driver_open_core(0);
} }
struct msr_driver_t* cpu_msr_driver_open_core(uint8_t core_num) struct msr_driver_t* cpu_msr_driver_open_core(unsigned core_num)
{ {
char msr[32]; char msr[32];
struct msr_driver_t* handle; struct msr_driver_t* handle;
@ -58,7 +58,7 @@ struct msr_driver_t* cpu_msr_driver_open_core(uint8_t core_num)
set_error(ERR_NO_RDMSR); set_error(ERR_NO_RDMSR);
return NULL; return NULL;
} }
sprintf(msr, "/dev/cpu/%i/msr", core_num); sprintf(msr, "/dev/cpu/%u/msr", core_num);
int fd = open(msr, O_RDONLY); int fd = open(msr, O_RDONLY);
if (fd < 0) { if (fd < 0) {
if (errno == EIO) { if (errno == EIO) {
@ -111,7 +111,7 @@ struct msr_driver_t* cpu_msr_driver_open(void)
return cpu_msr_driver_open_core(0); return cpu_msr_driver_open_core(0);
} }
struct msr_driver_t* cpu_msr_driver_open_core(uint8_t core_num) struct msr_driver_t* cpu_msr_driver_open_core(unsigned core_num)
{ {
char msr[32]; char msr[32];
struct msr_driver_t* handle; struct msr_driver_t* handle;
@ -123,7 +123,7 @@ struct msr_driver_t* cpu_msr_driver_open_core(uint8_t core_num)
set_error(ERR_NO_RDMSR); set_error(ERR_NO_RDMSR);
return NULL; return NULL;
} }
sprintf(msr, "/dev/cpuctl%i", core_num); sprintf(msr, "/dev/cpuctl%u", core_num);
int fd = open(msr, O_RDONLY); int fd = open(msr, O_RDONLY);
if (fd < 0) { if (fd < 0) {
if (errno == EIO) { if (errno == EIO) {
@ -220,7 +220,7 @@ struct msr_driver_t* cpu_msr_driver_open(void)
return drv; return drv;
} }
struct msr_driver_t* cpu_msr_driver_open_core(int core_num) struct msr_driver_t* cpu_msr_driver_open_core(unsigned core_num)
{ {
warnf("cpu_msr_driver_open_core(): parameter ignored (function is the same as cpu_msr_driver_open)\n"); warnf("cpu_msr_driver_open_core(): parameter ignored (function is the same as cpu_msr_driver_open)\n");
return cpu_msr_driver_open(); return cpu_msr_driver_open();
@ -433,7 +433,7 @@ struct msr_driver_t* cpu_msr_driver_open(void)
return NULL; return NULL;
} }
struct msr_driver_t* cpu_msr_driver_open_core(int core_num) struct msr_driver_t* cpu_msr_driver_open_core(unsigned core_num)
{ {
set_error(ERR_NOT_IMP); set_error(ERR_NOT_IMP);
return NULL; return NULL;