summaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/cpu/cpufreq/longhaul.c
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2006-05-30 17:37:15 -0400
committerDave Jones <davej@redhat.com>2006-05-30 17:37:15 -0400
commite2aa8732ac11570acddf326874a34ab684752e34 (patch)
tree968a22e50a92b280ada993d5e92c6f2d3d120b57 /arch/i386/kernel/cpu/cpufreq/longhaul.c
parent8cbe0169053ffa185ad349088eb0901946c14a09 (diff)
downloadkernel-crypto-e2aa8732ac11570acddf326874a34ab684752e34.tar.gz
kernel-crypto-e2aa8732ac11570acddf326874a34ab684752e34.tar.xz
kernel-crypto-e2aa8732ac11570acddf326874a34ab684752e34.zip
[CPUFREQ] Clean up longhaul's speed pretty-printer
Getting ready to move to core cpufreq. - Use snprintf - Remove unnecessary nesting improving readability. Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'arch/i386/kernel/cpu/cpufreq/longhaul.c')
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index 8ef38544453..31600576b7e 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -77,13 +77,17 @@ static char speedbuffer[8];
static char *print_speed(int speed)
{
- if (speed > 1000) {
- if (speed%1000 == 0)
- sprintf (speedbuffer, "%dGHz", speed/1000);
- else
- sprintf (speedbuffer, "%d.%dGHz", speed/1000, (speed%1000)/100);
- } else
- sprintf (speedbuffer, "%dMHz", speed);
+ if (speed < 1000) {
+ snprintf(speedbuffer, sizeof(speedbuffer),"%dMHz", speed);
+ return speedbuffer;
+ }
+
+ if (speed%1000 == 0)
+ snprintf(speedbuffer, sizeof(speedbuffer),
+ "%dGHz", speed/1000);
+ else
+ snprintf(speedbuffer, sizeof(speedbuffer),
+ "%d.%dGHz", speed/1000, (speed%1000)/100);
return speedbuffer;
}