Commit 16ad1b49 authored by Alex Unleashed's avatar Alex Unleashed Committed by Linus Torvalds

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: default avatarAlejandro Martinez Ruiz <alex@flawedcode.org>
Cc: Mikael Starvik <starvik@axis.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f150f352
...@@ -304,7 +304,7 @@ static unsigned char clear_group_from_set(const unsigned char groups, struct if_ ...@@ -304,7 +304,7 @@ static unsigned char clear_group_from_set(const unsigned char groups, struct if_
static struct if_group *get_group(const unsigned char groups) static struct if_group *get_group(const unsigned char groups)
{ {
int i; int i;
for (i = 0; i < sizeof(if_groups)/sizeof(struct if_group); i++) { for (i = 0; i < ARRAY_SIZE(if_groups); i++) {
if (groups & if_groups[i].group) { if (groups & if_groups[i].group) {
return &if_groups[i]; return &if_groups[i];
} }
......
...@@ -57,8 +57,8 @@ int show_cpuinfo(struct seq_file *m, void *v) ...@@ -57,8 +57,8 @@ int show_cpuinfo(struct seq_file *m, void *v)
revision = rdvr(); revision = rdvr();
if (revision >= sizeof cpu_info/sizeof *cpu_info) if (revision >= ARRAY_SIZE(cpu_info))
info = &cpu_info[sizeof cpu_info/sizeof *cpu_info - 1]; info = &cpu_info[ARRAY_SIZE(cpu_info) - 1];
else else
info = &cpu_info[revision]; info = &cpu_info[revision];
......
...@@ -185,7 +185,7 @@ static struct sync_port ports[]= ...@@ -185,7 +185,7 @@ static struct sync_port ports[]=
} }
}; };
#define NUMBER_OF_PORTS (sizeof(ports)/sizeof(sync_port)) #define NUMBER_OF_PORTS ARRAY_SIZE(ports)
static const struct file_operations sync_serial_fops = { static const struct file_operations sync_serial_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -49,7 +49,7 @@ struct crisv32_ioport crisv32_ioports[] = ...@@ -49,7 +49,7 @@ struct crisv32_ioport crisv32_ioports[] =
} }
}; };
#define NBR_OF_PORTS sizeof(crisv32_ioports)/sizeof(struct crisv32_ioport) #define NBR_OF_PORTS ARRAY_SIZE(crisv32_ioports)
struct crisv32_iopin crisv32_led1_green; struct crisv32_iopin crisv32_led1_green;
struct crisv32_iopin crisv32_led1_red; struct crisv32_iopin crisv32_led1_red;
......
...@@ -54,12 +54,10 @@ show_cpuinfo(struct seq_file *m, void *v) ...@@ -54,12 +54,10 @@ show_cpuinfo(struct seq_file *m, void *v)
{ {
int i; int i;
int cpu = (int)v - 1; int cpu = (int)v - 1;
int entries;
unsigned long revision; unsigned long revision;
struct cpu_info *info; struct cpu_info *info;
entries = sizeof cpinfo / sizeof(struct cpu_info); info = &cpinfo[ARRAY_SIZE(cpinfo) - 1];
info = &cpinfo[entries - 1];
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (!cpu_online(cpu)) if (!cpu_online(cpu))
...@@ -68,7 +66,7 @@ show_cpuinfo(struct seq_file *m, void *v) ...@@ -68,7 +66,7 @@ show_cpuinfo(struct seq_file *m, void *v)
revision = rdvr(); revision = rdvr();
for (i = 0; i < entries; i++) { for (i = 0; i < ARRAY_SIZE(cpinfo); i++) {
if (cpinfo[i].rev == revision) { if (cpinfo[i].rev == revision) {
info = &cpinfo[i]; info = &cpinfo[i];
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment