diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2004-07-14 05:38:38 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2004-07-14 05:38:38 +0000 |
commit | d8cb00a3eea2e3efb7fcaca41b8f8259439dde8d (patch) | |
tree | 9f21726b1d401f48bcd252e4c518ddbf33ec32c7 /sys/arch/i386 | |
parent | 228f858cd931a333f7231e84d9de3d6a6a525421 (diff) |
names of frequencies aren't interesting, and require ugly snprintf
manipulation theo doesn't like. just print number of states.
this way doesn't leak the memory for the string either.
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/i386/powernow-k7.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/sys/arch/i386/i386/powernow-k7.c b/sys/arch/i386/i386/powernow-k7.c index cf17dc06f0e..0f991adb309 100644 --- a/sys/arch/i386/i386/powernow-k7.c +++ b/sys/arch/i386/i386/powernow-k7.c @@ -1,3 +1,4 @@ +/* $OpenBSD: powernow-k7.c,v 1.2 2004/07/14 05:38:37 tedu Exp $ */ /* * Copyright (c) 2004 Martin Végiard. * All rights reserved. @@ -210,34 +211,24 @@ k7_powernow_setperf(int level) void k7_powernow_init(uint32_t signature) { - unsigned int i, freq_names_len, len = 0; + unsigned int i; struct state_s *s; - char *freq_names; s = k7_powernow_getstates(signature); if (s == 0) return; - freq_names_len = k7pnow_nstates * (sizeof("9999 ")-1) + 1; - freq_names = malloc(freq_names_len, M_TEMP, M_WAITOK); - k7pnow_freq_table = malloc(sizeof(struct k7pnow_freq_table_s) * k7pnow_nstates, M_TEMP, M_WAITOK); for (i = 0; i < k7pnow_nstates; i++, s++) { k7pnow_freq_table[i].frequency = cpufreq(s->fid); k7pnow_freq_table[i].state = s; - - /* XXX len += snprintf is an illegal idiom */ - len += snprintf(freq_names + len, freq_names_len - len, "%d%s", - k7pnow_freq_table[i].frequency, - i < k7pnow_nstates - 1 ? " " : ""); } /* On bootup the frequency should be at it's max */ k7pnow_cur_freq = k7pnow_freq_table[i-1].frequency; - printf("cpu0: AMD POWERNOW Available frequencies (Mhz): %s\n", - freq_names); + printf("cpu0: AMD POWERNOW: %d available states\n", k7pnow_nstates); cpu_setperf = k7_powernow_setperf; } |