From 031a5de81327026a03d153e318b4600639a4640e Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Tue, 22 Feb 2011 01:47:44 -0500 Subject: coding style cleanups --- AMD/identify.c | 8 ++++---- binary.c | 6 +++--- dumpregs.c | 2 +- features.c | 2 +- mtrr.c | 12 ++++++------ rdmsr.c | 12 ++++++------ x86info.c | 22 +++++++++++----------- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/AMD/identify.c b/AMD/identify.c index 087c0d3..b83d2d3 100644 --- a/AMD/identify.c +++ b/AMD/identify.c @@ -28,7 +28,7 @@ static void set_k8_name(struct k8_rev *r, struct cpudata *c) s[0] = 0; cont = 0; - for (i=0; (r != NULL) && (inameid & id) @@ -54,7 +54,7 @@ static void set_k8_revinfo(int id, struct cpudata *c) c->connector = 0; r = NULL; - for (i=0; iname, CPU_NAME_LEN, "AMD Turion X2 Ultra Dual-Core (%s)", p); else diff --git a/binary.c b/binary.c index 8d040b6..dbef470 100644 --- a/binary.c +++ b/binary.c @@ -13,7 +13,7 @@ void binary(unsigned int n, unsigned long value) { unsigned int i; - for (i=0; inumber, 0x80000008,&value, NULL, NULL, NULL); max_phy_addr = (value & 0xFF); } @@ -81,7 +81,7 @@ static void decode_mtrrcap(int cpu, int msr) int ret; ret = mtrr_value(cpu,msr,&val); - if(ret){ + if (ret) { printf("0x%016llx ", val); printf("(smrr flag: 0x%01x, ",(unsigned int) (val & IA32_MTRRCAP_SMRR) >> 11 ); printf("wc flag: 0x%01x, ",(unsigned int) (val&IA32_MTRRCAP_WC) >> 10); @@ -96,7 +96,7 @@ static void decode_mtrr_deftype(int cpu, int msr) int ret; ret = mtrr_value(cpu,msr,&val); - if(ret){ + if (ret) { printf("0x%016llx ", val); printf("(fixed-range flag: 0x%01x, ",(unsigned int) (val&IA32_MTRR_DEFTYPE_FE) >> 10); printf("mtrr flag: 0x%01x, ",(unsigned int) (val&IA32_MTRR_DEFTYPE_E) >> 11); @@ -111,7 +111,7 @@ static void decode_mtrr_physbase(int cpu, int msr) int ret; ret = mtrr_value(cpu,msr,&val); - if(ret){ + if (ret) { printf("0x%016llx ", val); printf("(physbase field:"); @@ -128,7 +128,7 @@ static void decode_mtrr_physmask(int cpu, int msr) int ret; ret = mtrr_value(cpu,msr,&val); - if(ret){ + if (ret) { printf("0x%016llx ", val); printf("(physmask field:"); @@ -161,7 +161,7 @@ void dump_mtrrs(struct cpudata *cpu) set_max_phy_addr(cpu); - for (i=0; i<16; i+=2) { + for (i = 0; i < 16; i+=2) { printf("MTRRphysBase%u (0x%x): ", i/2, (unsigned int) 0x200+i); decode_mtrr_physbase(cpu->number, 0x200+i); printf("MTRRphysMask%u (0x%x): ", i/2, (unsigned int) 0x201+i); diff --git a/rdmsr.c b/rdmsr.c index 15b813f..aab0880 100644 --- a/rdmsr.c +++ b/rdmsr.c @@ -80,7 +80,7 @@ int read_msr(int cpu, unsigned int idx, unsigned long long *val) (void)snprintf(cpuname, sizeof(cpuname), "/dev/cpu/%d/msr", cpu); fh = open(cpuname, O_RDONLY); - if (fh==-1) { + if (fh == -1) { perror(cpuname); nodriver=1; return 0; @@ -105,7 +105,7 @@ int read_msr(int cpu, unsigned int idx, unsigned long long *val) *val = hi; *val = (*val<<32) | lo; } - if (close(fh)==-1) { + if (close(fh) == -1) { perror("close"); exit(EXIT_FAILURE); } @@ -120,11 +120,11 @@ void dumpmsr(int cpu, unsigned int msr, int size) unsigned long long val=0; if (read_msr(cpu, msr, &val) == 1) { - if (size==32){ + if (size == 32){ printf("MSR: 0x%08x=0x%08lx : ", msr, (unsigned long) val); binary32(val); } - if (size==64) { + if (size == 64) { printf("MSR: 0x%08x=0x%016llx : ", msr, val); binary64(val); } @@ -138,9 +138,9 @@ void dumpmsr_bin(int cpu, unsigned int msr, int size) unsigned long long val=0; if (read_msr(cpu, msr, &val) == 1) { - if (size==32) + if (size == 32) binary32(val); - if (size==64) + if (size == 64) binary64(val); return; } diff --git a/x86info.c b/x86info.c index 7fb1177..45de42d 100644 --- a/x86info.c +++ b/x86info.c @@ -196,7 +196,7 @@ static void separator(void) { int j; - for (j=0; j<74; j++) + for (j = 0; j < 74; j++) printf("-"); printf("\n"); } @@ -244,7 +244,7 @@ static void display_topology(struct cpudata *head) if (debug == 1) { cpu = head; printf("cpu->phys_proc_id: "); - for (i=0; iphys_proc_id); cpu = cpu->next; } @@ -252,7 +252,7 @@ static void display_topology(struct cpudata *head) cpu = head; printf("cpu->x86_max_cores: "); - for (i=0; ix86_max_cores); cpu = cpu->next; } @@ -260,7 +260,7 @@ static void display_topology(struct cpudata *head) cpu = head; printf("cpu->cpu_core_id: "); - for (i=0; icpu_core_id); cpu = cpu->next; } @@ -268,19 +268,19 @@ static void display_topology(struct cpudata *head) } sockets = malloc(nrCPUs); - if (sockets==NULL) + if (sockets == NULL) return; - for (i=0; iphys_proc_id]++; cpu = cpu->next; } - for (i=0; ivendor == VENDOR_INTEL) display_topology(head); - printf (" running at an estimated "); + printf(" running at an estimated "); display_MHz(cpu); printf("\n"); out: /* Tear down the linked list. */ cpu = head; - for (i=0; iinfo_url) free(cpu->info_url); if (cpu->datasheet_url) -- cgit v1.2.3