From nobody Sun Nov 9 21:40:50 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552119701918577.7547747265721; Sat, 9 Mar 2019 00:21:41 -0800 (PST) Received: from localhost ([127.0.0.1]:55827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2XEX-0008I0-2d for importer@patchew.org; Sat, 09 Mar 2019 03:21:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2XDk-0007xA-Ku for qemu-devel@nongnu.org; Sat, 09 Mar 2019 03:20:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2XDj-0006Qj-Mk for qemu-devel@nongnu.org; Sat, 09 Mar 2019 03:20:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49812) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h2XDj-0006My-Cl for qemu-devel@nongnu.org; Sat, 09 Mar 2019 03:20:39 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 23ECCC049D63; Sat, 9 Mar 2019 08:12:56 +0000 (UTC) Received: from thuth.com (ovpn-116-33.ams2.redhat.com [10.36.116.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC0A95C241; Sat, 9 Mar 2019 08:12:52 +0000 (UTC) From: Thomas Huth To: Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 9 Mar 2019 09:12:50 +0100 Message-Id: <1552119170-15474-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 09 Mar 2019 08:12:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] hw/char/parallel: Make it possible to compile also without CONFIG_PARALLEL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miroslav Rezanina , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For the downstream distribution of QEMU, we want to compile without CONFIG_PARALLEL. Commit 9157eee1b1c076ff3 already moved the function parallel_hds_isa_init() (which is still required for linking) into a file that is included anyway, but commit bb3d5ea858e7f888563a moved it to a separate file which is only compiled again if CONFIG_PARALLEL is set. To be able to link QEMU again without CONFIG_PARALLEL, let's move this file unconditionally to common-obj-y again. And while we're at it, also rename it to parallel-helper.c (since parallel.c is also about ISA already), add a proper comment in there with the rationale for the separate file, and a check via object_class_by_name() to see whether the device class is available in the binary or not. Signed-off-by: Thomas Huth --- hw/char/Makefile.objs | 2 +- hw/char/{parallel-isa.c =3D> parallel-helper.c} | 10 +++++++++- hw/char/parallel.c | 1 - hw/i386/Kconfig | 2 -- include/hw/char/parallel.h | 2 ++ 5 files changed, 12 insertions(+), 5 deletions(-) rename hw/char/{parallel-isa.c =3D> parallel-helper.c} (70%) diff --git a/hw/char/Makefile.objs b/hw/char/Makefile.objs index c4947d7..5476803 100644 --- a/hw/char/Makefile.objs +++ b/hw/char/Makefile.objs @@ -2,7 +2,7 @@ common-obj-$(CONFIG_IPACK) +=3D ipoctal232.o common-obj-$(CONFIG_ESCC) +=3D escc.o common-obj-$(CONFIG_NRF51_SOC) +=3D nrf51_uart.o common-obj-$(CONFIG_PARALLEL) +=3D parallel.o -common-obj-$(CONFIG_PARALLEL) +=3D parallel-isa.o +common-obj-y +=3D parallel-helper.o common-obj-$(CONFIG_PL011) +=3D pl011.o common-obj-$(CONFIG_SERIAL) +=3D serial.o common-obj-$(CONFIG_SERIAL_ISA) +=3D serial-isa.o diff --git a/hw/char/parallel-isa.c b/hw/char/parallel-helper.c similarity index 70% rename from hw/char/parallel-isa.c rename to hw/char/parallel-helper.c index 639e179..c3e868b 100644 --- a/hw/char/parallel-isa.c +++ b/hw/char/parallel-helper.c @@ -1,11 +1,15 @@ /* * QEMU Parallel PORT (ISA bus helpers) * + * These functions reside in a separate file since they also might be + * required for linking when compiling QEMU without CONFIG_PARALLEL. + * * Copyright (c) 2003 Fabrice Bellard * * SPDX-License-Identifier: MIT */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "sysemu/sysemu.h" #include "hw/isa/isa.h" #include "hw/char/parallel.h" @@ -15,7 +19,7 @@ static void parallel_init(ISABus *bus, int index, Chardev= *chr) DeviceState *dev; ISADevice *isadev; =20 - isadev =3D isa_create(bus, "isa-parallel"); + isadev =3D isa_create(bus, TYPE_ISA_PARALLEL); dev =3D DEVICE(isadev); qdev_prop_set_uint32(dev, "index", index); qdev_prop_set_chr(dev, "chardev", chr); @@ -28,6 +32,10 @@ void parallel_hds_isa_init(ISABus *bus, int n) =20 assert(n <=3D MAX_PARALLEL_PORTS); =20 + if (!object_class_by_name(TYPE_ISA_PARALLEL)) { + return; + } + for (i =3D 0; i < n; i++) { if (parallel_hds[i]) { parallel_init(bus, i, parallel_hds[i]); diff --git a/hw/char/parallel.c b/hw/char/parallel.c index a80da47..a19e7d9 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -85,7 +85,6 @@ typedef struct ParallelState { PortioList portio_list; } ParallelState; =20 -#define TYPE_ISA_PARALLEL "isa-parallel" #define ISA_PARALLEL(obj) \ OBJECT_CHECK(ISAParallelState, (obj), TYPE_ISA_PARALLEL) =20 diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index 78fd703..4d8247a 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -25,8 +25,6 @@ config PC select I82374 select I8257 select MC146818RTC - # Needed by the board code: - select PARALLEL # For ACPI builder: select SERIAL_ISA select ACPI_VMGENID diff --git a/include/hw/char/parallel.h b/include/hw/char/parallel.h index d6dd62f..e0a7fe1 100644 --- a/include/hw/char/parallel.h +++ b/include/hw/char/parallel.h @@ -5,6 +5,8 @@ #include "hw/isa/isa.h" #include "chardev/char.h" =20 +#define TYPE_ISA_PARALLEL "isa-parallel" + void parallel_hds_isa_init(ISABus *bus, int n); =20 bool parallel_mm_init(MemoryRegion *address_space, --=20 1.8.3.1