Commit 38e548ee1a79c8da7b3d9e26f2adce9b61413f84

Authored by Tobias Klauser
Committed by Linus Torvalds
1 parent 0d6d82b671

[PATCH] arch/i386: Use ARRAY_SIZE macro

Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0])

Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 5 changed files with 6 additions and 7 deletions Side-by-side Diff

arch/i386/kernel/apm.c
... ... @@ -447,8 +447,7 @@
447 447 "system standby resume",
448 448 "capabilities change"
449 449 };
450   -#define NR_APM_EVENT_NAME \
451   - (sizeof(apm_event_name) / sizeof(apm_event_name[0]))
  450 +#define NR_APM_EVENT_NAME ARRAY_SIZE(apm_event_name)
452 451  
453 452 typedef struct lookup_t {
454 453 int key;
... ... @@ -479,7 +478,7 @@
479 478 { APM_NO_ERROR, "BIOS did not set a return code" },
480 479 { APM_NOT_PRESENT, "No APM present" }
481 480 };
482   -#define ERROR_COUNT (sizeof(error_table)/sizeof(lookup_t))
  481 +#define ERROR_COUNT ARRAY_SIZE(error_table)
483 482  
484 483 /**
485 484 * apm_error - display an APM error
arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
... ... @@ -67,7 +67,7 @@
67 67 [CPU_MP4HT_D0] = {15, 3, 4 },
68 68 [CPU_MP4HT_E0] = {15, 4, 1 },
69 69 };
70   -#define N_IDS (sizeof(cpu_ids)/sizeof(cpu_ids[0]))
  70 +#define N_IDS ARRAY_SIZE(cpu_ids)
71 71  
72 72 struct cpu_model
73 73 {
arch/i386/kernel/mca.c
... ... @@ -132,7 +132,7 @@
132 132 { .start = 0x100, .end = 0x107, .name = "POS (MCA)" }
133 133 };
134 134  
135   -#define MCA_STANDARD_RESOURCES (sizeof(mca_standard_resources)/sizeof(struct resource))
  135 +#define MCA_STANDARD_RESOURCES ARRAY_SIZE(mca_standard_resources)
136 136  
137 137 /**
138 138 * mca_read_and_store_pos - read the POS registers into a memory buffer
arch/i386/kernel/reboot_fixups.c
... ... @@ -42,7 +42,7 @@
42 42 struct pci_dev *dev;
43 43 int i;
44 44  
45   - for (i=0; i < (sizeof(fixups_table)/sizeof(fixups_table[0])); i++) {
  45 + for (i=0; i < ARRAY_SIZE(fixups_table); i++) {
46 46 cur = &(fixups_table[i]);
47 47 dev = pci_get_device(cur->vendor, cur->device, NULL);
48 48 if (!dev)
arch/i386/kernel/smpboot.c
... ... @@ -612,7 +612,7 @@
612 612  
613 613 printk("Inquiring remote APIC #%d...\n", apicid);
614 614  
615   - for (i = 0; i < sizeof(regs) / sizeof(*regs); i++) {
  615 + for (i = 0; i < ARRAY_SIZE(regs); i++) {
616 616 printk("... APIC #%d %s: ", apicid, names[i]);
617 617  
618 618 /*