All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, qemu-s390x@nongnu.org,
	qemu-block@nongnu.org, qemu-arm@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [PULL 30/46] hw/audio/pcspk: Inline pcspk_init()
Date: Thu, 19 Oct 2023 23:17:55 +0200	[thread overview]
Message-ID: <20231019211814.30576-31-philmd@linaro.org> (raw)
In-Reply-To: <20231019211814.30576-1-philmd@linaro.org>

pcspk_init() is a legacy init function, inline and remove it.

Since the device is realized using &error_fatal, use the same
error for setting the "pit" link.

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20231019073307.99608-1-philmd@linaro.org>
---
 include/hw/audio/pcspk.h | 10 ----------
 hw/i386/pc.c             |  4 +++-
 hw/isa/i82378.c          |  5 ++++-
 hw/mips/jazz.c           |  5 ++++-
 4 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/include/hw/audio/pcspk.h b/include/hw/audio/pcspk.h
index 9506179587..6be75a6b86 100644
--- a/include/hw/audio/pcspk.h
+++ b/include/hw/audio/pcspk.h
@@ -25,16 +25,6 @@
 #ifndef HW_PCSPK_H
 #define HW_PCSPK_H
 
-#include "hw/isa/isa.h"
-#include "hw/qdev-properties.h"
-#include "qapi/error.h"
-
 #define TYPE_PC_SPEAKER "isa-pcspk"
 
-static inline void pcspk_init(ISADevice *isadev, ISABus *bus, ISADevice *pit)
-{
-    object_property_set_link(OBJECT(isadev), "pit", OBJECT(pit), NULL);
-    isa_realize_and_unref(isadev, bus, &error_fatal);
-}
-
 #endif /* HW_PCSPK_H */
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index bb3854d1d0..f7ee638bec 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1283,7 +1283,9 @@ void pc_basic_device_init(struct PCMachineState *pcms,
             /* connect PIT to output control line of the HPET */
             qdev_connect_gpio_out(hpet, 0, qdev_get_gpio_in(DEVICE(pit), 0));
         }
-        pcspk_init(pcms->pcspk, isa_bus, pit);
+        object_property_set_link(OBJECT(pcms->pcspk), "pit",
+                                 OBJECT(pit), &error_fatal);
+        isa_realize_and_unref(pcms->pcspk, isa_bus, &error_fatal);
     }
 
     /* Super I/O */
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index 63e0857208..79ffbb52a0 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -67,6 +67,7 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
     uint8_t *pci_conf;
     ISABus *isabus;
     ISADevice *pit;
+    ISADevice *pcspk;
 
     pci_conf = pci->config;
     pci_set_word(pci_conf + PCI_COMMAND,
@@ -102,7 +103,9 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
     pit = i8254_pit_init(isabus, 0x40, 0, NULL);
 
     /* speaker */
-    pcspk_init(isa_new(TYPE_PC_SPEAKER), isabus, pit);
+    pcspk = isa_new(TYPE_PC_SPEAKER);
+    object_property_set_link(OBJECT(pcspk), "pit", OBJECT(pit), &error_fatal);
+    isa_realize_and_unref(pcspk, isabus, &error_fatal);
 
     /* 2 82C37 (dma) */
     isa_create_simple(isabus, "i82374");
diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c
index 86dfe05ea8..d33a76ad4d 100644
--- a/hw/mips/jazz.c
+++ b/hw/mips/jazz.c
@@ -176,6 +176,7 @@ static void mips_jazz_init(MachineState *machine,
     SysBusDevice *sysbus;
     ISABus *isa_bus;
     ISADevice *pit;
+    ISADevice *pcspk;
     DriveInfo *fds[MAX_FD];
     MemoryRegion *bios = g_new(MemoryRegion, 1);
     MemoryRegion *bios2 = g_new(MemoryRegion, 1);
@@ -278,7 +279,9 @@ static void mips_jazz_init(MachineState *machine,
     isa_bus_register_input_irqs(isa_bus, i8259);
     i8257_dma_init(isa_bus, 0);
     pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
-    pcspk_init(isa_new(TYPE_PC_SPEAKER), isa_bus, pit);
+    pcspk = isa_new(TYPE_PC_SPEAKER);
+    object_property_set_link(OBJECT(pcspk), "pit", OBJECT(pit), &error_fatal);
+    isa_realize_and_unref(pcspk, isa_bus, &error_fatal);
 
     /* Video card */
     switch (jazz_model) {
-- 
2.41.0



  parent reply	other threads:[~2023-10-19 21:27 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 21:17 [PULL 00/46] Misc HW/UI patches for 2023-10-19 Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 01/46] mailmap: update email addresses for Luc Michel Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 02/46] MAINTAINERS: Split vt82c686 out of fuloong2e Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 03/46] MAINTAINERS: Add hw/input/lasips2.c to the HPPA machine section Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 04/46] MAINTAINERS: Add include/hw/intc/loongson_liointc.h to the Loongson-3 virt section Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 05/46] MAINTAINERS: Add include/hw/openrisc/ to the OpenRISC section Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 06/46] cutils: Fix get_relocated_path on Windows Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 07/46] buildsys: Only display Objective-C information when Objective-C is used Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 08/46] memory: drop needless argument Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 09/46] memory: follow Error API guidelines Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 10/46] hw/sd/sdhci: Block Size Register bits [14:12] is lost Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 11/46] hw/mips/malta: Use sdram_type enum from 'hw/i2c/smbus_eeprom.h' Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 12/46] hw/mips: Merge 'hw/mips/cpudevs.h' with 'target/mips/cpu.h' Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 13/46] hw/misc/mips_itu: Declare itc_reconfigure() in 'hw/misc/mips_itu.h' Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 14/46] hw/misc/mips_itu: Make MIPSITUState target agnostic Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 15/46] hw/pci-host/sh_pcic: Declare CPU QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 16/46] hw/pci-host/sh_pcic: Correct PCI host / devfn#0 function names Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 17/46] hw/pci-host/sh_pcic: Replace magic value by proper definition Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 18/46] hw/sparc64/ebus: Access memory regions via pci_address_space_io() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 19/46] hw/acpi/pcihp: Clean up global variable shadowing in acpi_pcihp_init() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 20/46] hw/pci: Clean up global variable shadowing of address_space_io variable Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 21/46] hw/s390x: Clean up global variable shadowing in quiesce_powerdown_req() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 22/46] hw/intc/apic: Use ERRP_GUARD() in apic_common_realize() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 23/46] hw/ppc/spapr_vio: Realize SPAPR_VIO_BRIDGE device before accessing it Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 24/46] hw/ppc/pnv_xscom: Rename pnv_xscom_realize(Error **) -> pnv_xscom_init() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 25/46] hw/ppc/pnv_xscom: Move sysbus_mmio_map() call within pnv_xscom_init() Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 26/46] hw/ppc/pnv_xscom: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 27/46] hw/ppc/pnv: " Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 28/46] hw/intc/spapr_xive: Move sysbus_init_mmio() calls around Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 29/46] hw/intc/spapr_xive: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
2023-10-19 21:17 ` Philippe Mathieu-Daudé [this message]
2023-10-19 21:17 ` [PULL 31/46] hw/i386/amd_iommu: " Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 32/46] hw/i386/intel_iommu: " Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 33/46] hw/misc/allwinner-dramc: Move sysbus_mmio_map call from init -> realize Philippe Mathieu-Daudé
2023-10-19 21:17 ` [PULL 34/46] hw/misc/allwinner-dramc: Do not use SysBus API to map local MMIO region Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 35/46] hw/pci-host/bonito: " Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 36/46] hw/acpi: Realize ACPI_GED sysbus device before accessing it Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 37/46] hw/arm/virt: Realize ARM_GICV2M " Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 38/46] hw/isa: Realize ISA bridge " Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 39/46] hw/s390x/css-bridge: Realize sysbus " Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 40/46] hw/virtio/virtio-pmem: Replace impossible check by assertion Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 41/46] hw/block/vhost-user-blk: Use DEVICE() / VIRTIO_DEVICE() macros Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 42/46] hw/display/virtio-gpu: Use VIRTIO_DEVICE() macro Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 43/46] hw/scsi/virtio-scsi: Use VIRTIO_SCSI_COMMON() macro Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 44/46] hw/dma: Declare link using static DEFINE_PROP_LINK() macro Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 45/46] hw/net: " Philippe Mathieu-Daudé
2023-10-19 21:18 ` [PULL 46/46] ui/input: Constify QemuInputHandler structure Philippe Mathieu-Daudé
2023-10-20 10:04 ` [PULL 00/46] Misc HW/UI patches for 2023-10-19 Philippe Mathieu-Daudé
2023-10-20 16:06 ` Stefan Hajnoczi

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=20231019211814.30576-31-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=eduardo@habkost.net \
    --cc=hpoussin@reactos.org \
    --cc=kraxel@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.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.