qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: stefano.stabellini@eu.citrix.com, jan.kiszka@siemens.com,
	allen.m.kay@intel.com, qemu-devel@nongnu.org,
	blauwirbel@gmail.com, kraxel@redhat.com, jean.guyader@gmail.com
Subject: [Qemu-devel] Re: [PATCH 02/10] qdev: export qdev_reset() for later use.
Date: Thu, 17 Jun 2010 13:05:55 +0300	[thread overview]
Message-ID: <20100617100555.GG7912@redhat.com> (raw)
In-Reply-To: <f0eb537874405963c93fb022e4a2b7e9b94ee9e8.1276755023.git.yamahata@valinux.co.jp>

On Thu, Jun 17, 2010 at 03:15:44PM +0900, Isaku Yamahata wrote:
> export qdev_reset() for later use.
> 
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> ---
>  hw/qdev.c |   13 +++++++++----
>  hw/qdev.h |    1 +
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/qdev.c b/hw/qdev.c
> index 61f999c..378f842 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -256,13 +256,18 @@ DeviceState *qdev_device_add(QemuOpts *opts)
>      return qdev;
>  }
>  
> -static void qdev_reset(void *opaque)
> +void qdev_reset(DeviceState *dev)

What does this API do? Yes, I see that it invokes
the reset callback internally. But what does it do
that the caller wants? After all, the callback
gets invoked on reset directly.


>  {
> -    DeviceState *dev = opaque;
>      if (dev->info->reset)
>          dev->info->reset(dev);
>  }
>  
> +static void qdev_reset_fn(void *opaque)
> +{
> +    DeviceState *dev = opaque;
> +    qdev_reset(dev);
> +}
> +
>  /* Initialize a device.  Device properties should be set before calling
>     this function.  IRQs and MMIO regions should be connected/mapped after
>     calling this function.
> @@ -278,7 +283,7 @@ int qdev_init(DeviceState *dev)
>          qdev_free(dev);
>          return rc;
>      }
> -    qemu_register_reset(qdev_reset, dev);
> +    qemu_register_reset(qdev_reset_fn, dev);
>      if (dev->info->vmsd) {
>          vmstate_register_with_alias_id(-1, dev->info->vmsd, dev,
>                                         dev->instance_id_alias,
> @@ -348,7 +353,7 @@ void qdev_free(DeviceState *dev)
>          if (dev->opts)
>              qemu_opts_del(dev->opts);
>      }
> -    qemu_unregister_reset(qdev_reset, dev);
> +    qemu_unregister_reset(qdev_reset_fn, dev);
>      QLIST_REMOVE(dev, sibling);
>      for (prop = dev->info->props; prop && prop->name; prop++) {
>          if (prop->info->free) {
> diff --git a/hw/qdev.h b/hw/qdev.h
> index be5ad67..5fbdebf 100644
> --- a/hw/qdev.h
> +++ b/hw/qdev.h
> @@ -113,6 +113,7 @@ typedef struct GlobalProperty {
>  DeviceState *qdev_create(BusState *bus, const char *name);
>  int qdev_device_help(QemuOpts *opts);
>  DeviceState *qdev_device_add(QemuOpts *opts);
> +void qdev_reset(DeviceState *dev);
>  int qdev_init(DeviceState *dev) QEMU_WARN_UNUSED_RESULT;
>  void qdev_init_nofail(DeviceState *dev);
>  void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
> -- 
> 1.6.6.1

  parent reply	other threads:[~2010-06-17 10:10 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-17  6:15 [Qemu-devel] [PATCH 00/10] pci: pci to pci bridge clean up and enhancement Isaku Yamahata
2010-06-17  6:15 ` [Qemu-devel] [PATCH 01/10] pci_bridge: split out pci bridge code into pci_bridge.c from pci.c Isaku Yamahata
2010-06-17  6:15 ` [Qemu-devel] [PATCH 02/10] qdev: export qdev_reset() for later use Isaku Yamahata
2010-06-17  7:01   ` Markus Armbruster
2010-06-17 10:05   ` Michael S. Tsirkin [this message]
2010-06-17  6:15 ` [Qemu-devel] [PATCH 03/10] pci: fix pci_bus_reset() with 64bit BAR and several clean ups Isaku Yamahata
2010-06-17 10:58   ` [Qemu-devel] " Michael S. Tsirkin
2010-06-17  6:15 ` [Qemu-devel] [PATCH 04/10] pci_bridge: introduce pci bridge layer Isaku Yamahata
2010-06-17  9:52   ` [Qemu-devel] " Michael S. Tsirkin
2010-06-17  6:15 ` [Qemu-devel] [PATCH 05/10] pci bridge: add helper function for ssvid capability Isaku Yamahata
2010-06-17 10:01   ` [Qemu-devel] " Michael S. Tsirkin
2010-06-17  6:15 ` [Qemu-devel] [PATCH 06/10] pci: eliminate work around in pci_device_reset() Isaku Yamahata
2010-06-17  6:15 ` [Qemu-devel] [PATCH 07/10] pci: fix pci domain registering Isaku Yamahata
2010-06-17  6:15 ` [Qemu-devel] [PATCH 08/10] pci: remove PCIDeviceInfo::header_type Isaku Yamahata
2010-06-17  6:15 ` [Qemu-devel] [PATCH 09/10] pci: set PCI multi-function bit appropriately Isaku Yamahata
2010-06-17  9:37   ` [Qemu-devel] " Michael S. Tsirkin
2010-06-18  2:40     ` Isaku Yamahata
2010-06-18 12:44       ` Michael S. Tsirkin
2010-06-18 13:38         ` Isaku Yamahata
2010-06-18 14:59           ` Michael S. Tsirkin
2010-06-18 15:22           ` Jamie Lokier
2010-06-20 10:03           ` Michael S. Tsirkin
2010-06-17  6:15 ` [Qemu-devel] [PATCH 10/10] pci: don't overwrite multi functio bit in pci header type Isaku Yamahata
2010-06-17  9:41   ` [Qemu-devel] " Michael S. Tsirkin
2010-06-17 10:02 ` [Qemu-devel] Re: [PATCH 00/10] pci: pci to pci bridge clean up and enhancement Michael S. Tsirkin
2010-06-17 11:57   ` Michael S. Tsirkin
2010-06-18  3:26     ` Isaku Yamahata
2010-06-18 12:46       ` Michael S. Tsirkin

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=20100617100555.GG7912@redhat.com \
    --to=mst@redhat.com \
    --cc=allen.m.kay@intel.com \
    --cc=blauwirbel@gmail.com \
    --cc=jan.kiszka@siemens.com \
    --cc=jean.guyader@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=yamahata@valinux.co.jp \
    /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).