All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
To: qemu-devel@nongnu.org
Cc: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>,
	ehabkost@redhat.com, thuth@redhat.com, pbonzini@redhat.com,
	armbru@redhat.com, peter.maydell@linaro.org,
	richard.henderson@linaro.org, alistair.francis@wdc.com,
	Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Subject: [Qemu-devel] [PATCH v2 21/21] core/sysbus: remove the SysBusDeviceClass::init path
Date: Fri, 23 Nov 2018 23:30:40 +0800	[thread overview]
Message-ID: <20181123153040.18933-22-maozhongyi@cmss.chinamobile.com> (raw)
In-Reply-To: <20181123153040.18933-1-maozhongyi@cmss.chinamobile.com>

Currently, all sysbus devices have been converted to realize(),
so remove this path.

Cc: ehabkost@redhat.com
Cc: thuth@redhat.com
Cc: pbonzini@redhat.com
Cc: armbru@redhat.com
Cc: peter.maydell@linaro.org
Cc: richard.henderson@linaro.org
Cc: alistair.francis@wdc.com

Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
 hw/core/sysbus.c    | 15 +++++----------
 include/hw/sysbus.h |  3 ---
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index 7ac36ad3e7..9f9edbcab9 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -201,18 +201,13 @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size)
     }
 }
 
-/* TODO remove once all sysbus devices have been converted to realize */
+/* The purpose of preserving this empty realize function
+ * is to prevent the parent_realize field of some subclasses
+ * from being set to NULL to break the normal init/realize
+ * of some devices.
+ */
 static void sysbus_realize(DeviceState *dev, Error **errp)
 {
-    SysBusDevice *sd = SYS_BUS_DEVICE(dev);
-    SysBusDeviceClass *sbc = SYS_BUS_DEVICE_GET_CLASS(sd);
-
-    if (!sbc->init) {
-        return;
-    }
-    if (sbc->init(sd) < 0) {
-        error_setg(errp, "Device initialization failed");
-    }
 }
 
 DeviceState *sysbus_create_varargs(const char *name,
diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
index 0b59a3b8d6..1aedcf05c9 100644
--- a/include/hw/sysbus.h
+++ b/include/hw/sysbus.h
@@ -38,9 +38,6 @@ typedef struct SysBusDevice SysBusDevice;
 typedef struct SysBusDeviceClass {
     /*< private >*/
     DeviceClass parent_class;
-    /*< public >*/
-
-    int (*init)(SysBusDevice *dev);
 
     /*
      * Let the sysbus device format its own non-PIO, non-MMIO unit address.
-- 
2.17.1

      parent reply	other threads:[~2018-11-23 15:31 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-23 15:30 [Qemu-devel] [PATCH v2 00/21] QOM'ify SysBusDeviceClass->init Mao Zhongyi
2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 01/21] musicpal: Convert sysbus init function to realize function Mao Zhongyi
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 02/21] block/noenand: " Mao Zhongyi
2018-11-23 16:31   ` Philippe Mathieu-Daudé
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 03/21] char/grlib_apbuart: " Mao Zhongyi
2018-11-23 15:38   ` Philippe Mathieu-Daudé
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 04/21] core/empty_slot: " Mao Zhongyi
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 05/21] display/g364fb: " Mao Zhongyi
2018-11-23 15:43   ` Philippe Mathieu-Daudé
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 06/21] dma/puv3_dma: " Mao Zhongyi
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 07/21] gpio/puv3_gpio: " Mao Zhongyi
2018-11-23 15:38   ` Philippe Mathieu-Daudé
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 08/21] milkymist-softusb: " Mao Zhongyi
2018-11-23 15:39   ` Philippe Mathieu-Daudé
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 09/21] input/pl050: " Mao Zhongyi
2018-11-23 15:40   ` Philippe Mathieu-Daudé
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 10/21] intc/puv3_intc: " Mao Zhongyi
2018-11-23 15:44   ` Philippe Mathieu-Daudé
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 11/21] milkymist-hpdmc: " Mao Zhongyi
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 12/21] milkymist-pfpu: " Mao Zhongyi
2018-11-23 15:40   ` Philippe Mathieu-Daudé
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 13/21] puv3_pm.c: " Mao Zhongyi
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 14/21] nvram/ds1225y: " Mao Zhongyi
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 15/21] pci-bridge/dec: " Mao Zhongyi
2018-11-23 16:37   ` Philippe Mathieu-Daudé
2018-11-25  1:36     ` [Qemu-devel] [PATCH v2 15/21] pci-bridge/dec: Convert sysbus initfunction " maozy
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 16/21] timer/etraxfs_timer: Convert sysbus init function " Mao Zhongyi
2018-11-23 16:32   ` Philippe Mathieu-Daudé
2018-11-23 16:33   ` Edgar E. Iglesias
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 17/21] timer/grlib_gptimer: " Mao Zhongyi
2018-11-23 15:41   ` Philippe Mathieu-Daudé
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 18/21] timer/puv3_ost: " Mao Zhongyi
2018-11-23 16:33   ` Philippe Mathieu-Daudé
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 19/21] usb/tusb6010: " Mao Zhongyi
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 20/21] xen_backend: remove xen_sysdev_init() function Mao Zhongyi
2018-11-23 15:30   ` Mao Zhongyi
2018-11-26 14:27   ` [Qemu-devel] " Anthony PERARD
2018-11-26 14:27     ` Anthony PERARD
2018-11-23 15:30 ` Mao Zhongyi [this message]

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=20181123153040.18933-22-maozhongyi@cmss.chinamobile.com \
    --to=maozhongyi@cmss.chinamobile.com \
    --cc=alistair.francis@wdc.com \
    --cc=armbru@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    --cc=zhangshengju@cmss.chinamobile.com \
    /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.