* [patch] stop passing in global variable as argument to cmos_init()
@ 2008-09-26 13:03 Jes Sorensen
2008-09-27 10:51 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Jes Sorensen @ 2008-09-26 13:03 UTC (permalink / raw)
To: Avi Kivity, kvm, kvm-ia64
[-- Attachment #1: Type: text/plain, Size: 420 bytes --]
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
[-- Attachment #2: 2000-qemu-cmos-init-cleanup.patch --]
[-- Type: text/plain, Size: 2137 bytes --]
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'.
Signed-off-by: Jes Sorensen <jes@sgi.com>
---
qemu/hw/ipf.c | 5 ++---
qemu/hw/pc.c | 6 ++----
2 files changed, 4 insertions(+), 7 deletions(-)
Index: kvm-userspace.git/qemu/hw/ipf.c
===================================================================
--- kvm-userspace.git.orig/qemu/hw/ipf.c
+++ kvm-userspace.git/qemu/hw/ipf.c
@@ -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);
Index: kvm-userspace.git/qemu/hw/pc.c
===================================================================
--- kvm-userspace.git.orig/qemu/hw/pc.c
+++ kvm-userspace.git/qemu/hw/pc.c
@@ -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);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [patch] stop passing in global variable as argument to cmos_init()
2008-09-26 13:03 [patch] stop passing in global variable as argument to cmos_init() Jes Sorensen
@ 2008-09-27 10:51 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-09-27 10:51 UTC (permalink / raw)
To: Jes Sorensen; +Cc: kvm, kvm-ia64
Jes Sorensen wrote:
> 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.)
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-27 10:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-26 13:03 [patch] stop passing in global variable as argument to cmos_init() Jes Sorensen
2008-09-27 10:51 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).