From patchwork Thu Oct 19 07:33:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 735527 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1382460wro; Thu, 19 Oct 2023 00:33:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHF8Og0Ez/S7FqinUOJ+/1KbVIxvkIBCTYQ7QWBPmsSkcfahXLD+/Nbg0VNeKQT3lkfQ3rq X-Received: by 2002:a05:600c:3b9a:b0:402:ebe1:7960 with SMTP id n26-20020a05600c3b9a00b00402ebe17960mr996556wms.2.1697700827002; Thu, 19 Oct 2023 00:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697700826; cv=none; d=google.com; s=arc-20160816; b=QWW3wjGvZ21W3Nq9UEiSQuHYcKwVoCXxlZbu7Jbcs1Pmsomwx6OBOX/Jfdyk58PZo7 ifdEqWIptty/SBlkUal1fcj7MN4wWpYu9SdKB96zo4YvSRz1zqlveFJ39XOzcFijEBWw IxnMjPWoW7CEBmGYEqI7o2ObDoY7q0FId0TLhzhg2KIFe63T5GtOsGl38/48c8gX/5EN XzY3nkKHyviWWc5yuxLXF+lfguZ4dz34Ta93Qyns07zRqcgOnJFpHGyQpvez+Nr4ehGd a+tKWsyVTBKwKPr/6w14c3Cz8e0KBVvWtksMIrjFu5yI038v4Nt6O8DK5vz2wdhLwPbh azSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=gim8yQHzdFdkBLZz5G1JCT1nr/eNaSSdRTGu6q5RTFM=; fh=Gc9znBVK07DwkR/GfLukKdPgqtNkaNQYqDnnU4No8Ik=; b=aK1WHkWj2NQtSFXQTaWEdZsXsdbWfJ9QeasamHNrHgK4cFjOPOYO5HItf5QhvCuqWM LEE/eyPxqf5baxUM+NBkeY+JV8LXeAYVTcLK6DNWnHk02o2PTF6nX9Iwbp163s1rJJc6 s8TRsfSzWJYCdPgdNgqHgO7rxA4zA8ljOCXEFGmlbX8BMUj+kziLizfFDDZqy64C/x47 PTjJ7HnDb76id+hh8RY2k4OTn1L4gWt13TCt+Hralr3LJRnCFC3EuZEjQh0TLPuOg8Hm 53i0y+aXBVzzI+7EJtPsjSp8F4C8W8KGa+enNWDNVC9F0/ZMTqKuywDKSG1DG0Bmh1Q7 CdRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VyTb0HUW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p8-20020a05600c430800b003f9d7ff24c9si2019516wme.155.2023.10.19.00.33.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Oct 2023 00:33:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VyTb0HUW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtNWv-0001n6-As; Thu, 19 Oct 2023 03:33:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtNWt-0001m1-Hz for qemu-devel@nongnu.org; Thu, 19 Oct 2023 03:33:15 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtNWr-00016Y-Ss for qemu-devel@nongnu.org; Thu, 19 Oct 2023 03:33:15 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40806e4106dso2470445e9.1 for ; Thu, 19 Oct 2023 00:33:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697700792; x=1698305592; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=gim8yQHzdFdkBLZz5G1JCT1nr/eNaSSdRTGu6q5RTFM=; b=VyTb0HUWBfslGKPuAchbidjogx1z6a8oQRD26fAtEDFRrVsYX43VhfV7LkF60Lg/eM FRPYkK1hJPQJupKN6fbHCmK6IBFPRsb39LHY+Dc0UNx4VMcftkWNNUirvSn77JYfync+ OZ7S0H7MvkEJt2PZ2kwT5p/Bkqp7RiQLZLaflHFMo3uhf/+Rf/58CToUGsepovuOk3ei yYRbmqAxh/6jnf6kDpBqeB6i/cjSZWc13P8r0VCySu7AHpCLPRnoYrHzeYVKmeHe8cFB PQmyn7UL6QM6+O7aV6FCWlFqUmBxqGQBhHKu9/ph40reNWPZY9IjciLLjXyO+b5C/NtQ D3Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697700792; x=1698305592; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gim8yQHzdFdkBLZz5G1JCT1nr/eNaSSdRTGu6q5RTFM=; b=UZwc4ZcpXVTxL3j+7nYGkp88M68MAy0ZOt6Uggcnfbnu45m08Aym9lLVU/TdCqC0ib Jc0muT6LRVcFD8SOdvE89zjzmx5SsXTFVk7R2DNCZbJ+pdmLlS6RDBVhcPIO0oyxhYni ebBgNCmbUDStefovoSokl37h8RetqA08B+6+FxSyRZ6TwnoGEmoimIgmbHQ9dJB2kMhV 1euUNhxMbCAIQ0tjzTTcnwH8Kleoslytom4h4zHS40Zzh5uLgiaT5cTBTpUMbqPZO0iC aIZ7rTjBQvq1Uva+cAYmDJtBv/S2nAOuClAVmjkEWVFi/nbwN7ATX1Kw5w0iYLo1Pbq1 MVRQ== X-Gm-Message-State: AOJu0YxIyphYxGSHjn49NGZcK9us7H7g0qWD2qy015VI2rVJW1LeKPwH CPrHc9VYbZ2ygw0UGsk1gWl2+OHBkl98KNu4Q6V2/Q== X-Received: by 2002:a05:600c:602a:b0:407:4126:f71c with SMTP id az42-20020a05600c602a00b004074126f71cmr980635wmb.6.1697700791983; Thu, 19 Oct 2023 00:33:11 -0700 (PDT) Received: from localhost.localdomain (92.red-88-28-12.dynamicip.rima-tde.net. [88.28.12.92]) by smtp.gmail.com with ESMTPSA id h14-20020a05600c314e00b003fbe4cecc3bsm3687599wmo.16.2023.10.19.00.33.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Oct 2023 00:33:11 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Eduardo Habkost , Gerd Hoffmann , "Michael S. Tsirkin" , =?utf-8?q?Herv=C3=A9_Poussineau?= , Paolo Bonzini , Richard Henderson , Bernhard Beschow , Aleksandar Rikalo , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Mark Cave-Ayland Subject: [PATCH v2] hw/audio/pcspk: Inline pcspk_init() Date: Thu, 19 Oct 2023 09:33:07 +0200 Message-ID: <20231019073307.99608-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.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 Signed-off-by: Philippe Mathieu-Daudé --- 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 c32d2b0b0a..cdc37126c2 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -177,6 +177,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); @@ -279,7 +280,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) {