mirror of
https://github.com/adulau/aha.git
synced 2025-01-04 07:03:38 +00:00
[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>
This commit is contained in:
parent
0d6d82b671
commit
38e548ee1a
5 changed files with 6 additions and 7 deletions
|
@ -447,8 +447,7 @@ static char * apm_event_name[] = {
|
||||||
"system standby resume",
|
"system standby resume",
|
||||||
"capabilities change"
|
"capabilities change"
|
||||||
};
|
};
|
||||||
#define NR_APM_EVENT_NAME \
|
#define NR_APM_EVENT_NAME ARRAY_SIZE(apm_event_name)
|
||||||
(sizeof(apm_event_name) / sizeof(apm_event_name[0]))
|
|
||||||
|
|
||||||
typedef struct lookup_t {
|
typedef struct lookup_t {
|
||||||
int key;
|
int key;
|
||||||
|
@ -479,7 +478,7 @@ static const lookup_t error_table[] = {
|
||||||
{ APM_NO_ERROR, "BIOS did not set a return code" },
|
{ APM_NO_ERROR, "BIOS did not set a return code" },
|
||||||
{ APM_NOT_PRESENT, "No APM present" }
|
{ APM_NOT_PRESENT, "No APM present" }
|
||||||
};
|
};
|
||||||
#define ERROR_COUNT (sizeof(error_table)/sizeof(lookup_t))
|
#define ERROR_COUNT ARRAY_SIZE(error_table)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* apm_error - display an APM error
|
* apm_error - display an APM error
|
||||||
|
|
|
@ -67,7 +67,7 @@ static const struct cpu_id cpu_ids[] = {
|
||||||
[CPU_MP4HT_D0] = {15, 3, 4 },
|
[CPU_MP4HT_D0] = {15, 3, 4 },
|
||||||
[CPU_MP4HT_E0] = {15, 4, 1 },
|
[CPU_MP4HT_E0] = {15, 4, 1 },
|
||||||
};
|
};
|
||||||
#define N_IDS (sizeof(cpu_ids)/sizeof(cpu_ids[0]))
|
#define N_IDS ARRAY_SIZE(cpu_ids)
|
||||||
|
|
||||||
struct cpu_model
|
struct cpu_model
|
||||||
{
|
{
|
||||||
|
|
|
@ -132,7 +132,7 @@ static struct resource mca_standard_resources[] = {
|
||||||
{ .start = 0x100, .end = 0x107, .name = "POS (MCA)" }
|
{ .start = 0x100, .end = 0x107, .name = "POS (MCA)" }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MCA_STANDARD_RESOURCES (sizeof(mca_standard_resources)/sizeof(struct resource))
|
#define MCA_STANDARD_RESOURCES ARRAY_SIZE(mca_standard_resources)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mca_read_and_store_pos - read the POS registers into a memory buffer
|
* mca_read_and_store_pos - read the POS registers into a memory buffer
|
||||||
|
|
|
@ -42,7 +42,7 @@ void mach_reboot_fixups(void)
|
||||||
struct pci_dev *dev;
|
struct pci_dev *dev;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i < (sizeof(fixups_table)/sizeof(fixups_table[0])); i++) {
|
for (i=0; i < ARRAY_SIZE(fixups_table); i++) {
|
||||||
cur = &(fixups_table[i]);
|
cur = &(fixups_table[i]);
|
||||||
dev = pci_get_device(cur->vendor, cur->device, NULL);
|
dev = pci_get_device(cur->vendor, cur->device, NULL);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
|
|
|
@ -612,7 +612,7 @@ static inline void __inquire_remote_apic(int apicid)
|
||||||
|
|
||||||
printk("Inquiring remote APIC #%d...\n", apicid);
|
printk("Inquiring remote APIC #%d...\n", apicid);
|
||||||
|
|
||||||
for (i = 0; i < sizeof(regs) / sizeof(*regs); i++) {
|
for (i = 0; i < ARRAY_SIZE(regs); i++) {
|
||||||
printk("... APIC #%d %s: ", apicid, names[i]);
|
printk("... APIC #%d %s: ", apicid, names[i]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue