diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-09-26 02:33:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 11:49:05 -0400 |
commit | 91b165c0594ab78c64f26d26e3174e6dfd60ed9d (patch) | |
tree | 0730eefa9d4ce786f7f561e3b40700418d6d0970 /arch/um/sys-i386/bugs.c | |
parent | 13c06be399902c9ebda08e092edb1614bb4a3761 (diff) |
[PATCH] uml: Use ARRAY_SIZE more assiduously
There were a bunch of missed ARRAY_SIZE opportunities.
Also, some formatting fixes in the affected areas of code.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/sys-i386/bugs.c')
-rw-r--r-- | arch/um/sys-i386/bugs.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/um/sys-i386/bugs.c b/arch/um/sys-i386/bugs.c index 41b0ab2fe830..f1bcd399ac90 100644 --- a/arch/um/sys-i386/bugs.c +++ b/arch/um/sys-i386/bugs.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include "sysdep/ptrace.h" | 13 | #include "sysdep/ptrace.h" |
14 | #include "task.h" | 14 | #include "task.h" |
15 | #include "os.h" | 15 | #include "os.h" |
16 | #include "user_util.h" | ||
16 | 17 | ||
17 | #define MAXTOKEN 64 | 18 | #define MAXTOKEN 64 |
18 | 19 | ||
@@ -104,17 +105,17 @@ int cpu_feature(char *what, char *buf, int len) | |||
104 | static int check_cpu_flag(char *feature, int *have_it) | 105 | static int check_cpu_flag(char *feature, int *have_it) |
105 | { | 106 | { |
106 | char buf[MAXTOKEN], c; | 107 | char buf[MAXTOKEN], c; |
107 | int fd, len = sizeof(buf)/sizeof(buf[0]); | 108 | int fd, len = ARRAY_SIZE(buf); |
108 | 109 | ||
109 | printk("Checking for host processor %s support...", feature); | 110 | printk("Checking for host processor %s support...", feature); |
110 | fd = os_open_file("/proc/cpuinfo", of_read(OPENFLAGS()), 0); | 111 | fd = os_open_file("/proc/cpuinfo", of_read(OPENFLAGS()), 0); |
111 | if(fd < 0){ | 112 | if(fd < 0){ |
112 | printk("Couldn't open /proc/cpuinfo, err = %d\n", -fd); | 113 | printk("Couldn't open /proc/cpuinfo, err = %d\n", -fd); |
113 | return(0); | 114 | return 0; |
114 | } | 115 | } |
115 | 116 | ||
116 | *have_it = 0; | 117 | *have_it = 0; |
117 | if(!find_cpuinfo_line(fd, "flags", buf, sizeof(buf) / sizeof(buf[0]))) | 118 | if(!find_cpuinfo_line(fd, "flags", buf, ARRAY_SIZE(buf))) |
118 | goto out; | 119 | goto out; |
119 | 120 | ||
120 | c = token(fd, buf, len - 1, ' '); | 121 | c = token(fd, buf, len - 1, ' '); |
@@ -138,7 +139,7 @@ static int check_cpu_flag(char *feature, int *have_it) | |||
138 | if(*have_it == 0) printk("No\n"); | 139 | if(*have_it == 0) printk("No\n"); |
139 | else if(*have_it == 1) printk("Yes\n"); | 140 | else if(*have_it == 1) printk("Yes\n"); |
140 | os_close_file(fd); | 141 | os_close_file(fd); |
141 | return(1); | 142 | return 1; |
142 | } | 143 | } |
143 | 144 | ||
144 | #if 0 /* This doesn't work in tt mode, plus it's causing compilation problems | 145 | #if 0 /* This doesn't work in tt mode, plus it's causing compilation problems |