From nobody Tue Feb 10 04:16:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1628087489998776.6309489365923; Wed, 4 Aug 2021 07:31:29 -0700 (PDT) Received: from localhost ([::1]:54746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBHvc-0001bT-QY for importer@patchew.org; Wed, 04 Aug 2021 10:31:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHsA-0002kY-9Y for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:27:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37444) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBHs6-0003KU-S9 for qemu-devel@nongnu.org; Wed, 04 Aug 2021 10:27:54 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-393-Yuxt_W_bNo2k_r7rEv2LyA-1; Wed, 04 Aug 2021 10:27:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 232ED1026209; Wed, 4 Aug 2021 14:27:48 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4ECA60BF4; Wed, 4 Aug 2021 14:27:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 55A821800987; Wed, 4 Aug 2021 16:27:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628087270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s8fn+CHbP6vdoLeFpXBzR9+y5YgSiK+WUd/xfJkUkpA=; b=CBurjGYPDsBzaU7oTTmrpyMSYlRXz/9ww90qXfv3iQ1gsn9LsCRy1NRiRcuVYFNpMPXFCM SQDpaOpejC2ZihrlD6VesDWc9Z/dkfXygaeuntnDZXRigYzzYmSFNOkuTJJTadYXRX+bEm 3FzTJzvexAM/rVsgqavheJuf63HAKzw= X-MC-Unique: Yuxt_W_bNo2k_r7rEv2LyA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH 2/7] floppy: move isa_fdc_init_drives + fdctrl_init_drives Date: Wed, 4 Aug 2021 16:27:32 +0200 Message-Id: <20210804142737.3366441-3-kraxel@redhat.com> In-Reply-To: <20210804142737.3366441-1-kraxel@redhat.com> References: <20210804142737.3366441-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) DKIMWL_WL_HIGH=-0.699, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Richard Henderson , Max Reitz , Gerd Hoffmann , Paolo Bonzini , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1628087490952100001 Content-Type: text/plain; charset="utf-8" isa_fdc_init_drives() is called by pc machine setup, and it depends on fdctrl_init_drives(). Move both functions to separate source file so we can keep them in core qemu when building floppy as module. Signed-off-by: Gerd Hoffmann --- hw/block/fdc-isa.c | 5 ----- hw/block/fdc-module.c | 24 ++++++++++++++++++++++++ hw/block/fdc.c | 17 ----------------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c index dd7e1669f862..36c246efa822 100644 --- a/hw/block/fdc-isa.c +++ b/hw/block/fdc-isa.c @@ -57,11 +57,6 @@ static void fdctrl_external_reset_isa(DeviceState *d) fdctrl_reset(s, 0); } =20 -void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds) -{ - fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds); -} - static const MemoryRegionPortio fdc_portio_list[] =3D { { 1, 5, 1, .read =3D fdctrl_read, .write =3D fdctrl_write }, { 7, 1, 1, .read =3D fdctrl_read, .write =3D fdctrl_write }, diff --git a/hw/block/fdc-module.c b/hw/block/fdc-module.c index 93953bf0aa57..8309e99361bc 100644 --- a/hw/block/fdc-module.c +++ b/hw/block/fdc-module.c @@ -29,8 +29,32 @@ #include "qemu/osdep.h" #include "hw/isa/isa.h" #include "hw/block/fdc.h" +#include "qapi/error.h" +#include "sysemu/blockdev.h" #include "fdc-internal.h" =20 +void fdctrl_init_drives(FloppyBus *bus, DriveInfo **fds) +{ + DeviceState *dev; + int i; + + for (i =3D 0; i < MAX_FD; i++) { + if (fds[i]) { + dev =3D qdev_new("floppy"); + qdev_prop_set_uint32(dev, "unit", i); + qdev_prop_set_enum(dev, "drive-type", FLOPPY_DRIVE_TYPE_AUTO); + qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(fds[= i]), + &error_fatal); + qdev_realize_and_unref(dev, &bus->bus, &error_fatal); + } + } +} + +void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds) +{ + fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds); +} + FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i) { FDCtrlISABus *isa =3D ISA_FDC(fdc); diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 9014cd30b3ab..ba42537e8d26 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -2297,23 +2297,6 @@ static void fdctrl_result_timer(void *opaque) =20 /* Init functions */ =20 -void fdctrl_init_drives(FloppyBus *bus, DriveInfo **fds) -{ - DeviceState *dev; - int i; - - for (i =3D 0; i < MAX_FD; i++) { - if (fds[i]) { - dev =3D qdev_new("floppy"); - qdev_prop_set_uint32(dev, "unit", i); - qdev_prop_set_enum(dev, "drive-type", FLOPPY_DRIVE_TYPE_AUTO); - qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(fds[= i]), - &error_fatal); - qdev_realize_and_unref(dev, &bus->bus, &error_fatal); - } - } -} - void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl, Error **errp) { int i, j; --=20 2.31.1