The ARRAY_SIZE macro is convenient, yet mostly unused. Switch lots of code to use it. That makes the code more readable and also less error-prone.
I'd appreciate test builds. I see v3 as the future and occassional patches to v2 are only intended to keep v2 roughly up to date with v3 code changes.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: LinuxBIOSv2-array_size/src/southbridge/amd/cs5536/cs5536.c =================================================================== --- LinuxBIOSv2-array_size/src/southbridge/amd/cs5536/cs5536.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/southbridge/amd/cs5536/cs5536.c (Arbeitskopie) @@ -93,7 +93,7 @@ {FLASH_TYPE_NONE, 0, 0}, /* CS3, or Flash Device 3 */ };
-#define FlashInitTableLen (sizeof(FlashInitTable)/sizeof(FlashInitTable[0])) +#define FlashInitTableLen (ARRAY_SIZE(FlashInitTable))
uint32_t FlashPort[] = { MDD_LBAR_FLSH0, Index: LinuxBIOSv2-array_size/src/southbridge/amd/amd8111/amd8111_lpc.c =================================================================== --- LinuxBIOSv2-array_size/src/southbridge/amd/amd8111/amd8111_lpc.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/southbridge/amd/amd8111/amd8111_lpc.c (Arbeitskopie) @@ -77,7 +77,7 @@ ioapicregvalues[0].value_high = bsp_apicid<<(56-32); printk_debug("amd8111: ioapic bsp_apicid = %02x\n", bsp_apicid); - for (i = 0; i < sizeof(ioapicregvalues) / sizeof(ioapicregvalues[0]); + for (i = 0; i < ARRAY_SIZE(ioapicregvalues); i++, a++) { l[0] = (a->reg * 2) + 0x10; l[4] = a->value_low; Index: LinuxBIOSv2-array_size/src/southbridge/nvidia/ck804/ck804_early_setup.c =================================================================== --- LinuxBIOSv2-array_size/src/southbridge/nvidia/ck804/ck804_early_setup.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/southbridge/nvidia/ck804/ck804_early_setup.c (Arbeitskopie) @@ -102,7 +102,7 @@ #endif }; - setup_resource_map(ctrl_devport_conf, sizeof(ctrl_devport_conf)/sizeof(ctrl_devport_conf[0])); + setup_resource_map(ctrl_devport_conf, ARRAY_SIZE(ctrl_devport_conf));
}
@@ -121,7 +121,7 @@ #endif }; - setup_resource_map(ctrl_devport_conf_clear, sizeof(ctrl_devport_conf_clear)/sizeof(ctrl_devport_conf_clear[0])); + setup_resource_map(ctrl_devport_conf_clear, ARRAY_SIZE(ctrl_devport_conf_clear));
}
@@ -324,7 +324,7 @@
- setup_resource_map_x(ctrl_conf, sizeof(ctrl_conf)/sizeof(ctrl_conf[0])); + setup_resource_map_x(ctrl_conf, ARRAY_SIZE(ctrl_conf));
setup_ss_table(ANACTRL_IO_BASE+0x40, ANACTRL_IO_BASE+0x44, ANACTRL_IO_BASE+0x48, pcie_ss_tbl, 64); setup_ss_table(ANACTRL_IO_BASE+0xb0, ANACTRL_IO_BASE+0xb4, ANACTRL_IO_BASE+0xb8, sata_ss_tbl, 64); Index: LinuxBIOSv2-array_size/src/southbridge/nvidia/ck804/ck804_lpc.c =================================================================== --- LinuxBIOSv2-array_size/src/southbridge/nvidia/ck804/ck804_lpc.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/southbridge/nvidia/ck804/ck804_lpc.c (Arbeitskopie) @@ -82,7 +82,7 @@
l = (unsigned long *) ioapic_base;
- for (i = 0; i < sizeof(ioapicregvalues) / sizeof(ioapicregvalues[0]); + for (i = 0; i < ARRAY_SIZE(ioapicregvalues); i++, a++) { l[0] = (a->reg * 2) + 0x10; l[4] = a->value_low; Index: LinuxBIOSv2-array_size/src/southbridge/nvidia/ck804/ck804_early_setup_car.c =================================================================== --- LinuxBIOSv2-array_size/src/southbridge/nvidia/ck804/ck804_early_setup_car.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/southbridge/nvidia/ck804/ck804_early_setup_car.c (Arbeitskopie) @@ -105,12 +105,12 @@ for(j = 0; j < ck804_num; j++ ) { if(busn[j]==0) { //sb chain setup_resource_map_offset(ctrl_devport_conf, - sizeof(ctrl_devport_conf)/sizeof(ctrl_devport_conf[0]), + ARRAY_SIZE(ctrl_devport_conf), PCI_DEV(busn[j], 0, 0) , io_base[j]); continue; } setup_resource_map_offset(ctrl_devport_conf_b, - sizeof(ctrl_devport_conf_b)/sizeof(ctrl_devport_conf_b[0]), + ARRAY_SIZE(ctrl_devport_conf_b), PCI_DEV(busn[j], 0, 0) , io_base[j]); } } @@ -132,12 +132,12 @@ for(j = 0; j < ck804_num; j++ ) { if(busn[j]==0) { //sb chain setup_resource_map_offset(ctrl_devport_conf_clear, - sizeof(ctrl_devport_conf_clear)/sizeof(ctrl_devport_conf_clear[0]), + ARRAY_SIZE(ctrl_devport_conf_clear), PCI_DEV(busn[j], 0, 0) , io_base[j]); continue; } setup_resource_map_offset(ctrl_devport_conf_clear_b, - sizeof(ctrl_devport_conf_clear_b)/sizeof(ctrl_devport_conf_clear_b[0]), + ARRAY_SIZE(ctrl_devport_conf_clear_b), PCI_DEV(busn[j], 0, 0) , io_base[j]); }
@@ -327,13 +327,13 @@
for(j=0; j<ck804_num; j++) { if(busn[j] == 0) { - setup_resource_map_x_offset(ctrl_conf_master, sizeof(ctrl_conf_master)/sizeof(ctrl_conf_master[0]), + setup_resource_map_x_offset(ctrl_conf_master, ARRAY_SIZE(ctrl_conf_master), PCI_DEV(busn[0],0,0), io_base[0]); continue; }
- setup_resource_map_x_offset(ctrl_conf_slave, sizeof(ctrl_conf_slave)/sizeof(ctrl_conf_slave[0]), + setup_resource_map_x_offset(ctrl_conf_slave, ARRAY_SIZE(ctrl_conf_slave), PCI_DEV(busn[j],0,0), io_base[j]); }
Index: LinuxBIOSv2-array_size/src/southbridge/nvidia/mcp55/mcp55_lpc.c =================================================================== --- LinuxBIOSv2-array_size/src/southbridge/nvidia/mcp55/mcp55_lpc.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/southbridge/nvidia/mcp55/mcp55_lpc.c (Arbeitskopie) @@ -106,7 +106,7 @@
l = (unsigned long *) ioapic_base;
- for (i = 0; i < sizeof(ioapicregvalues) / sizeof(ioapicregvalues[0]); + for (i = 0; i < ARRAY_SIZE(ioapicregvalues); i++, a++) { l[0] = (a->reg * 2) + 0x10; l[4] = a->value_low; Index: LinuxBIOSv2-array_size/src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c =================================================================== --- LinuxBIOSv2-array_size/src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/southbridge/nvidia/mcp55/mcp55_early_setup_car.c (Arbeitskopie) @@ -106,7 +106,7 @@ int j; for(j = 0; j < mcp55_num; j++ ) { setup_resource_map_offset(ctrl_devport_conf, - sizeof(ctrl_devport_conf)/sizeof(ctrl_devport_conf[0]), + ARRAY_SIZE(ctrl_devport_conf), PCI_DEV(busn[j], devn[j], 0) , io_base[j]); } } @@ -123,7 +123,7 @@ int j; for(j = 0; j < mcp55_num; j++ ) { setup_resource_map_offset(ctrl_devport_conf_clear, - sizeof(ctrl_devport_conf_clear)/sizeof(ctrl_devport_conf_clear[0]), + ARRAY_SIZE(ctrl_devport_conf_clear), PCI_DEV(busn[j], devn[j], 0) , io_base[j]); }
@@ -327,23 +327,23 @@ for(j=0; j<mcp55_num; j++) { mcp55_early_pcie_setup(busn[j], devn[j], io_base[j] + ANACTRL_IO_BASE, pci_e_x[j]);
- setup_resource_map_x_offset(ctrl_conf_1, sizeof(ctrl_conf_1)/sizeof(ctrl_conf_1[0]), + setup_resource_map_x_offset(ctrl_conf_1, ARRAY_SIZE(ctrl_conf_1), PCI_DEV(busn[j], devn[j], 0), io_base[j]); for(i=0; i<3; i++) { // three SATA - setup_resource_map_x_offset(ctrl_conf_1_1, sizeof(ctrl_conf_1_1)/sizeof(ctrl_conf_1_1[0]), + setup_resource_map_x_offset(ctrl_conf_1_1, ARRAY_SIZE(ctrl_conf_1_1), PCI_DEV(busn[j], devn[j], i), io_base[j]); } if(busn[j] == 0) { - setup_resource_map_x_offset(ctrl_conf_mcp55_only, sizeof(ctrl_conf_mcp55_only)/sizeof(ctrl_conf_mcp55_only[0]), + setup_resource_map_x_offset(ctrl_conf_mcp55_only, ARRAY_SIZE(ctrl_conf_mcp55_only), PCI_DEV(busn[j], devn[j], 0), io_base[j]); }
if( (busn[j] == 0) && (mcp55_num>1) ) { - setup_resource_map_x_offset(ctrl_conf_master_only, sizeof(ctrl_conf_master_only)/sizeof(ctrl_conf_master_only[0]), + setup_resource_map_x_offset(ctrl_conf_master_only, ARRAY_SIZE(ctrl_conf_master_only), PCI_DEV(busn[j], devn[j], 0), io_base[j]); }
- setup_resource_map_x_offset(ctrl_conf_2, sizeof(ctrl_conf_2)/sizeof(ctrl_conf_2[0]), + setup_resource_map_x_offset(ctrl_conf_2, ARRAY_SIZE(ctrl_conf_2), PCI_DEV(busn[j], devn[j], 0), io_base[j]);
} Index: LinuxBIOSv2-array_size/src/southbridge/sis/sis966/sis966_lpc.c =================================================================== --- LinuxBIOSv2-array_size/src/southbridge/sis/sis966/sis966_lpc.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/southbridge/sis/sis966/sis966_lpc.c (Arbeitskopie) @@ -102,7 +102,7 @@
l = (unsigned long *) ioapic_base;
- for (i = 0; i < sizeof(ioapicregvalues) / sizeof(ioapicregvalues[0]); + for (i = 0; i < ARRAY_SIZE(ioapicregvalues); i++, a++) { l[0] = (a->reg * 2) + 0x10; l[4] = a->value_low; Index: LinuxBIOSv2-array_size/src/superio/via/vt1211/vt1211.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/via/vt1211/vt1211.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/via/vt1211/vt1211.c (Arbeitskopie) @@ -212,7 +212,7 @@ printk_debug("vt1211 enabling PNP devices.\n"); pnp_enable_devices(dev, &ops, - sizeof(pnp_dev_info) / sizeof(pnp_dev_info[0]), + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
Index: LinuxBIOSv2-array_size/src/superio/winbond/w83627thf/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/winbond/w83627thf/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/winbond/w83627thf/superio.c (Arbeitskopie) @@ -101,7 +101,7 @@ static void enable_dev(device_t dev) { pnp_enable_devices(dev, &ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_winbond_w83627thf_ops = { Index: LinuxBIOSv2-array_size/src/superio/winbond/w83977tf/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/winbond/w83977tf/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/winbond/w83977tf/superio.c (Arbeitskopie) @@ -105,7 +105,7 @@ static void enable_dev(device_t dev) { pnp_enable_devices(dev, &ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_winbond_w83977tf_ops = { Index: LinuxBIOSv2-array_size/src/superio/winbond/w83627ehg/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/winbond/w83627ehg/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/winbond/w83627ehg/superio.c (Arbeitskopie) @@ -93,7 +93,7 @@ 0x48, 0x7f, 0x2a, /* Set SMBus base to 0x54 >> 1. */ };
- for(i = 0; i < sizeof(hwm_reg_values)/sizeof(hwm_reg_values[0]); i += 3) { + for(i = 0; i < ARRAY_SIZE(hwm_reg_values); i += 3) { reg = hwm_reg_values[i]; value = pnp_read_index(base, reg); value &= 0xff & (~(hwm_reg_values[i + 1])); @@ -200,7 +200,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_winbond_w83627ehg_ops = { Index: LinuxBIOSv2-array_size/src/superio/winbond/w83627hf/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/winbond/w83627hf/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/winbond/w83627hf/superio.c (Arbeitskopie) @@ -83,7 +83,7 @@
};
- for(i = 0; i< sizeof(hwm_reg_values)/sizeof(hwm_reg_values[0]); i+=3 ) { + for(i = 0; i< ARRAY_SIZE(hwm_reg_values); i+=3 ) { reg = hwm_reg_values[i]; value = pnp_read_index(base, reg); value &= 0xff & hwm_reg_values[i+1]; @@ -189,7 +189,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_winbond_w83627hf_ops = { Index: LinuxBIOSv2-array_size/src/superio/winbond/w83977f/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/winbond/w83977f/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/winbond/w83977f/superio.c (Arbeitskopie) @@ -109,7 +109,7 @@ static void enable_dev(device_t dev) { pnp_enable_devices(dev, &ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_winbond_w83977f_ops = { Index: LinuxBIOSv2-array_size/src/superio/ite/it8712f/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/ite/it8712f/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/ite/it8712f/superio.c (Arbeitskopie) @@ -133,7 +133,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_ite_it8712f_ops = { Index: LinuxBIOSv2-array_size/src/superio/ite/it8705f/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/ite/it8705f/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/ite/it8705f/superio.c (Arbeitskopie) @@ -80,7 +80,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_ite_it8705f_ops = { Index: LinuxBIOSv2-array_size/src/superio/ite/it8661f/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/ite/it8661f/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/ite/it8661f/superio.c (Arbeitskopie) @@ -72,7 +72,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_ite_it8661f_ops = { Index: LinuxBIOSv2-array_size/src/superio/ite/it8671f/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/ite/it8671f/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/ite/it8671f/superio.c (Arbeitskopie) @@ -77,7 +77,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_ite_it8671f_ops = { Index: LinuxBIOSv2-array_size/src/superio/ite/it8716f/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/ite/it8716f/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/ite/it8716f/superio.c (Arbeitskopie) @@ -165,7 +165,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &ops, - sizeof(pnp_dev_info) / sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_ite_it8716f_ops = { Index: LinuxBIOSv2-array_size/src/superio/ite/it8673f/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/ite/it8673f/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/ite/it8673f/superio.c (Arbeitskopie) @@ -79,7 +79,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_ite_it8673f_ops = { Index: LinuxBIOSv2-array_size/src/superio/ite/it8718f/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/ite/it8718f/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/ite/it8718f/superio.c (Arbeitskopie) @@ -81,7 +81,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_ite_it8718f_ops = { Index: LinuxBIOSv2-array_size/src/superio/nsc/pc87366/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/nsc/pc87366/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/nsc/pc87366/superio.c (Arbeitskopie) @@ -67,7 +67,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_nsc_pc87366_ops = { Index: LinuxBIOSv2-array_size/src/superio/nsc/pc8374/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/nsc/pc8374/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/nsc/pc8374/superio.c (Arbeitskopie) @@ -64,7 +64,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_nsc_pc8374_ops = { Index: LinuxBIOSv2-array_size/src/superio/nsc/pc87351/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/nsc/pc87351/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/nsc/pc87351/superio.c (Arbeitskopie) @@ -71,7 +71,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_nsc_pc87351_ops = { Index: LinuxBIOSv2-array_size/src/superio/nsc/pc87360/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/nsc/pc87360/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/nsc/pc87360/superio.c (Arbeitskopie) @@ -67,7 +67,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_nsc_pc87360_ops = { Index: LinuxBIOSv2-array_size/src/superio/nsc/pc97307/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/nsc/pc97307/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/nsc/pc97307/superio.c (Arbeitskopie) @@ -79,7 +79,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_nsc_pc97307_ops = { Index: LinuxBIOSv2-array_size/src/superio/nsc/pc87309/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/nsc/pc87309/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/nsc/pc87309/superio.c (Arbeitskopie) @@ -73,7 +73,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info) / sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_nsc_pc87309_ops = { Index: LinuxBIOSv2-array_size/src/superio/nsc/pc87417/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/nsc/pc87417/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/nsc/pc87417/superio.c (Arbeitskopie) @@ -68,7 +68,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_nsc_pc87417_ops = { Index: LinuxBIOSv2-array_size/src/superio/nsc/pc97317/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/nsc/pc97317/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/nsc/pc97317/superio.c (Arbeitskopie) @@ -81,7 +81,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_nsc_pc97317_ops = { Index: LinuxBIOSv2-array_size/src/superio/nsc/pc87427/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/nsc/pc87427/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/nsc/pc87427/superio.c (Arbeitskopie) @@ -68,7 +68,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_nsc_pc87427_ops = { Index: LinuxBIOSv2-array_size/src/superio/smsc/lpc47m10x/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/smsc/lpc47m10x/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/smsc/lpc47m10x/superio.c (Arbeitskopie) @@ -82,7 +82,7 @@ static void enable_dev(device_t dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
Index: LinuxBIOSv2-array_size/src/superio/smsc/fdc37m60x/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/smsc/fdc37m60x/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/smsc/fdc37m60x/superio.c (Arbeitskopie) @@ -77,7 +77,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_smsc_fdc37m60x_ops = { Index: LinuxBIOSv2-array_size/src/superio/smsc/lpc47n217/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/smsc/lpc47n217/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/smsc/lpc47n217/superio.c (Arbeitskopie) @@ -86,7 +86,7 @@ static void enable_dev(device_t dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
Index: LinuxBIOSv2-array_size/src/superio/smsc/lpc47b272/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/smsc/lpc47b272/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/smsc/lpc47b272/superio.c (Arbeitskopie) @@ -84,7 +84,7 @@ static void enable_dev(device_t dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
Index: LinuxBIOSv2-array_size/src/superio/smsc/lpc47b397/superio.c =================================================================== --- LinuxBIOSv2-array_size/src/superio/smsc/lpc47b397/superio.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/superio/smsc/lpc47b397/superio.c (Arbeitskopie) @@ -207,7 +207,7 @@ static void enable_dev(struct device *dev) { pnp_enable_devices(dev, &pnp_ops, - sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info); + ARRAY_SIZE(pnp_dev_info), pnp_dev_info); }
struct chip_operations superio_smsc_lpc47b397_ops = { Index: LinuxBIOSv2-array_size/src/cpu/amd/sc520/sc520.c =================================================================== --- LinuxBIOSv2-array_size/src/cpu/amd/sc520/sc520.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/cpu/amd/sc520/sc520.c (Arbeitskopie) @@ -151,7 +151,7 @@ // int i; int idx; #if 0 - for(rambits = 0, i = 0; i < sizeof(ramregs)/sizeof(ramregs[0]); i++) { + for(rambits = 0, i = 0; i < ARRAY_SIZE(ramregs); i++) { unsigned char reg; reg = pci_read_config8(mc_dev, ramregs[i]); /* these are ENDING addresses, not sizes. Index: LinuxBIOSv2-array_size/src/cpu/amd/model_10xxx/init_cpus.c =================================================================== --- LinuxBIOSv2-array_size/src/cpu/amd/model_10xxx/init_cpus.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/cpu/amd/model_10xxx/init_cpus.c (Arbeitskopie) @@ -522,7 +522,7 @@ printk_debug("setup_remote_node: %02x", node);
/* copy the default resource map from node 0 */ - for(i = 0; i < sizeof(pci_reg)/sizeof(pci_reg[0]); i++) { + for(i = 0; i < ARRAY_SIZE(pci_reg); i++) { u32 value; u16 reg; reg = pci_reg[i]; @@ -852,7 +852,7 @@ revision = mctGetLogicalCPUID(0xFF); platform = get_platform_type();
- for(i = 0; i < sizeof(fam10_msr_default)/sizeof(fam10_msr_default[0]); i++) { + for(i = 0; i < ARRAY_SIZE(fam10_msr_default); i++) { if ((fam10_msr_default[i].revision & revision) && (fam10_msr_default[i].platform & platform)) { msr = rdmsr(fam10_msr_default[i].msr); @@ -889,7 +889,7 @@
AMD_SetupPSIVID_d(platform, node); /* Set PSIVID offset which is not table driven */
- for(i = 0; i < sizeof(fam10_pci_default)/sizeof(fam10_pci_default[0]); i++) { + for(i = 0; i < ARRAY_SIZE(fam10_pci_default); i++) { if ((fam10_pci_default[i].revision & revision) && (fam10_pci_default[i].platform & platform)) { val = pci_read_config32(NODE_PCI(node, @@ -903,7 +903,7 @@ } }
- for(i = 0; i < sizeof(fam10_htphy_default)/sizeof(fam10_htphy_default[0]); i++) { + for(i = 0; i < ARRAY_SIZE(fam10_htphy_default); i++) { if ((fam10_htphy_default[i].revision & revision) && (fam10_htphy_default[i].platform & platform)) { /* HT Phy settings either apply to both sublinks or have Index: LinuxBIOSv2-array_size/src/cpu/emulation/qemu-x86/northbridge.c =================================================================== --- LinuxBIOSv2-array_size/src/cpu/emulation/qemu-x86/northbridge.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/cpu/emulation/qemu-x86/northbridge.c (Arbeitskopie) @@ -80,7 +80,7 @@ unsigned char rambits; int i, idx;
- for(rambits = 0, i = 0; i < sizeof(ramregs)/sizeof(ramregs[0]); i++) { + for(rambits = 0, i = 0; i < ARRAY_SIZE(ramregs); i++) { unsigned char reg; reg = pci_read_config8(mc_dev, ramregs[i]); /* these are ENDING addresses, not sizes. Index: LinuxBIOSv2-array_size/src/stream/fs/vfs.c =================================================================== --- LinuxBIOSv2-array_size/src/stream/fs/vfs.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/stream/fs/vfs.c (Arbeitskopie) @@ -70,7 +70,7 @@ { int i;
- for (i = 0; i < sizeof(fsys_table)/sizeof(fsys_table[0]); i++) { + for (i = 0; i < ARRAY_SIZE(fsys_table); i++) { if (fsys_table[i].mount_func()) { fsys = &fsys_table[i]; printk_info("Mounted %s\n", fsys->name); Index: LinuxBIOSv2-array_size/src/mainboard/iwill/dk8_htx/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/iwill/dk8_htx/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/iwill/dk8_htx/resourcemap.c (Arbeitskopie) @@ -258,7 +258,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/iwill/dk8_htx/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/iwill/dk8_htx/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/iwill/dk8_htx/get_bus_conf.c (Arbeitskopie) @@ -90,7 +90,7 @@ m = sysconf.mb;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/iwill/dk8s2/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/iwill/dk8s2/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/iwill/dk8s2/auto.c (Arbeitskopie) @@ -149,7 +149,7 @@ #endif
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
#if 0 dump_pci_devices(); Index: LinuxBIOSv2-array_size/src/mainboard/iwill/dk8x/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/iwill/dk8x/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/iwill/dk8x/auto.c (Arbeitskopie) @@ -148,7 +148,7 @@ #endif
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
#if 1 dump_pci_devices(); @@ -181,7 +181,7 @@ #endif }; int i; - for(i = 0; i < sizeof(check_addrs)/sizeof(check_addrs[0]); i++) { + for(i = 0; i < ARRAY_SIZE(check_addrs); i++) { ram_check(check_addrs[i].lo, check_addrs[i].hi); } #endif Index: LinuxBIOSv2-array_size/src/mainboard/broadcom/blast/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/broadcom/blast/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/broadcom/blast/resourcemap.c (Arbeitskopie) @@ -259,7 +259,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/broadcom/blast/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/broadcom/blast/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/broadcom/blast/get_bus_conf.c (Arbeitskopie) @@ -61,7 +61,7 @@
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dai_g/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dai_g/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dai_g/auto.c (Arbeitskopie) @@ -113,7 +113,7 @@ } #endif disable_watchdogs(); - sdram_initialize(sizeof(mch)/sizeof(mch[0]), mch); + sdram_initialize(ARRAY_SIZE(mch), mch); #if 1 dump_pci_device(PCI_DEV(0, 0x00, 0)); // dump_bar14(PCI_DEV(0, 0x00, 0)); Index: LinuxBIOSv2-array_size/src/mainboard/supermicro/h8dmr/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/supermicro/h8dmr/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/supermicro/h8dmr/resourcemap.c (Arbeitskopie) @@ -277,7 +277,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/supermicro/h8dmr/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/supermicro/h8dmr/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/supermicro/h8dmr/get_bus_conf.c (Arbeitskopie) @@ -81,7 +81,7 @@
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhe_g/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhe_g/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhe_g/auto.c (Arbeitskopie) @@ -138,7 +138,7 @@ // dump_ipmi_registers(); // mainboard_set_e7520_leds(); // memreset_setup(); - sdram_initialize(sizeof(mch)/sizeof(mch[0]), mch); + sdram_initialize(ARRAY_SIZE(mch), mch); #if 0 dump_pci_devices(); #endif Index: LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhe_g2/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhe_g2/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhe_g2/auto.c (Arbeitskopie) @@ -139,7 +139,7 @@ // dump_ipmi_registers(); // mainboard_set_e7520_leds(); // memreset_setup(); - sdram_initialize(sizeof(mch)/sizeof(mch[0]), mch); + sdram_initialize(ARRAY_SIZE(mch), mch); #if 0 dump_pci_devices(); #endif Index: LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhe_g2/auto.updated.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhe_g2/auto.updated.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhe_g2/auto.updated.c (Arbeitskopie) @@ -139,7 +139,7 @@ // dump_ipmi_registers(); // mainboard_set_e7520_leds(); // memreset_setup(); - sdram_initialize(sizeof(mch)/sizeof(mch[0]), mch); + sdram_initialize(ARRAY_SIZE(mch), mch); #if 0 dump_pci_devices(); #endif Index: LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhr_ig/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhr_ig/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhr_ig/auto.c (Arbeitskopie) @@ -139,7 +139,7 @@ // dump_ipmi_registers(); mainboard_set_e7520_leds(); // memreset_setup(); - sdram_initialize(sizeof(mch)/sizeof(mch[0]), mch); + sdram_initialize(ARRAY_SIZE(mch), mch); #if 1 dump_pci_devices(); #endif Index: LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhr_ig2/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhr_ig2/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/supermicro/x6dhr_ig2/auto.c (Arbeitskopie) @@ -139,7 +139,7 @@ // dump_ipmi_registers(); mainboard_set_e7520_leds(); // memreset_setup(); - sdram_initialize(sizeof(mch)/sizeof(mch[0]), mch); + sdram_initialize(ARRAY_SIZE(mch), mch); #if 0 dump_pci_devices(); #endif Index: LinuxBIOSv2-array_size/src/mainboard/a-trend/atc-6220/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/a-trend/atc-6220/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/a-trend/atc-6220/auto.c (Arbeitskopie) @@ -67,6 +67,6 @@ report_bist_failure(bist); enable_smbus(); /* dump_spd_registers(&memctrl[0]); */ - sdram_initialize(sizeof(memctrl) / sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl); /* ram_check(0, 640 * 1024); */ } Index: LinuxBIOSv2-array_size/src/mainboard/gigabyte/m57sli/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/gigabyte/m57sli/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/gigabyte/m57sli/resourcemap.c (Arbeitskopie) @@ -277,7 +277,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/gigabyte/m57sli/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/gigabyte/m57sli/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/gigabyte/m57sli/get_bus_conf.c (Arbeitskopie) @@ -80,7 +80,7 @@
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/gigabyte/ga_2761gxdk/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/gigabyte/ga_2761gxdk/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/gigabyte/ga_2761gxdk/resourcemap.c (Arbeitskopie) @@ -277,7 +277,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/gigabyte/ga_2761gxdk/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/gigabyte/ga_2761gxdk/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/gigabyte/ga_2761gxdk/get_bus_conf.c (Arbeitskopie) @@ -82,7 +82,7 @@
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/gigabyte/ga-6bxc/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/gigabyte/ga-6bxc/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/gigabyte/ga-6bxc/auto.c (Arbeitskopie) @@ -67,6 +67,6 @@ report_bist_failure(bist); enable_smbus(); /* dump_spd_registers(&memctrl[0]); */ - sdram_initialize(sizeof(memctrl) / sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl); /* ram_check(0, 640 * 1024); */ } Index: LinuxBIOSv2-array_size/src/mainboard/digitallogic/adl855pc/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/digitallogic/adl855pc/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/digitallogic/adl855pc/auto.c (Arbeitskopie) @@ -100,7 +100,7 @@
memreset_setup();
- sdram_initialize(sizeof(memctrl)/sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl);
} #if 0 Index: LinuxBIOSv2-array_size/src/mainboard/amd/serengeti_cheetah/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/amd/serengeti_cheetah/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/amd/serengeti_cheetah/resourcemap.c (Arbeitskopie) @@ -258,7 +258,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/amd/serengeti_cheetah/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/amd/serengeti_cheetah/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/amd/serengeti_cheetah/get_bus_conf.c (Arbeitskopie) @@ -90,7 +90,7 @@ m = sysconf.mb;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/amd/serengeti_cheetah_fam10/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/amd/serengeti_cheetah_fam10/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/amd/serengeti_cheetah_fam10/resourcemap.c (Arbeitskopie) @@ -275,7 +275,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/amd/serengeti_cheetah_fam10/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/amd/serengeti_cheetah_fam10/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/amd/serengeti_cheetah_fam10/get_bus_conf.c (Arbeitskopie) @@ -111,7 +111,7 @@ m->bus_type[i] = 0; }
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/biostar/m6tba/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/biostar/m6tba/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/biostar/m6tba/auto.c (Arbeitskopie) @@ -67,6 +67,6 @@ report_bist_failure(bist); enable_smbus(); /* dump_spd_registers(&memctrl[0]); */ - sdram_initialize(sizeof(memctrl) / sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl); /* ram_check(0, 640 * 1024); */ } Index: LinuxBIOSv2-array_size/src/mainboard/azza/pt-6ibd/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/azza/pt-6ibd/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/azza/pt-6ibd/auto.c (Arbeitskopie) @@ -70,6 +70,6 @@ report_bist_failure(bist); enable_smbus(); /* dump_spd_registers(&memctrl[0]); */ - sdram_initialize(sizeof(memctrl) / sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl); /* ram_check(0, 640 * 1024); */ } Index: LinuxBIOSv2-array_size/src/mainboard/artecgroup/dbe61/cache_as_ram_auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/artecgroup/dbe61/cache_as_ram_auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/artecgroup/dbe61/cache_as_ram_auto.c (Arbeitskopie) @@ -51,7 +51,7 @@ int i;
if (device == DIMM0){ - for (i=0; i < (sizeof spd_table/sizeof spd_table[0]); i++){ + for (i=0; i < (ARRAY_SIZE(spd_table)); i++){ if (spd_table[i].address == address){ return spd_table[i].data; } Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2912/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2912/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2912/resourcemap.c (Arbeitskopie) @@ -277,7 +277,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2912/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2912/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2912/get_bus_conf.c (Arbeitskopie) @@ -107,7 +107,7 @@ m = sysconf.mb; memset(m, 0, sizeof(struct mb_sysconf_t));
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2850/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2850/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2850/auto.c (Arbeitskopie) @@ -197,6 +197,6 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu) / sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
} Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2850/cache_as_ram_auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2850/cache_as_ram_auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2850/cache_as_ram_auto.c (Arbeitskopie) @@ -206,7 +206,7 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram(); } Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2735/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2735/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2735/auto.c (Arbeitskopie) @@ -96,7 +96,7 @@ #endif
memreset_setup(); - sdram_initialize(sizeof(memctrl)/sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl); } #if 0 else { Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2880/cache_as_ram_auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2880/cache_as_ram_auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2880/cache_as_ram_auto.c (Arbeitskopie) @@ -205,7 +205,7 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram(); } Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s1846/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s1846/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s1846/auto.c (Arbeitskopie) @@ -67,6 +67,6 @@ report_bist_failure(bist); enable_smbus(); /* dump_spd_registers(&memctrl[0]); */ - sdram_initialize(sizeof(memctrl) / sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl); /* ram_check(0, 640 * 1024); */ } Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2881/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2881/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2881/resourcemap.c (Arbeitskopie) @@ -258,7 +258,7 @@ PCI_ADDR(0, 0x18, 1, 0xEC), 0x0000FC88, 0x00000000, }; int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2881/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2881/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2881/auto.c (Arbeitskopie) @@ -172,6 +172,6 @@ enable_smbus(); memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
} Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2881/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2881/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2881/get_bus_conf.c (Arbeitskopie) @@ -63,7 +63,7 @@
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2882/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2882/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2882/auto.c (Arbeitskopie) @@ -176,6 +176,6 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
} Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2882/cache_as_ram_auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2882/cache_as_ram_auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2882/cache_as_ram_auto.c (Arbeitskopie) @@ -208,7 +208,7 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram();
Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2891/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2891/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2891/resourcemap.c (Arbeitskopie) @@ -267,7 +267,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2891/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2891/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2891/auto.c (Arbeitskopie) @@ -148,6 +148,6 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
} Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2891/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2891/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2891/get_bus_conf.c (Arbeitskopie) @@ -71,7 +71,7 @@
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s4880/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s4880/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s4880/resourcemap.c (Arbeitskopie) @@ -258,7 +258,7 @@ PCI_ADDR(0, 0x18, 1, 0xEC), 0x0000FC88, 0x00000000, }; int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s4880/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s4880/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s4880/auto.c (Arbeitskopie) @@ -227,6 +227,6 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
} Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s4880/cache_as_ram_auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s4880/cache_as_ram_auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s4880/cache_as_ram_auto.c (Arbeitskopie) @@ -254,7 +254,7 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram(); } Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2892/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2892/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2892/resourcemap.c (Arbeitskopie) @@ -267,7 +267,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2892/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2892/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2892/auto.c (Arbeitskopie) @@ -149,6 +149,6 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
} Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2892/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2892/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2892/get_bus_conf.c (Arbeitskopie) @@ -68,7 +68,7 @@
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2875/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2875/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2875/auto.c (Arbeitskopie) @@ -167,6 +167,6 @@
enable_smbus(); memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
} Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2875/cache_as_ram_auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2875/cache_as_ram_auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2875/cache_as_ram_auto.c (Arbeitskopie) @@ -203,7 +203,7 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram();
Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s4882/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s4882/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s4882/resourcemap.c (Arbeitskopie) @@ -258,7 +258,7 @@ PCI_ADDR(0, 0x18, 1, 0xEC), 0x0000FC88, 0x00000000, }; int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s4882/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s4882/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s4882/auto.c (Arbeitskopie) @@ -227,6 +227,6 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu); } Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2885/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2885/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2885/resourcemap.c (Arbeitskopie) @@ -259,7 +259,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2885/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2885/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2885/auto.c (Arbeitskopie) @@ -178,7 +178,7 @@
enable_smbus(); memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2885/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2885/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2885/get_bus_conf.c (Arbeitskopie) @@ -65,7 +65,7 @@
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2895/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2895/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2895/resourcemap.c (Arbeitskopie) @@ -261,7 +261,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2895/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2895/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2895/auto.c (Arbeitskopie) @@ -190,7 +190,7 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
} Index: LinuxBIOSv2-array_size/src/mainboard/tyan/s2895/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/tyan/s2895/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/tyan/s2895/get_bus_conf.c (Arbeitskopie) @@ -76,7 +76,7 @@
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/via/epia-m/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/via/epia-m/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/via/epia-m/auto.c (Arbeitskopie) @@ -146,7 +146,7 @@ #endif }; int i; - for(i = 0; i < sizeof(check_addrs)/sizeof(check_addrs[0]); i++) { + for(i = 0; i < ARRAY_SIZE(check_addrs); i++) { ram_check(check_addrs[i].lo, check_addrs[i].hi); } #endif Index: LinuxBIOSv2-array_size/src/mainboard/via/epia/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/via/epia/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/via/epia/auto.c (Arbeitskopie) @@ -107,7 +107,7 @@
/* this is way more generic than we need. - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu); */ sdram_set_registers((const struct mem_controller *) 0); sdram_set_spd_registers((const struct mem_controller *) 0); @@ -129,7 +129,7 @@ #endif }; int i; - for(i = 0; i < sizeof(check_addrs)/sizeof(check_addrs[0]); i++) { + for(i = 0; i < ARRAY_SIZE(check_addrs); i++) { ram_check(check_addrs[i].lo, check_addrs[i].hi); } #endif Index: LinuxBIOSv2-array_size/src/mainboard/compaq/deskpro_en_sff_p600/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/compaq/deskpro_en_sff_p600/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/compaq/deskpro_en_sff_p600/auto.c (Arbeitskopie) @@ -70,6 +70,6 @@ report_bist_failure(bist); enable_smbus(); /* dump_spd_registers(&memctrl[0]); */ - sdram_initialize(sizeof(memctrl) / sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl); /* ram_check(0, 640 * 1024); */ } Index: LinuxBIOSv2-array_size/src/mainboard/dell/s1850/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/dell/s1850/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/dell/s1850/auto.c (Arbeitskopie) @@ -139,7 +139,7 @@ // dump_ipmi_registers(); mainboard_set_e7520_leds(); // memreset_setup(); - sdram_initialize(sizeof(mch)/sizeof(mch[0]), mch); + sdram_initialize(ARRAY_SIZE(mch), mch); #if 0 dump_pci_devices(); #endif Index: LinuxBIOSv2-array_size/src/mainboard/msi/ms7135/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/msi/ms7135/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/msi/ms7135/get_bus_conf.c (Arbeitskopie) @@ -67,8 +67,8 @@
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x) / sizeof(pci1234x[0]); - sysconf.hc_possible_num = sizeof(pci1234x) / sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for (i = 0; i < sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/msi/ms9282/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/msi/ms9282/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/msi/ms9282/resourcemap.c (Arbeitskopie) @@ -293,7 +293,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/msi/ms9282/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/msi/ms9282/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/msi/ms9282/get_bus_conf.c (Arbeitskopie) @@ -110,7 +110,7 @@ m = sysconf.mb; memset(m, 0, sizeof(struct mb_sysconf_t));
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/msi/ms6178/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/msi/ms6178/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/msi/ms6178/auto.c (Arbeitskopie) @@ -65,6 +65,6 @@ console_init(); report_bist_failure(bist); /* dump_spd_registers(&memctrl[0]); */ - sdram_initialize(sizeof(memctrl) / sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl); /* ram_check(0, 640 * 1024); */ } Index: LinuxBIOSv2-array_size/src/mainboard/msi/ms9185/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/msi/ms9185/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/msi/ms9185/resourcemap.c (Arbeitskopie) @@ -285,7 +285,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/msi/ms9185/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/msi/ms9185/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/msi/ms9185/get_bus_conf.c (Arbeitskopie) @@ -82,7 +82,7 @@
m = sysconf.mb;
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; Index: LinuxBIOSv2-array_size/src/mainboard/msi/ms7260/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/msi/ms7260/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/msi/ms7260/resourcemap.c (Arbeitskopie) @@ -278,6 +278,6 @@
};
- int max = sizeof(register_values) / sizeof(register_values[0]); + int max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); } Index: LinuxBIOSv2-array_size/src/mainboard/msi/ms7260/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/msi/ms7260/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/msi/ms7260/get_bus_conf.c (Arbeitskopie) @@ -81,7 +81,7 @@
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x) / sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for (i = 0; i < sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/arima/hdama/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/arima/hdama/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/arima/hdama/auto.c (Arbeitskopie) @@ -157,11 +157,11 @@ #endif enable_smbus(); #if 0 - dump_spd_registers(sizeof(cpu)/sizeof(cpu[0]), cpu); + dump_spd_registers(ARRAY_SIZE(cpu), cpu); #endif
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu); #if 0 dump_pci_devices(); Index: LinuxBIOSv2-array_size/src/mainboard/arima/hdama/cache_as_ram_auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/arima/hdama/cache_as_ram_auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/arima/hdama/cache_as_ram_auto.c (Arbeitskopie) @@ -215,7 +215,7 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram();
Index: LinuxBIOSv2-array_size/src/mainboard/sunw/ultra40/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/sunw/ultra40/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/sunw/ultra40/resourcemap.c (Arbeitskopie) @@ -260,7 +260,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/sunw/ultra40/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/sunw/ultra40/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/sunw/ultra40/auto.c (Arbeitskopie) @@ -191,7 +191,7 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
} Index: LinuxBIOSv2-array_size/src/mainboard/sunw/ultra40/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/sunw/ultra40/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/sunw/ultra40/get_bus_conf.c (Arbeitskopie) @@ -75,7 +75,7 @@
get_bus_conf_done = 1;
- hc_possible_num = sizeof(pci1234)/sizeof(pci1234[0]); + hc_possible_num = ARRAY_SIZE(pci1234); get_sblk_pci1234(); Index: LinuxBIOSv2-array_size/src/mainboard/eaglelion/5bcm/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/eaglelion/5bcm/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/eaglelion/5bcm/auto.c (Arbeitskopie) @@ -48,7 +48,7 @@ #endif }; int i; - for(i = 0; i < sizeof(check_addrs)/sizeof(check_addrs[0]); i++) { + for(i = 0; i < ARRAY_SIZE(check_addrs); i++) { ram_check(check_addrs[i].lo, check_addrs[i].hi); } #endif Index: LinuxBIOSv2-array_size/src/mainboard/newisys/khepri/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/newisys/khepri/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/newisys/khepri/resourcemap.c (Arbeitskopie) @@ -265,7 +265,7 @@ PCI_ADDR(0, 0x18, 1, 0xEC), 0x0000FC88, 0x00000000, }; int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/newisys/khepri/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/newisys/khepri/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/newisys/khepri/auto.c (Arbeitskopie) @@ -138,7 +138,7 @@ dump_spd_registers(&cpu[0]); #endif memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
#if 0 dump_pci_devices(); Index: LinuxBIOSv2-array_size/src/mainboard/ibm/e326/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/ibm/e326/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/ibm/e326/resourcemap.c (Arbeitskopie) @@ -266,6 +266,6 @@ PCI_ADDR(0, 0x18, 1, 0xec), 0x0000FC88, 0, }; int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); } Index: LinuxBIOSv2-array_size/src/mainboard/ibm/e326/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/ibm/e326/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/ibm/e326/auto.c (Arbeitskopie) @@ -163,7 +163,7 @@ #endif
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
#if 0 dump_pci_devices(); Index: LinuxBIOSv2-array_size/src/mainboard/ibm/e326/cache_as_ram_auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/ibm/e326/cache_as_ram_auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/ibm/e326/cache_as_ram_auto.c (Arbeitskopie) @@ -211,7 +211,7 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram();
Index: LinuxBIOSv2-array_size/src/mainboard/ibm/e325/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/ibm/e325/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/ibm/e325/resourcemap.c (Arbeitskopie) @@ -266,6 +266,6 @@ PCI_ADDR(0, 0x18, 1, 0xec), 0x0000FC88, 0, }; int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); } Index: LinuxBIOSv2-array_size/src/mainboard/ibm/e325/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/ibm/e325/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/ibm/e325/auto.c (Arbeitskopie) @@ -163,7 +163,7 @@ #endif
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
#if 0 dump_pci_devices(); Index: LinuxBIOSv2-array_size/src/mainboard/ibm/e325/cache_as_ram_auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/ibm/e325/cache_as_ram_auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/ibm/e325/cache_as_ram_auto.c (Arbeitskopie) @@ -211,7 +211,7 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram();
Index: LinuxBIOSv2-array_size/src/mainboard/nvidia/l1_2pvv/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/nvidia/l1_2pvv/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/nvidia/l1_2pvv/resourcemap.c (Arbeitskopie) @@ -277,7 +277,7 @@ };
int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/nvidia/l1_2pvv/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/nvidia/l1_2pvv/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/nvidia/l1_2pvv/get_bus_conf.c (Arbeitskopie) @@ -108,7 +108,7 @@ m = sysconf.mb; memset(m, 0, sizeof(struct mb_sysconf_t));
- sysconf.hc_possible_num = sizeof(pci1234x)/sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for (i = 0; i < sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; Index: LinuxBIOSv2-array_size/src/mainboard/intel/xe7501devkit/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/intel/xe7501devkit/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/intel/xe7501devkit/auto.c (Arbeitskopie) @@ -83,7 +83,7 @@ // dump_smbus_registers();
// memreset_setup(); No-op for this chipset - sdram_initialize(sizeof(memctrl)/sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl); } // NOTE: ROMCC dies with an internal compiler error Index: LinuxBIOSv2-array_size/src/mainboard/intel/jarrell/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/intel/jarrell/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/intel/jarrell/auto.c (Arbeitskopie) @@ -120,7 +120,7 @@ power_down_reset_check(); // dump_ipmi_registers(); mainboard_set_e7520_leds(); - sdram_initialize(sizeof(mch)/sizeof(mch[0]), mch); + sdram_initialize(ARRAY_SIZE(mch), mch); ich5_watchdog_on(); #if 0 dump_pci_devices(); Index: LinuxBIOSv2-array_size/src/mainboard/asus/p2b/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/asus/p2b/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/asus/p2b/auto.c (Arbeitskopie) @@ -67,6 +67,6 @@ report_bist_failure(bist); enable_smbus(); /* dump_spd_registers(&memctrl[0]); */ - sdram_initialize(sizeof(memctrl) / sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl); /* ram_check(0, 640 * 1024); */ } Index: LinuxBIOSv2-array_size/src/mainboard/asus/p2b-f/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/asus/p2b-f/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/asus/p2b-f/auto.c (Arbeitskopie) @@ -70,6 +70,6 @@ report_bist_failure(bist); enable_smbus(); /* dump_spd_registers(&memctrl[0]); */ - sdram_initialize(sizeof(memctrl) / sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl); /* ram_check(0, 640 * 1024); */ } Index: LinuxBIOSv2-array_size/src/mainboard/asus/p3b-f/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/asus/p3b-f/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/asus/p3b-f/auto.c (Arbeitskopie) @@ -70,6 +70,6 @@ report_bist_failure(bist); enable_smbus(); /* dump_spd_registers(&memctrl[0]); */ - sdram_initialize(sizeof(memctrl) / sizeof(memctrl[0]), memctrl); + sdram_initialize(ARRAY_SIZE(memctrl), memctrl); /* ram_check(0, 640 * 1024); */ } Index: LinuxBIOSv2-array_size/src/mainboard/asus/mew-vm/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/asus/mew-vm/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/asus/mew-vm/auto.c (Arbeitskopie) @@ -77,7 +77,7 @@ /* dump_spd_registers(&memctrl[0]); */
/* sdram_initialize() runs out of registers. */ - /* sdram_initialize(sizeof(memctrl) / sizeof(memctrl[0]), memctrl); */ + /* sdram_initialize(ARRAY_SIZE(memctrl), memctrl); */
sdram_set_registers(memctrl); sdram_set_spd_registers(memctrl); Index: LinuxBIOSv2-array_size/src/mainboard/asus/a8n_e/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/asus/a8n_e/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/asus/a8n_e/get_bus_conf.c (Arbeitskopie) @@ -66,8 +66,8 @@
get_bus_conf_done = 1;
- sysconf.hc_possible_num = sizeof(pci1234x) / sizeof(pci1234x[0]); - sysconf.hc_possible_num = sizeof(pci1234x) / sizeof(pci1234x[0]); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); + sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); for (i = 0; i < sysconf.hc_possible_num; i++) { sysconf.pci1234[i] = pci1234x[i]; sysconf.hcdn[i] = hcdnx[i]; Index: LinuxBIOSv2-array_size/src/mainboard/agami/aruma/auto.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/agami/aruma/auto.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/agami/aruma/auto.c (Arbeitskopie) @@ -171,7 +171,7 @@ enable_smbus();
memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
#if 0 /* Check the first 1M */ Index: LinuxBIOSv2-array_size/src/mainboard/agami/aruma/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/agami/aruma/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/agami/aruma/resourcemap.c (Arbeitskopie) @@ -265,7 +265,7 @@
}; int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/mainboard/agami/aruma/get_bus_conf.c =================================================================== --- LinuxBIOSv2-array_size/src/mainboard/agami/aruma/get_bus_conf.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/mainboard/agami/aruma/get_bus_conf.c (Arbeitskopie) @@ -62,7 +62,7 @@
get_bus_conf_done = 1;
- hc_possible_num = sizeof(pci1234) / sizeof(pci1234[0]); + hc_possible_num = ARRAY_SIZE(pci1234);
get_sblk_pci1234();
Index: LinuxBIOSv2-array_size/src/northbridge/via/vt8601/northbridge.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/via/vt8601/northbridge.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/via/vt8601/northbridge.c (Arbeitskopie) @@ -115,7 +115,7 @@ unsigned char rambits; int i, idx;
- for(rambits = 0, i = 0; i < sizeof(ramregs)/sizeof(ramregs[0]); i++) { + for(rambits = 0, i = 0; i < ARRAY_SIZE(ramregs); i++) { unsigned char reg; reg = pci_read_config8(mc_dev, ramregs[i]); /* these are ENDING addresses, not sizes. Index: LinuxBIOSv2-array_size/src/northbridge/via/vt8623/northbridge.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/via/vt8623/northbridge.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/via/vt8623/northbridge.c (Arbeitskopie) @@ -287,7 +287,7 @@ unsigned char rambits; int i, idx;
- for(rambits = 0, i = 0; i < sizeof(ramregs)/sizeof(ramregs[0]); i++) { + for(rambits = 0, i = 0; i < ARRAY_SIZE(ramregs); i++) { unsigned char reg; reg = pci_read_config8(mc_dev, ramregs[i]); /* these are ENDING addresses, not sizes. Index: LinuxBIOSv2-array_size/src/northbridge/amd/gx2/chipsetinit.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/amd/gx2/chipsetinit.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/amd/gx2/chipsetinit.c (Arbeitskopie) @@ -177,7 +177,7 @@ { FLASH_TYPE_NONE, 0, 0 }, /* CS3, or Flash Device 3 */ };
-#define FlashInitTableLen (sizeof(FlashInitTable)/sizeof(FlashInitTable[0])) +#define FlashInitTableLen (ARRAY_SIZE(FlashInitTable))
uint32_t FlashPort[] = { MDD_LBAR_FLSH0, Index: LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/coherent_ht.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/coherent_ht.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/coherent_ht.c (Arbeitskopie) @@ -510,7 +510,7 @@ print_spew("setup_remote_node: ");
/* copy the default resource map from node 0 */ - for(i = 0; i < sizeof(pci_reg)/sizeof(pci_reg[0]); i++) { + for(i = 0; i < ARRAY_SIZE(pci_reg); i++) { uint32_t value; uint8_t reg; reg = pci_reg[i]; @@ -802,7 +802,7 @@ }; #endif
- setup_row_indirect_group(conn4_1, sizeof(conn4_1)/sizeof(conn4_1[0])); + setup_row_indirect_group(conn4_1, ARRAY_SIZE(conn4_1));
setup_temp_row(0,2); verify_connection(7); @@ -893,7 +893,7 @@ 3,0,1,1, }; #endif - setup_remote_row_indirect_group(conn4_3, sizeof(conn4_3)/sizeof(conn4_3[0])); + setup_remote_row_indirect_group(conn4_3, ARRAY_SIZE(conn4_3));
/* ready to enable RT for Node 3 */ rename_temp_node(3); @@ -909,7 +909,7 @@ 2,1,0,1, }; #endif - setup_row_indirect_group(conn4_2, sizeof(conn4_2)/sizeof(conn4_2[0])); + setup_row_indirect_group(conn4_2, ARRAY_SIZE(conn4_2));
#if 0 /*We need to do sth to reverse work for setup_temp_row (0,1) (1,3) */ @@ -974,7 +974,7 @@ #endif };
- setup_row_indirect_group(conn6_1, sizeof(conn6_1)/sizeof(conn6_1[0])); + setup_row_indirect_group(conn6_1, ARRAY_SIZE(conn6_1)); for(byte=0; byte<4; byte+=2) { setup_temp_row(byte,byte+2); @@ -998,7 +998,7 @@ #endif }; - setup_remote_row_indirect_group(conn6_2, sizeof(conn6_2)/sizeof(conn6_2[0])); + setup_remote_row_indirect_group(conn6_2, ARRAY_SIZE(conn6_2)); rename_temp_node(4); enable_routing(4); @@ -1084,7 +1084,7 @@ #endif }; - setup_remote_row_indirect_group(conn6_3, sizeof(conn6_3)/sizeof(conn6_3[0])); + setup_remote_row_indirect_group(conn6_3, ARRAY_SIZE(conn6_3));
/* ready to enable RT for 5 */ rename_temp_node(5); @@ -1110,7 +1110,7 @@ #endif }; - setup_row_indirect_group(conn6_4, sizeof(conn6_4)/sizeof(conn6_4[0])); + setup_row_indirect_group(conn6_4, ARRAY_SIZE(conn6_4));
#if 0 /* We need to do sth about reverse about setup_temp_row (0,1), (2,4), (1, 3), (3,5) @@ -1202,7 +1202,7 @@ #endif };
- setup_row_indirect_group(conn8_1,sizeof(conn8_1)/sizeof(conn8_1[0])); + setup_row_indirect_group(conn8_1,ARRAY_SIZE(conn8_1));
for(byte=0; byte<6; byte+=2) { setup_temp_row(byte,byte+2); @@ -1225,7 +1225,7 @@ #endif };
- setup_remote_row_indirect_group(conn8_2, sizeof(conn8_2)/sizeof(conn8_2[0])); + setup_remote_row_indirect_group(conn8_2, ARRAY_SIZE(conn8_2));
#if CROSS_BAR_47_56 //init 5, 6 here @@ -1414,7 +1414,7 @@ #endif };
- setup_row_indirect_group(conn8_3, sizeof(conn8_3)/sizeof(conn8_3[0])); + setup_row_indirect_group(conn8_3, ARRAY_SIZE(conn8_3));
#if CROSS_BAR_47_56 /* for 47, 56, 57, 75, 46, 64 we need to substract another link to @@ -1455,7 +1455,7 @@ 7, 3, 6, };
- opt_broadcast_rt_group(conn8_4, sizeof(conn8_4)/sizeof(conn8_4[0])); + opt_broadcast_rt_group(conn8_4, ARRAY_SIZE(conn8_4));
static const u8 conn8_5[] = { 2, 7, 0, @@ -1463,7 +1463,7 @@ 3, 6, 1, };
- opt_broadcast_rt_plus_group(conn8_5, sizeof(conn8_5)/sizeof(conn8_5[0])); + opt_broadcast_rt_plus_group(conn8_5, ARRAY_SIZE(conn8_5)); #endif
@@ -1770,7 +1770,7 @@ 1,3, 2,3, }; - needs_reset |= optimize_connection_group(opt_conn4, sizeof(opt_conn4)/sizeof(opt_conn4[0])); + needs_reset |= optimize_connection_group(opt_conn4, ARRAY_SIZE(opt_conn4)); } #endif
@@ -1783,7 +1783,7 @@ 4, 5, #endif }; - needs_reset |= optimize_connection_group(opt_conn6, sizeof(opt_conn6)/sizeof(opt_conn6[0])); + needs_reset |= optimize_connection_group(opt_conn6, ARRAY_SIZE(opt_conn6)); } #endif
@@ -1798,7 +1798,7 @@ 5, 7, 6, 7, }; - needs_reset |= optimize_connection_group(opt_conn8, sizeof(opt_conn8)/sizeof(opt_conn8[0])); + needs_reset |= optimize_connection_group(opt_conn8, ARRAY_SIZE(opt_conn8)); } #endif
Index: LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/raminit_test.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/raminit_test.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/raminit_test.c (Arbeitskopie) @@ -341,7 +341,7 @@ }; console_init(); memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
}
Index: LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/raminit.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/raminit.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/raminit.c (Arbeitskopie) @@ -555,7 +555,7 @@ print_spew("setting up CPU"); print_spew_hex8(ctrl->node_id); print_spew(" northbridge registers\r\n"); - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); for(i = 0; i < max; i += 3) { device_t dev; unsigned where; @@ -1303,7 +1303,7 @@ } device0 = ctrl->channel0[i]; device1 = ctrl->channel1[i]; - for(j = 0; j < sizeof(addresses)/sizeof(addresses[0]); j++) { + for(j = 0; j < ARRAY_SIZE(addresses); j++) { unsigned addr; addr = addresses[j]; value0 = spd_read_byte(device0, addr); Index: LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/raminit_f.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/raminit_f.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/raminit_f.c (Arbeitskopie) @@ -643,7 +643,7 @@ print_spew("setting up CPU"); print_spew_hex8(ctrl->node_id); print_spew(" northbridge registers\r\n"); - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); for(i = 0; i < max; i += 3) { device_t dev; unsigned where; @@ -1356,7 +1356,7 @@ } device0 = ctrl->channel0[i]; device1 = ctrl->channel1[i]; - for(j = 0; j < sizeof(addresses)/sizeof(addresses[0]); j++) { + for(j = 0; j < ARRAY_SIZE(addresses); j++) { unsigned addr; addr = addresses[j]; value0 = spd_read_byte(device0, addr); Index: LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/amd/amdk8/resourcemap.c (Arbeitskopie) @@ -253,6 +253,6 @@ PCI_ADDR(0, 0x18, 1, 0xEC), 0x0000FC88, 0x00000000, }; int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); } Index: LinuxBIOSv2-array_size/src/northbridge/amd/amdfam10/resourcemap.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/amd/amdfam10/resourcemap.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/amd/amdfam10/resourcemap.c (Arbeitskopie) @@ -281,7 +281,7 @@ };
u32 max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); setup_resource_map(register_values, max); }
Index: LinuxBIOSv2-array_size/src/northbridge/intel/e7501/raminit.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/intel/e7501/raminit.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/intel/e7501/raminit.c (Arbeitskopie) @@ -1631,7 +1631,7 @@ static void ram_set_d0f0_regs(const struct mem_controller *ctrl) { int i; - int num_values = sizeof(constant_register_values)/sizeof(constant_register_values[0]); + int num_values = ARRAY_SIZE(constant_register_values);
ASSERT((num_values % 3) == 0); // Bad table?
Index: LinuxBIOSv2-array_size/src/northbridge/intel/e7520/raminit_test.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/intel/e7520/raminit_test.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/intel/e7520/raminit_test.c (Arbeitskopie) @@ -341,7 +341,7 @@ }; console_init(); memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
}
Index: LinuxBIOSv2-array_size/src/northbridge/intel/e7520/raminit.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/intel/e7520/raminit.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/intel/e7520/raminit.c (Arbeitskopie) @@ -42,7 +42,7 @@ int i; int max;
- max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); for(i = 0; i < max; i += 3) { device_t dev; unsigned where; Index: LinuxBIOSv2-array_size/src/northbridge/intel/e7525/raminit_test.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/intel/e7525/raminit_test.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/intel/e7525/raminit_test.c (Arbeitskopie) @@ -313,7 +313,7 @@ }; console_init(); memreset_setup(); - sdram_initialize(sizeof(cpu)/sizeof(cpu[0]), cpu); + sdram_initialize(ARRAY_SIZE(cpu), cpu);
} #endif Index: LinuxBIOSv2-array_size/src/northbridge/intel/e7525/raminit.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/intel/e7525/raminit.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/intel/e7525/raminit.c (Arbeitskopie) @@ -42,7 +42,7 @@ int i; int max;
- max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); for(i = 0; i < max; i += 3) { device_t dev; unsigned where; Index: LinuxBIOSv2-array_size/src/northbridge/intel/i855pm/raminit.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/intel/i855pm/raminit.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/intel/i855pm/raminit.c (Arbeitskopie) @@ -384,7 +384,7 @@ #endif int i; int max; - max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); for(i = 0; i < max; i += 3) { uint32_t reg; #if DEBUG_RAM_CONFIG >=2 Index: LinuxBIOSv2-array_size/src/northbridge/intel/i440bx/raminit.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/intel/i440bx/raminit.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/intel/i440bx/raminit.c (Arbeitskopie) @@ -430,7 +430,7 @@ PRINT_DEBUG("Northbridge prior to SDRAM init:\r\n"); DUMPNORTH();
- max = sizeof(register_values) / sizeof(register_values[0]); + max = ARRAY_SIZE(register_values);
/* Set registers as specified in the register_values[] array. */ for (i = 0; i < max; i += 3) { Index: LinuxBIOSv2-array_size/src/northbridge/intel/i3100/raminit.c =================================================================== --- LinuxBIOSv2-array_size/src/northbridge/intel/i3100/raminit.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/northbridge/intel/i3100/raminit.c (Arbeitskopie) @@ -65,7 +65,7 @@ int i; int max;
- max = sizeof(register_values)/sizeof(register_values[0]); + max = ARRAY_SIZE(register_values); for(i = 0; i < max; i += 3) { device_t dev; u32 where; Index: LinuxBIOSv2-array_size/src/arch/ppc/boot/coreboot_table.c =================================================================== --- LinuxBIOSv2-array_size/src/arch/ppc/boot/coreboot_table.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/arch/ppc/boot/coreboot_table.c (Arbeitskopie) @@ -116,7 +116,7 @@ { LB_TAG_ASSEMBLER, coreboot_assembler, }, }; unsigned int i; - for(i = 0; i < sizeof(strings)/sizeof(strings[0]); i++) { + for(i = 0; i < ARRAY_SIZE(strings); i++) { struct lb_string *rec; size_t len; rec = (struct lb_string *)lb_new_record(header); Index: LinuxBIOSv2-array_size/src/arch/i386/smp/ioapic.c =================================================================== --- LinuxBIOSv2-array_size/src/arch/i386/smp/ioapic.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/arch/i386/smp/ioapic.c (Arbeitskopie) @@ -67,7 +67,7 @@ l[0] = 0x03; l[4] = 1; #endif /* i786 */ - for (i = 0; i < sizeof(ioapicregvalues) / sizeof(ioapicregvalues[0]); + for (i = 0; i < ARRAY_SIZE(ioapicregvalues); i++, a++) { l[0] = (a->reg * 2) + 0x10; l[4] = a->value_low; Index: LinuxBIOSv2-array_size/src/arch/i386/boot/coreboot_table.c =================================================================== --- LinuxBIOSv2-array_size/src/arch/i386/boot/coreboot_table.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/arch/i386/boot/coreboot_table.c (Arbeitskopie) @@ -184,7 +184,7 @@ { LB_TAG_ASSEMBLER, coreboot_assembler, }, }; unsigned int i; - for(i = 0; i < sizeof(strings)/sizeof(strings[0]); i++) { + for(i = 0; i < ARRAY_SIZE(strings); i++) { struct lb_string *rec; size_t len; rec = (struct lb_string *)lb_new_record(header); Index: LinuxBIOSv2-array_size/src/arch/i386/boot/acpi.c =================================================================== --- LinuxBIOSv2-array_size/src/arch/i386/boot/acpi.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/arch/i386/boot/acpi.c (Arbeitskopie) @@ -44,7 +44,7 @@ { int i; - int entries_num = sizeof(rsdt->entry)/sizeof(rsdt->entry[0]); + int entries_num = ARRAY_SIZE(rsdt->entry); for (i=0; i<entries_num; i++) { if(rsdt->entry[i]==0) { Index: LinuxBIOSv2-array_size/src/arch/i386/lib/exception.c =================================================================== --- LinuxBIOSv2-array_size/src/arch/i386/lib/exception.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/arch/i386/lib/exception.c (Arbeitskopie) @@ -377,7 +377,7 @@ gdb_stub_registers[CS] = info->cs; gdb_stub_registers[PS] = info->eflags; signo = GDB_UNKNOWN; - if (info->vector < sizeof(exception_to_signal)/sizeof(exception_to_signal[0])) { + if (info->vector < ARRAY_SIZE(exception_to_signal)) { signo = exception_to_signal[info->vector]; } Index: LinuxBIOSv2-array_size/src/arch/i386/lib/cpu.c =================================================================== --- LinuxBIOSv2-array_size/src/arch/i386/lib/cpu.c (Revision 3513) +++ LinuxBIOSv2-array_size/src/arch/i386/lib/cpu.c (Arbeitskopie) @@ -123,7 +123,7 @@ { const char *name; name = "<invalid cpu vendor>"; - if ((vendor < (sizeof(x86_vendor_name)/sizeof(x86_vendor_name[0]))) && + if ((vendor < (ARRAY_SIZE(x86_vendor_name))) && (x86_vendor_name[vendor] != 0)) { name = x86_vendor_name[vendor]; @@ -185,7 +185,7 @@ } } cpu->vendor = X86_VENDOR_UNKNOWN; - for(i = 0; i < sizeof(x86_vendors)/sizeof(x86_vendors[0]); i++) { + for(i = 0; i < ARRAY_SIZE(x86_vendors); i++) { if (memcmp(vendor_name, x86_vendors[i].name, 12) == 0) { cpu->vendor = x86_vendors[i].vendor; break;