qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Hervé Poussineau" <hpoussin@reactos.org>
To: Aurelien Jarno <aurelien@aurel32.net>,
	Yongbok Kim <yongbok.kim@mips.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org
Cc: "Hervé Poussineau" <hpoussin@reactos.org>
Subject: [Qemu-devel] [PATCH v3 04/16] mc146818rtc: always register rtc to rtc list
Date: Fri, 29 Dec 2017 15:29:10 +0100	[thread overview]
Message-ID: <20171229142922.31701-5-hpoussin@reactos.org> (raw)
In-Reply-To: <20171229142922.31701-1-hpoussin@reactos.org>

We are not required anymore to use rtc_init() function.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/timer/mc146818rtc.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 3e8c0b7d33..0b0da691cc 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -905,6 +905,13 @@ static void rtc_get_date(Object *obj, struct tm *current_tm, Error **errp)
     rtc_get_time(s, current_tm);
 }
 
+static int rtc_initfn(DeviceState *dev)
+{
+    RTCState *s = MC146818_RTC(dev);
+    QLIST_INSERT_HEAD(&rtc_devices, s, link);
+    return 0;
+}
+
 static void rtc_realizefn(DeviceState *dev, Error **errp)
 {
     ISADevice *isadev = ISA_DEVICE(dev);
@@ -973,11 +980,9 @@ ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
 {
     DeviceState *dev;
     ISADevice *isadev;
-    RTCState *s;
 
     isadev = isa_create(bus, TYPE_MC146818_RTC);
     dev = DEVICE(isadev);
-    s = MC146818_RTC(isadev);
     qdev_prop_set_int32(dev, "base_year", base_year);
     qdev_init_nofail(dev);
     if (intercept_irq) {
@@ -985,7 +990,6 @@ ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
     } else {
         isa_connect_gpio_out(isadev, 0, RTC_ISA_IRQ);
     }
-    QLIST_INSERT_HEAD(&rtc_devices, s, link);
 
     return isadev;
 }
@@ -1012,12 +1016,11 @@ static void rtc_class_initfn(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
+    dc->init = rtc_initfn;
     dc->realize = rtc_realizefn;
     dc->reset = rtc_resetdev;
     dc->vmsd = &vmstate_rtc;
     dc->props = mc146818rtc_properties;
-    /* Reason: needs to be wired up by rtc_init() */
-    dc->user_creatable = false;
 }
 
 static void rtc_finalize(Object *obj)
-- 
2.11.0

  parent reply	other threads:[~2017-12-29 14:30 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-29 14:29 [Qemu-devel] [PATCH v3 00/16] piix4: cleanup and improvements Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 01/16] fdc: move object structures to header file Hervé Poussineau
2018-01-04 13:11   ` Marcel Apfelbaum
2018-01-04 20:33     ` Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 02/16] serial/parallel: " Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 03/16] mc146818rtc: move structure " Hervé Poussineau
2017-12-29 14:29 ` Hervé Poussineau [this message]
2018-01-04 14:30   ` [Qemu-devel] [PATCH v3 04/16] mc146818rtc: always register rtc to rtc list Marcel Apfelbaum
2018-01-04 20:34     ` Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 05/16] piix4: rename some variables in realize function Hervé Poussineau
2018-01-04 14:33   ` Marcel Apfelbaum
2018-01-04 20:36     ` Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 06/16] piix4: add Reset Control Register Hervé Poussineau
2018-01-04 15:50   ` Marcel Apfelbaum
2018-01-04 20:53     ` Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 07/16] piix4: add a i8259 interrupt controller as specified in datasheet Hervé Poussineau
2018-01-04 23:21   ` Michael S. Tsirkin
2018-01-05  6:13     ` Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 08/16] piix4: add a i8257 dma " Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 09/16] piix4: add a i8254 pit " Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 10/16] piix4: add a i8042 keyboard/mouse " Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 11/16] piix4: add a floppy controller, 1 parallel port and 2 serial ports Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 12/16] piix4: add a mc146818rtc controller as specified in datasheet Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 13/16] piix4: add a speaker " Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 14/16] piix4: convert reset function to QOM Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 15/16] piix4: rename PIIX4 object to piix4-isa Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 16/16] piix4: we can now instanciate a PIIX4 with -device Hervé Poussineau
2018-01-04 23:25 ` [Qemu-devel] [PATCH v3 00/16] piix4: cleanup and improvements Michael S. Tsirkin
2018-01-05 11:07 ` Paolo Bonzini
2018-01-05 11:53   ` Philippe Mathieu-Daudé

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=20171229142922.31701-5-hpoussin@reactos.org \
    --to=hpoussin@reactos.org \
    --cc=aurelien@aurel32.net \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yongbok.kim@mips.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).