Patchwork [09/61] pc: remove a global variable, floppy_controller.

login
register
mail settings
Submitter Isaku Yamahata
Date Sept. 30, 2009, 10:17 a.m.
Message ID <1254305917-14784-10-git-send-email-yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/34540/
State Superseded
Headers show

Comments

Isaku Yamahata - Sept. 30, 2009, 10:17 a.m.
Remove a global variable, floppy_controller.
Since it is unnecessarily global, make it local and pass it as
a function argument.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/pc.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

Patch

diff --git a/hw/pc.c b/hw/pc.c
index 1a2b2b4..4d301ff 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -61,7 +61,6 @@ 
 
 #define MAX_IDE_BUS 2
 
-static fdctrl_t *floppy_controller;
 static RTCState *rtc_state;
 
 typedef struct rom_reset_data {
@@ -277,7 +276,8 @@  static int pc_boot_set(void *opaque, const char *boot_device)
 
 /* 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, DriveInfo **hd_table)
+                      const char *boot_device, DriveInfo **hd_table,
+                      fdctrl_t *floppy_controller)
 {
     RTCState *s = rtc_state;
     int nbds, bds[3] = { 0, };
@@ -1150,6 +1150,7 @@  static void pc_init1(ram_addr_t ram_size,
     BlockDriverState *fd[MAX_FD];
     int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled;
     void *fw_cfg;
+    fdctrl_t *floppy_controller;
     PITState *pit;
 
     if (ram_size >= 0xe0000000 ) {
@@ -1399,7 +1400,8 @@  static void pc_init1(ram_addr_t ram_size,
     }
     floppy_controller = fdctrl_init_isa(fd);
 
-    cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd);
+    cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd,
+              floppy_controller);
 
     if (pci_enabled && usb_enabled) {
         usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);