diff mbox series

[2/3] hw/scsi/lsi53c895a: Call scsi_bus_legacy_handle_cmdline() once

Message ID 20241122111939.11936-3-philmd@linaro.org (mailing list archive)
State New
Headers show
Series hw/scsi: Cleanup around scsi_bus_legacy_handle_cmdline() | expand

Commit Message

Philippe Mathieu-Daudé Nov. 22, 2024, 11:19 a.m. UTC
Call scsi_bus_legacy_handle_cmdline() once in the DeviceRealize
handler, just after scsi_bus_init().
No need for lsi53c8xx_handle_legacy_cmdline(), remove it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/pci/pci.h | 2 --
 hw/arm/realview.c    | 3 +--
 hw/arm/versatilepb.c | 3 +--
 hw/hppa/machine.c    | 3 +--
 hw/ppc/prep.c        | 1 -
 hw/scsi/lsi53c895a.c | 8 +-------
 6 files changed, 4 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index c0717e3121..7a69f0368c 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -655,8 +655,6 @@  PCIDevice *pci_create_simple_multifunction(PCIBus *bus, int devfn,
                                            const char *name);
 PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name);
 
-void lsi53c8xx_handle_legacy_cmdline(DeviceState *lsi_dev);
-
 qemu_irq pci_allocate_irq(PCIDevice *pci_dev);
 void pci_set_irq(PCIDevice *pci_dev, int level);
 
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index b186f965c6..1042c1a1a3 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -294,8 +294,7 @@  static void realview_init(MachineState *machine,
         }
         n = drive_get_max_bus(IF_SCSI);
         while (n >= 0) {
-            dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
-            lsi53c8xx_handle_legacy_cmdline(dev);
+            pci_create_simple(pci_bus, -1, "lsi53c895a");
             n--;
         }
     }
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index d48235453e..716ed951bc 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -271,8 +271,7 @@  static void versatile_init(MachineState *machine, int board_id)
     }
     n = drive_get_max_bus(IF_SCSI);
     while (n >= 0) {
-        dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
-        lsi53c8xx_handle_legacy_cmdline(dev);
+        pci_create_simple(pci_bus, -1, "lsi53c895a");
         n--;
     }
 
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index a31dc32a9f..69b822bfc8 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -349,8 +349,7 @@  static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,
 
     /* SCSI disk setup. */
     if (drive_get_max_bus(IF_SCSI) >= 0) {
-        dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
-        lsi53c8xx_handle_legacy_cmdline(dev);
+        pci_create_simple(pci_bus, -1, "lsi53c895a");
     }
 
     /* Graphics setup. */
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index fb58c312ac..0e5ff2a75c 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -328,7 +328,6 @@  static void ibm_40p_init(MachineState *machine)
 
         dev = DEVICE(pci_create_simple(pci_bus, PCI_DEVFN(1, 0),
                                        "lsi53c810"));
-        lsi53c8xx_handle_legacy_cmdline(dev);
         qdev_connect_gpio_out(dev, 0, qdev_get_gpio_in(i82378_dev, 13));
 
         /* XXX: s3-trio at PCI_DEVFN(2, 0) */
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 1f728416e2..d632789434 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2365,6 +2365,7 @@  static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
     QTAILQ_INIT(&s->queue);
 
     scsi_bus_init(&s->bus, sizeof(s->bus), d, &lsi_scsi_info);
+    scsi_bus_legacy_handle_cmdline(&s->bus);
 }
 
 static void lsi_scsi_exit(PCIDevice *dev)
@@ -2422,10 +2423,3 @@  static void lsi53c895a_register_types(void)
 }
 
 type_init(lsi53c895a_register_types)
-
-void lsi53c8xx_handle_legacy_cmdline(DeviceState *lsi_dev)
-{
-    LSIState *s = LSI53C895A(lsi_dev);
-
-    scsi_bus_legacy_handle_cmdline(&s->bus);
-}