Apply format corrections

This commit is contained in:
Marc Di Luzio 2019-02-03 18:37:17 +00:00
parent 142b2fb32d
commit ff1a838ab7
3 changed files with 10 additions and 8 deletions

View File

@ -547,7 +547,6 @@ void config_get_nv_core_clock_mhz_offset(GameModeConfig *self, long *value)
void config_get_nv_mem_clock_mhz_offset(GameModeConfig *self, long *value) void config_get_nv_mem_clock_mhz_offset(GameModeConfig *self, long *value)
{ {
memcpy_locked_config(self, value, &self->nv_mem_clock_mhz_offset, sizeof(long)); memcpy_locked_config(self, value, &self->nv_mem_clock_mhz_offset, sizeof(long));
} }
void config_get_nv_perf_level(GameModeConfig *self, long *value) void config_get_nv_perf_level(GameModeConfig *self, long *value)
{ {

View File

@ -124,9 +124,11 @@ int game_mode_initialise_gpu(GameModeConfig *config, GameModeGPUInfo **info)
/* Sanity check the performance level value as well */ /* Sanity check the performance level value as well */
config_get_nv_perf_level(config, &new_info->nv_perf_level); config_get_nv_perf_level(config, &new_info->nv_perf_level);
if(new_info->nv_perf_level < 0 || new_info->nv_perf_level > 16) if (new_info->nv_perf_level < 0 || new_info->nv_perf_level > 16) {
{ LOG_ERROR(
LOG_ERROR( "ERROR: NVIDIA Performance level value invalid (%ld), will not apply optimisations!\n", new_info->nv_perf_level ); "ERROR: NVIDIA Performance level value invalid (%ld), will not apply "
"optimisations!\n",
new_info->nv_perf_level);
free(new_info); free(new_info);
return -1; return -1;
} }

View File

@ -36,7 +36,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "gpu-control.h" #include "gpu-control.h"
/* Helper to quit with usage */ /* Helper to quit with usage */
static const char *usage_text = "usage: gpuclockctl PCI_ID DEVICE [get] [set CORE MEM [PERF_LEVEL]]]"; static const char *usage_text =
"usage: gpuclockctl PCI_ID DEVICE [get] [set CORE MEM [PERF_LEVEL]]]";
static void print_usage_and_exit(void) static void print_usage_and_exit(void)
{ {
fprintf(stderr, "%s\n", usage_text); fprintf(stderr, "%s\n", usage_text);
@ -95,7 +96,7 @@ int main(int argc, char *argv[])
get_gpu_state(&info); get_gpu_state(&info);
printf("%ld %ld\n", info.core, info.mem); printf("%ld %ld\n", info.core, info.mem);
} else if (argc >=6 && argc <=7 && strncmp(argv[3], "set", 3) == 0) { } else if (argc >= 6 && argc <= 7 && strncmp(argv[3], "set", 3) == 0) {
/* Must be root to set the state */ /* Must be root to set the state */
if (geteuid() != 0) { if (geteuid() != 0) {
fprintf(stderr, "gpuclockctl must be run as root to set values\n"); fprintf(stderr, "gpuclockctl must be run as root to set values\n");
@ -110,7 +111,7 @@ int main(int argc, char *argv[])
info.core = get_generic_value(argv[4]); info.core = get_generic_value(argv[4]);
info.mem = get_generic_value(argv[5]); info.mem = get_generic_value(argv[5]);
if( info.vendor == Vendor_NVIDIA ) if (info.vendor == Vendor_NVIDIA)
info.nv_perf_level = get_generic_value(argv[6]); info.nv_perf_level = get_generic_value(argv[6]);
printf("gpuclockctl setting core:%ld mem:%ld on device:%ld with vendor 0x%04x\n", printf("gpuclockctl setting core:%ld mem:%ld on device:%ld with vendor 0x%04x\n",
@ -119,7 +120,7 @@ int main(int argc, char *argv[])
info.device, info.device,
(unsigned short)info.vendor); (unsigned short)info.vendor);
if( info.vendor == Vendor_NVIDIA ) if (info.vendor == Vendor_NVIDIA)
printf("on Performance Level %ld\n", info.nv_perf_level); printf("on Performance Level %ld\n", info.nv_perf_level);
return set_gpu_state(&info); return set_gpu_state(&info);