From: Markus Armbruster <armbru@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/8] qdev/pci: add pci_create_noinit()
Date: Fri, 11 Sep 2009 16:14:31 +0200 [thread overview]
Message-ID: <87ws45d0vs.fsf@pike.pond.sub.org> (raw)
In-Reply-To: <1252672351-12937-2-git-send-email-kraxel@redhat.com> (Gerd Hoffmann's message of "Fri\, 11 Sep 2009 14\:32\:24 +0200")
Gerd Hoffmann <kraxel@redhat.com> writes:
> Like pci_create_simple() but doesn't call qdev_init(), so one can
> set properties before initializing the device.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> hw/pci.c | 11 ++++++++---
> hw/pci.h | 1 +
> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/hw/pci.c b/hw/pci.c
> index c12b0be..64d70ed 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -923,15 +923,20 @@ void pci_qdev_register_many(PCIDeviceInfo *info)
> }
> }
>
> -PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
> +PCIDevice *pci_create_noinit(PCIBus *bus, int devfn, const char *name)
> {
> DeviceState *dev;
>
> dev = qdev_create(&bus->qbus, name);
> qdev_prop_set_uint32(dev, "addr", devfn);
> - qdev_init(dev);
> + return DO_UPCAST(PCIDevice, qdev, dev);
> +}
Okay, this is qdev_create() specialized for PCI. What about calling it
just pci_create()?
>
> - return (PCIDevice *)dev;
> +PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
> +{
> + PCIDevice *dev = pci_create_noinit(bus, devfn, name);
> + qdev_init(&dev->qdev);
> + return dev;
> }
>
> static int pci_find_space(PCIDevice *pdev, uint8_t size)
> diff --git a/hw/pci.h b/hw/pci.h
> index 6196b6a..e7bf33a 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -328,6 +328,7 @@ void pci_qdev_register(PCIDeviceInfo *info);
> void pci_qdev_register_many(PCIDeviceInfo *info);
>
> PCIDevice *pci_create(const char *name, const char *devaddr);
> +PCIDevice *pci_create_noinit(PCIBus *bus, int devfn, const char *name);
> PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name);
>
> /* lsi53c895a.c */
next prev parent reply other threads:[~2009-09-11 14:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-11 12:32 [Qemu-devel] [PATCH 0/8] ide: convert to qdev Gerd Hoffmann
2009-09-11 12:32 ` [Qemu-devel] [PATCH 1/8] qdev/pci: add pci_create_noinit() Gerd Hoffmann
2009-09-11 14:14 ` Markus Armbruster [this message]
2009-09-11 14:28 ` Gerd Hoffmann
2009-09-11 14:57 ` Markus Armbruster
2009-09-11 12:32 ` [Qemu-devel] [PATCH 2/8] support media=cdrom for if=none Gerd Hoffmann
2009-09-11 12:32 ` [Qemu-devel] [PATCH 3/8] split away drive init from ide_init2() Gerd Hoffmann
2009-09-11 14:27 ` Markus Armbruster
2009-09-11 14:36 ` Gerd Hoffmann
2009-09-11 12:32 ` [Qemu-devel] [PATCH 4/8] ide/qdev: add ide bus Gerd Hoffmann
[not found] ` <m3fxat8u80.fsf@neno.mitica>
2009-09-11 14:10 ` [Qemu-devel] " Gerd Hoffmann
2009-09-11 14:54 ` [Qemu-devel] " Markus Armbruster
2009-09-11 15:01 ` Gerd Hoffmann
2009-09-11 12:32 ` [Qemu-devel] [PATCH 5/8] ide/pci: convert to qdev Gerd Hoffmann
[not found] ` <m3bplh8u13.fsf@neno.mitica>
2009-09-11 14:13 ` [Qemu-devel] " Gerd Hoffmann
[not found] ` <m3my517dni.fsf@neno.mitica>
2009-09-11 14:58 ` Gerd Hoffmann
[not found] ` <m3y6ol5x64.fsf@neno.mitica>
2009-09-11 19:16 ` Gerd Hoffmann
[not found] ` <m3bplh2js1.fsf@neno.mitica>
2009-09-14 7:09 ` Gerd Hoffmann
2009-09-11 15:21 ` [Qemu-devel] " Markus Armbruster
2009-09-14 6:44 ` Gerd Hoffmann
2009-09-11 12:32 ` [Qemu-devel] [PATCH 6/8] ide/isa: " Gerd Hoffmann
2009-09-11 12:32 ` [Qemu-devel] [PATCH 7/8] isa: refine irq reservations Gerd Hoffmann
2009-09-11 12:32 ` [Qemu-devel] [PATCH 8/8] unbreak ppc/prep Gerd Hoffmann
2009-09-11 14:31 ` [Qemu-devel] Re: [PATCH 0/8] ide: convert to qdev Juan Quintela
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=87ws45d0vs.fsf@pike.pond.sub.org \
--to=armbru@redhat.com \
--cc=kraxel@redhat.com \
--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).