qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH 09/22] qdev: register all types natively through QEMU Object Model
Date: Thu, 02 Feb 2012 01:07:29 +0100	[thread overview]
Message-ID: <4F29D3C1.9090902@suse.de> (raw)
In-Reply-To: <1328125863-6203-10-git-send-email-aliguori@us.ibm.com>

Am 01.02.2012 20:50, schrieb Anthony Liguori:
> This was done in a mostly automated fashion.  I did it in three steps and then
> rebased it into a single step which avoids repeatedly touching every file in
> the tree.
> 
> The first step was a sed-based addition of the parent type to the subclass
> registration functions.
> 
> The second step was another sed-based removal of subclass registration functions
> while also adding virtual functions from the base class into a class_init
> function as appropriate.
> 
> Finally, a python script was used to convert the DeviceInfo structures and
> qdev_register_subclass functions to TypeInfo structures, class_init functions,
> and type_register_static calls.
> 
> We are almost fully converted to QOM after this commit.
> 
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Doesn't apply any more due to new lost_tick_policy property.

Andreas

diff --cc hw/mc146818rtc.c
index e6e4cb7,c1f4ef4..0000000
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@@ -709,24 -699,26 +709,28 @@@ ISADevice *rtc_init(ISABus *bus, int ba
      return dev;
  }

+ static Property mc146818rtc_properties[] = {
+     DEFINE_PROP_INT32("base_year", RTCState, base_year, 1980),
++    DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", RTCState,
++                               lost_tick_policy, LOST_TICK_DISCARD),
+     DEFINE_PROP_END_OF_LIST(),
+ };
+
  static void rtc_class_initfn(ObjectClass *klass, void *data)
  {
+     DeviceClass *dc = DEVICE_CLASS(klass);
      ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
      ic->init = rtc_initfn;
+     dc->no_user = 1;
+     dc->vmsd = &vmstate_rtc;
+     dc->props = mc146818rtc_properties;
  }

- static DeviceInfo mc146818rtc_info = {
-     .name     = "mc146818rtc",
-     .size     = sizeof(RTCState),
-     .no_user  = 1,
-     .vmsd     = &vmstate_rtc,
-     .class_init          = rtc_class_initfn,
-     .props    = (Property[]) {
-         DEFINE_PROP_INT32("base_year", RTCState, base_year, 1980),
-         DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", RTCState,
-                                    lost_tick_policy, LOST_TICK_DISCARD),
-         DEFINE_PROP_END_OF_LIST(),
-     }
+ static TypeInfo mc146818rtc_info = {
+     .name          = "mc146818rtc",
+     .parent        = TYPE_ISA_DEVICE,
+     .instance_size = sizeof(RTCState),
+     .class_init    = rtc_class_initfn,
  };

  static void mc146818rtc_register(void)

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2012-02-02  0:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-01 19:50 [Qemu-devel] [PATCH 00/22] qom: use Type system to register all devices (v2) Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 01/22] usb-hid: simplify class initialization a bit Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 02/22] usb: separate out legacy usb registration from type registration Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 03/22] qdev: make DeviceInfo private Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 04/22] qdev: remove info from class Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 05/22] qdev: allow classes to overload qdev functions Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 06/22] qdev: refactor device creation to allow bus_info to be set only in class Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 07/22] qom: allow object_class_foreach to take additional parameters to refine search Anthony Liguori
2012-02-01 20:58   ` Andreas Färber
2012-02-01 19:50 ` [Qemu-devel] [PATCH 08/22] qdev: kill off DeviceInfo list Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 09/22] qdev: register all types natively through QEMU Object Model Anthony Liguori
2012-02-02  0:07   ` Andreas Färber [this message]
2012-02-01 19:50 ` [Qemu-devel] [PATCH 10/22] qdev: kill off DeviceInfo Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 11/22] qdev: remove baked in notion of aliases (v2) Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 12/22] qom: add new command to search for types Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 13/22] qdev: split out common init to instance_init Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 14/22] qdev: refactor away qdev_create_from_info Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 15/22] qdev: split out UI portions into a new function Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 16/22] qdev: nuke qdev_init_chardev() Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 17/22] qom: move properties from qdev to object Anthony Liguori
2012-02-01 19:50 ` [Qemu-devel] [PATCH 18/22] qom: accept any compatible type when setting a link property Anthony Liguori
2012-02-01 19:51 ` [Qemu-devel] [PATCH 19/22] qdev: implement cleanup logic in finalize Anthony Liguori
2012-02-01 19:51 ` [Qemu-devel] [PATCH 20/22] info qdm: do not require a parent_bus to be set Anthony Liguori
2012-02-01 19:51 ` [Qemu-devel] [PATCH 21/22] object: sure up reference counting Anthony Liguori
2012-02-01 19:51 ` [Qemu-devel] [PATCH 22/22] container: make a decendent of Object Anthony Liguori
2012-02-03 17:20 ` [Qemu-devel] [PATCH 00/22] qom: use Type system to register all devices (v2) Anthony Liguori

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=4F29D3C1.9090902@suse.de \
    --to=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).