[PATCH] oprofile: Fix unnecessary cleverness
authorMarkus Armbruster <armbru@redhat.com>
Mon, 26 Jun 2006 07:24:34 +0000 (00:24 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 26 Jun 2006 16:58:17 +0000 (09:58 -0700)
nmi_create_files() in arch/i386/oprofile/nmi_int.c depends on
model->num_counters (number of performance counters) being less than 10.
While this is currently the case, it's too clever by half.

Other archs aren't quite as clever: they assume 100.  I suggest to
normalize them all to 1000.

Cc: Philippe Elie <phil.el@wanadoo.fr>
Cc: John Levon <levon@movementarian.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/alpha/oprofile/common.c
arch/i386/oprofile/nmi_int.c
arch/mips/oprofile/common.c
arch/powerpc/oprofile/common.c
arch/sh/oprofile/op_model_sh7750.c

index ba788cfdc3c6cb00a31f31d82cd1f545420ff751..9fc0eeb4f0abffb573b69365d28eca36b5d5e70d 100644 (file)
@@ -112,7 +112,7 @@ op_axp_create_files(struct super_block * sb, struct dentry * root)
 
        for (i = 0; i < model->num_counters; ++i) {
                struct dentry *dir;
-               char buf[3];
+               char buf[4];
 
                snprintf(buf, sizeof buf, "%d", i);
                dir = oprofilefs_mkdir(sb, root, buf);
index ec0fd3cfa774aa575fe6c3cf42da2af2c0e56f96..fa8a37bcb391995e8d0de88dac0208f2d9458a52 100644 (file)
@@ -281,9 +281,9 @@ static int nmi_create_files(struct super_block * sb, struct dentry * root)
 
        for (i = 0; i < model->num_counters; ++i) {
                struct dentry * dir;
-               char buf[2];
+               char buf[4];
  
-               snprintf(buf, 2, "%d", i);
+               snprintf(buf,  sizeof(buf), "%d", i);
                dir = oprofilefs_mkdir(sb, root, buf);
                oprofilefs_create_ulong(sb, dir, "enabled", &counter_config[i].enabled); 
                oprofilefs_create_ulong(sb, dir, "event", &counter_config[i].event); 
index c31e4cff64e043437a9019bfeae3890c2ee043eb..65eb55400d772f091a0fbbc4f55b18903c0c7955 100644 (file)
@@ -38,7 +38,7 @@ static int op_mips_create_files(struct super_block * sb, struct dentry * root)
 
        for (i = 0; i < model->num_counters; ++i) {
                struct dentry *dir;
-               char buf[3];
+               char buf[4];
 
                snprintf(buf, sizeof buf, "%d", i);
                dir = oprofilefs_mkdir(sb, root, buf);
index 27ad56bd227e7af5215c6803c40e860a778364bd..fd0bbbe7a4de480fe5de9ff22f944270edace114 100644 (file)
@@ -94,7 +94,7 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root)
 
        for (i = 0; i < model->num_counters; ++i) {
                struct dentry *dir;
-               char buf[3];
+               char buf[4];
 
                snprintf(buf, sizeof buf, "%d", i);
                dir = oprofilefs_mkdir(sb, root, buf);
index 5ec9ddcc4b0bd1d40d69c699dd1cb636f4e0ce9b..c265185b22a72b92a0d48c3f68fd1ca100bc45da 100644 (file)
@@ -198,7 +198,7 @@ static int sh7750_perf_counter_create_files(struct super_block *sb, struct dentr
 
        for (i = 0; i < NR_CNTRS; i++) {
                struct dentry *dir;
-               char buf[3];
+               char buf[4];
 
                snprintf(buf, sizeof(buf), "%d", i);
                dir = oprofilefs_mkdir(sb, root, buf);