From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jes Sorensen Subject: [patch] stop passing in global variable as argument to cmos_init() Date: Fri, 26 Sep 2008 15:03:10 +0200 Message-ID: <48DCDD8E.4070409@sgi.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050906030507080703070904" To: Avi Kivity , kvm@vger.kernel.org, kvm-ia64@vger.kernel.org Return-path: Received: from relay1.sgi.com ([192.48.171.29]:46971 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751383AbYIZNDN (ORCPT ); Fri, 26 Sep 2008 09:03:13 -0400 Sender: kvm-owner@vger.kernel.org List-ID: This is a multi-part message in MIME format. --------------050906030507080703070904 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------050906030507080703070904 Content-Type: text/plain; name="2000-qemu-cmos-init-cleanup.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="2000-qemu-cmos-init-cleanup.patch" 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 --- 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); --------------050906030507080703070904--