All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jes Sorensen <jes@sgi.com>
To: kvm-ia64@vger.kernel.org
Subject: [patch] stop passing in global variable as argument to cmos_init()
Date: Fri, 26 Sep 2008 13:03:10 +0000	[thread overview]
Message-ID: <48DCDD8E.4070409@sgi.com> (raw)

[-- 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);

WARNING: multiple messages have this Message-ID (diff)
From: Jes Sorensen <jes@sgi.com>
To: Avi Kivity <avi@qumranet.com>,
	kvm@vger.kernel.org, kvm-ia64@vger.kernel.org
Subject: [patch] stop passing in global variable as argument to cmos_init()
Date: Fri, 26 Sep 2008 15:03:10 +0200	[thread overview]
Message-ID: <48DCDD8E.4070409@sgi.com> (raw)

[-- 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);

             reply	other threads:[~2008-09-26 13:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-26 13:03 Jes Sorensen [this message]
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
2008-09-27 10:51   ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48DCDD8E.4070409@sgi.com \
    --to=jes@sgi.com \
    --cc=kvm-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.