stop passing in global variable as argument to cmos_init()
PATCH 1/1 stop passing in global variable as argument to cmos_init()
Hi,
Looking through the ia64 code I came across this little gem.
At some point someone added a new argument to hw/pc.c:cmos_init() named 'smp_cpus', and then passed in the global variable 'smp_cpus' as the argument. This propagated through to the ia64 code as well.
I checked, this isn't present in the upstream QEMU code, so lets kill it in the KVM branch. One small step to get closer to upstream :-)
Cheers,
Jes
There is no reason to pass in global variable smp_cpus to cmos_init() which then references it as a local variable of the same name 'smp_cpus'.
--- qemu/hw/ipf.c | 5 ++--- qemu/hw/pc.c | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-)
qemu/hw/ipf.c +2 -3
@@ -179,8 +179,7 @@/* hd_table must contain 4 block drivers */ static void cmos_init (ram_addr_t ram_size,ram_addr_t above_4g_mem_size, -const char *boot_device,BlockDriverState **hd_table, -int smp_cpus) +const char *boot_device,BlockDriverState **hd_table) {RTCState *s = rtc_state;int nbds, bds[3 ] = {0 , };
@@ -591,7 +590,7 @@ } floppy_controller =fdctrl_init (i8259[6 ],2 ,0 ,0x3f0 , fd); -cmos_init (ram_size, above_4g_mem_size, boot_device, hd, smp_cpus); +cmos_init (ram_size, above_4g_mem_size, boot_device, hd);if (pci_enabled && usb_enabled) {usb_uhci_piix3_init (pci_bus, piix3_devfn +2 );
qemu/hw/pc.c +2 -4
@@ -228,8 +228,7 @@/* hd_table must contain 4 block drivers */ static void cmos_init (ram_addr_t ram_size,ram_addr_t above_4g_mem_size, -const char *boot_device,BlockDriverState **hd_table, -int smp_cpus) +const char *boot_device,BlockDriverState **hd_table) {RTCState *s = rtc_state;int nbds, bds[3 ] = {0 , };
@@ -1093,8 +1092,7 @@ } floppy_controller =fdctrl_init (i8259[6 ],2 ,0 ,0x3f0 , fd); -cmos_init (below_4g_mem_size, above_4g_mem_size, boot_device, hd, - smp_cpus); +cmos_init (below_4g_mem_size, above_4g_mem_size, boot_device, hd);if (pci_enabled && usb_enabled) {usb_uhci_piix3_init (pci_bus, piix3_devfn +2 );
Avi Kivity
AppliedQuoted 11 lines · Jes Sorensen
Hi,
Looking through the ia64 code I came across this little gem.
At some point someone added a new argument to hw/pc.c:cmos_init() named '
smp_cpus', and then passed in the global variable 'smp_cpus' as the argument. This propagated through to the ia64 code as well.I checked, this isn't present in the upstream QEMU code, so lets kill it in the KVM branch. One small step to get closer to upstream :-)
Applied, thanks (though personally I prefer not depending on global variables and their initialization order, etc.)
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.