diff options
author | Alex Unleashed <alex@flawedcode.org> | 2007-11-14 20:01:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-14 21:45:46 -0500 |
commit | 16ad1b49104684da3ab0fede79f29b01f4c76896 (patch) | |
tree | 941aa34bbe00df34f619526e198d9d6e0124f45c /arch/cris | |
parent | f150f35232daaedd86e46d2581e3b7eb40e2c360 (diff) |
cris: ARRAY_SIZE() cleanup
I'm converting most array size calculations under arch/ to use
ARRAY_SIZE(). This is the patch for CRIS.
Signed-off-by: Alejandro Martinez Ruiz <alex@flawedcode.org>
Cc: Mikael Starvik <starvik@axis.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/cris')
-rw-r--r-- | arch/cris/arch-v10/kernel/io_interface_mux.c | 2 | ||||
-rw-r--r-- | arch/cris/arch-v10/kernel/setup.c | 4 | ||||
-rw-r--r-- | arch/cris/arch-v32/drivers/sync_serial.c | 2 | ||||
-rw-r--r-- | arch/cris/arch-v32/kernel/io.c | 2 | ||||
-rw-r--r-- | arch/cris/arch-v32/kernel/setup.c | 6 |
5 files changed, 7 insertions, 9 deletions
diff --git a/arch/cris/arch-v10/kernel/io_interface_mux.c b/arch/cris/arch-v10/kernel/io_interface_mux.c index 29d48ad00df9..3a9114e89edf 100644 --- a/arch/cris/arch-v10/kernel/io_interface_mux.c +++ b/arch/cris/arch-v10/kernel/io_interface_mux.c | |||
@@ -304,7 +304,7 @@ static unsigned char clear_group_from_set(const unsigned char groups, struct if_ | |||
304 | static struct if_group *get_group(const unsigned char groups) | 304 | static struct if_group *get_group(const unsigned char groups) |
305 | { | 305 | { |
306 | int i; | 306 | int i; |
307 | for (i = 0; i < sizeof(if_groups)/sizeof(struct if_group); i++) { | 307 | for (i = 0; i < ARRAY_SIZE(if_groups); i++) { |
308 | if (groups & if_groups[i].group) { | 308 | if (groups & if_groups[i].group) { |
309 | return &if_groups[i]; | 309 | return &if_groups[i]; |
310 | } | 310 | } |
diff --git a/arch/cris/arch-v10/kernel/setup.c b/arch/cris/arch-v10/kernel/setup.c index ad410afe3cc3..de27b50b72a2 100644 --- a/arch/cris/arch-v10/kernel/setup.c +++ b/arch/cris/arch-v10/kernel/setup.c | |||
@@ -57,8 +57,8 @@ int show_cpuinfo(struct seq_file *m, void *v) | |||
57 | 57 | ||
58 | revision = rdvr(); | 58 | revision = rdvr(); |
59 | 59 | ||
60 | if (revision >= sizeof cpu_info/sizeof *cpu_info) | 60 | if (revision >= ARRAY_SIZE(cpu_info)) |
61 | info = &cpu_info[sizeof cpu_info/sizeof *cpu_info - 1]; | 61 | info = &cpu_info[ARRAY_SIZE(cpu_info) - 1]; |
62 | else | 62 | else |
63 | info = &cpu_info[revision]; | 63 | info = &cpu_info[revision]; |
64 | 64 | ||
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c index df89298aafc4..d581b0a92a3f 100644 --- a/arch/cris/arch-v32/drivers/sync_serial.c +++ b/arch/cris/arch-v32/drivers/sync_serial.c | |||
@@ -185,7 +185,7 @@ static struct sync_port ports[]= | |||
185 | } | 185 | } |
186 | }; | 186 | }; |
187 | 187 | ||
188 | #define NUMBER_OF_PORTS (sizeof(ports)/sizeof(sync_port)) | 188 | #define NUMBER_OF_PORTS ARRAY_SIZE(ports) |
189 | 189 | ||
190 | static const struct file_operations sync_serial_fops = { | 190 | static const struct file_operations sync_serial_fops = { |
191 | .owner = THIS_MODULE, | 191 | .owner = THIS_MODULE, |
diff --git a/arch/cris/arch-v32/kernel/io.c b/arch/cris/arch-v32/kernel/io.c index dfbfcb8d2585..a22a9e02e093 100644 --- a/arch/cris/arch-v32/kernel/io.c +++ b/arch/cris/arch-v32/kernel/io.c | |||
@@ -49,7 +49,7 @@ struct crisv32_ioport crisv32_ioports[] = | |||
49 | } | 49 | } |
50 | }; | 50 | }; |
51 | 51 | ||
52 | #define NBR_OF_PORTS sizeof(crisv32_ioports)/sizeof(struct crisv32_ioport) | 52 | #define NBR_OF_PORTS ARRAY_SIZE(crisv32_ioports) |
53 | 53 | ||
54 | struct crisv32_iopin crisv32_led1_green; | 54 | struct crisv32_iopin crisv32_led1_green; |
55 | struct crisv32_iopin crisv32_led1_red; | 55 | struct crisv32_iopin crisv32_led1_red; |
diff --git a/arch/cris/arch-v32/kernel/setup.c b/arch/cris/arch-v32/kernel/setup.c index 4662f363df63..72e9e8331f63 100644 --- a/arch/cris/arch-v32/kernel/setup.c +++ b/arch/cris/arch-v32/kernel/setup.c | |||
@@ -54,12 +54,10 @@ show_cpuinfo(struct seq_file *m, void *v) | |||
54 | { | 54 | { |
55 | int i; | 55 | int i; |
56 | int cpu = (int)v - 1; | 56 | int cpu = (int)v - 1; |
57 | int entries; | ||
58 | unsigned long revision; | 57 | unsigned long revision; |
59 | struct cpu_info *info; | 58 | struct cpu_info *info; |
60 | 59 | ||
61 | entries = sizeof cpinfo / sizeof(struct cpu_info); | 60 | info = &cpinfo[ARRAY_SIZE(cpinfo) - 1]; |
62 | info = &cpinfo[entries - 1]; | ||
63 | 61 | ||
64 | #ifdef CONFIG_SMP | 62 | #ifdef CONFIG_SMP |
65 | if (!cpu_online(cpu)) | 63 | if (!cpu_online(cpu)) |
@@ -68,7 +66,7 @@ show_cpuinfo(struct seq_file *m, void *v) | |||
68 | 66 | ||
69 | revision = rdvr(); | 67 | revision = rdvr(); |
70 | 68 | ||
71 | for (i = 0; i < entries; i++) { | 69 | for (i = 0; i < ARRAY_SIZE(cpinfo); i++) { |
72 | if (cpinfo[i].rev == revision) { | 70 | if (cpinfo[i].rev == revision) { |
73 | info = &cpinfo[i]; | 71 | info = &cpinfo[i]; |
74 | break; | 72 | break; |