qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: peter.maydell@linaro.org,
	Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	qemu-devel@nongnu.org, Anthony Liguori <aliguori@amazon.com>
Subject: Re: [Qemu-devel] [PATCH arm-devs v4 4/4] cpu/a9mpcore: Add Global Timer
Date: Mon, 02 Dec 2013 14:56:15 +0100	[thread overview]
Message-ID: <529C917F.4030801@suse.de> (raw)
In-Reply-To: <529C8977.4030808@redhat.com>

Am 02.12.2013 14:21, schrieb Paolo Bonzini:
> Il 02/12/2013 14:08, Andreas Färber ha scritto:
>>>> +    object_initialize(&s->gtimer, sizeof(s->gtimer), TYPE_A9_GTIMER);
>>>> +    qdev_set_parent_bus(DEVICE(&s->gtimer), sysbus_get_default());
>>>> +
>>>>      object_initialize(&s->mptimer, sizeof(s->mptimer), TYPE_ARM_MPTIMER);
>>>>      qdev_set_parent_bus(DEVICE(&s->mptimer), sysbus_get_default());
>>>>  
>> This code resulted from inlining qdev_create() and switching to in-place
>> instantiation.
>>
>> Seeing this repetitive code again and again makes me wonder whether we
>> can just set a SysBusDevice's parent_bus in its instance_init function
>> to simplify it?
> 
> Could we do it instead in the init function, only if parent_bus is still
> NULL?

I'll interpret that as realize function. ;)

Apart from assuming that no sysbus_*() or qdev_*() API depends on the
bus being non-NULL, converted SysBusDevices have started to assume that
SysBusDevice itself has no realize implementation. (At the time, we'd
have needed to know what it does to determine when to call parent_*.)
It would also make SysBusDevices differ from all others, which I find
not so nice.

Most devices will be instantiated with qdev_create(NULL, ...), so it may
be feasible to just drop the NULL -> sysbus_get_default() conversion
there and for device_add(), leaving only 14 occurrences to convert in
qemu.git. :)

Andreas

-- 
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:[~2013-12-02 13:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02  7:34 [Qemu-devel] [PATCH arm-devs v4 0/4] A9 global timer + mpcore trivials Peter Crosthwaite
2013-12-02  7:35 ` [Qemu-devel] [PATCH arm-devs v4 1/4] cpu/a9mpcore: rename timerbusdev variable Peter Crosthwaite
2013-12-02  7:36 ` [Qemu-devel] [PATCH arm-devs v4 2/4] cpu/a9mpcore: reorder operations/declarations Peter Crosthwaite
2013-12-02  7:36 ` [Qemu-devel] [PATCH arm-devs v4 3/4] hw/timer: Introduce ARM A9 Global Timer Peter Crosthwaite
2013-12-02 12:28   ` Andreas Färber
2013-12-02 12:36     ` Peter Maydell
2013-12-02 12:59       ` Markus Armbruster
2013-12-02 13:05     ` Peter Maydell
2013-12-02  7:37 ` [Qemu-devel] [PATCH arm-devs v4 4/4] cpu/a9mpcore: Add " Peter Crosthwaite
2013-12-02 13:08   ` Andreas Färber
2013-12-02 13:21     ` Paolo Bonzini
2013-12-02 13:56       ` Andreas Färber [this message]
2013-12-02 11:58 ` [Qemu-devel] [PATCH arm-devs v4 0/4] A9 global timer + mpcore trivials Peter Maydell

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=529C917F.4030801@suse.de \
    --to=afaerber@suse.de \
    --cc=aliguori@amazon.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.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).