qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: afaerber@suse.de, qemu-devel@nongnu.org
Cc: imammedo@redhat.com, peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH 02/10] qdev: remove qdev_prop_exists
Date: Wed, 23 May 2012 17:44:33 +0200	[thread overview]
Message-ID: <1337787881-3579-3-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1337787881-3579-1-git-send-email-pbonzini@redhat.com>

Can be replaced everywhere with object_property_find.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/qdev-properties.c  |    5 -----
 hw/qdev.c             |    2 +-
 hw/qdev.h             |    1 -
 hw/scsi-bus.c         |    2 +-
 include/qemu/object.h |    9 +++++++++
 qom/object.c          |    2 +-
 6 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index af68ca5..eeb950d 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -925,11 +925,6 @@ static Property *qdev_prop_find(DeviceState *dev, const char *name)
     return NULL;
 }
 
-int qdev_prop_exists(DeviceState *dev, const char *name)
-{
-    return qdev_prop_find(dev, name) ? true : false;
-}
-
 void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
                                     Property *prop, const char *value)
 {
diff --git a/hw/qdev.c b/hw/qdev.c
index b5efb16..fc1dfbf 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -323,7 +323,7 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd)
     if (nd->netdev)
         qdev_prop_set_netdev(dev, "netdev", nd->netdev);
     if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED &&
-        qdev_prop_exists(dev, "vectors")) {
+        object_property_find(OBJECT(dev), "vectors")) {
         qdev_prop_set_uint32(dev, "vectors", nd->nvectors);
     }
     nd->instantiated = 1;
diff --git a/hw/qdev.h b/hw/qdev.h
index 224875d..212ca24 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -299,7 +299,6 @@ extern PropertyInfo qdev_prop_blocksize;
 
 /* Set properties between creation and init.  */
 void *qdev_get_prop_ptr(DeviceState *dev, Property *prop);
-int qdev_prop_exists(DeviceState *dev, const char *name);
 int qdev_prop_parse(DeviceState *dev, const char *name, const char *value);
 void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value);
 void qdev_prop_set_uint8(DeviceState *dev, const char *name, uint8_t value);
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 2bb19e9..bdb3ca5 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -214,7 +214,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockDriverState *bdrv,
     if (bootindex >= 0) {
         qdev_prop_set_int32(dev, "bootindex", bootindex);
     }
-    if (qdev_prop_exists(dev, "removable")) {
+    if (object_property_find(OBJECT(dev), "removable")) {
         qdev_prop_set_bit(dev, "removable", removable);
     }
     if (qdev_prop_set_drive(dev, "drive", bdrv) < 0) {
diff --git a/include/qemu/object.h b/include/qemu/object.h
index 5fd2270..b7efc63 100644
--- a/include/qemu/object.h
+++ b/include/qemu/object.h
@@ -636,6 +636,15 @@ void object_property_add(Object *obj, const char *name, const char *type,
 
 void object_property_del(Object *obj, const char *name, struct Error **errp);
 
+/**
+ * object_property_find:
+ * @obj: the object
+ * @name: the name of the property
+ *
+ * Look up a property for an object and return its #ObjectProperty if found.
+ */
+ObjectProperty *object_property_find(Object *obj, const char *name);
+
 void object_unparent(Object *obj);
 
 /**
diff --git a/qom/object.c b/qom/object.c
index 4b410f1..13fd157 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -662,7 +662,7 @@ void object_property_add(Object *obj, const char *name, const char *type,
     QTAILQ_INSERT_TAIL(&obj->properties, prop, node);
 }
 
-static ObjectProperty *object_property_find(Object *obj, const char *name)
+ObjectProperty *object_property_find(Object *obj, const char *name)
 {
     ObjectProperty *prop;
 
-- 
1.7.10.1

  parent reply	other threads:[~2012-05-23 15:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-23 15:44 [Qemu-devel] [PATCH 00/10] push static properties to Object, add realized property Paolo Bonzini
2012-05-23 15:44 ` [Qemu-devel] [PATCH 01/10] qdev: remove PropertyInfo range checking Paolo Bonzini
2012-05-24 17:50   ` Andreas Färber
2012-05-23 15:44 ` Paolo Bonzini [this message]
2012-05-24 21:34   ` [Qemu-devel] [PATCH 02/10] qdev: remove qdev_prop_exists Andreas Färber
2012-05-25  7:20     ` Paolo Bonzini
2012-05-25 15:57   ` Andreas Färber
2012-05-23 15:44 ` [Qemu-devel] [PATCH 03/10] qom: push error reporting to object_property_find Paolo Bonzini
2012-05-25 16:05   ` Andreas Färber
2012-05-26  9:58     ` Paolo Bonzini
2012-05-26 22:04       ` Andreas Färber
2012-05-23 15:44 ` [Qemu-devel] [PATCH 04/10] qom: add get_id Paolo Bonzini
2012-05-25 16:33   ` Andreas Färber
2012-05-25 17:39     ` malc
2012-05-23 15:44 ` [Qemu-devel] [PATCH 05/10] qdev: push state up to Object Paolo Bonzini
2012-05-25 16:58   ` Andreas Färber
2012-05-23 15:44 ` [Qemu-devel] [PATCH 06/10] qdev: generalize properties to Objects Paolo Bonzini
2012-05-23 15:44 ` [Qemu-devel] [PATCH 07/10] qdev: move bulk of qdev-properties.c to qom/object.c Paolo Bonzini
2012-05-25 13:32   ` Andreas Färber
2012-05-25 13:36     ` Paolo Bonzini
2012-05-23 15:44 ` [Qemu-devel] [PATCH 08/10] qom: push static properties to Object Paolo Bonzini
2012-06-07 16:36   ` Andreas Färber
2012-05-23 15:44 ` [Qemu-devel] [PATCH 09/10] qom: add realized property Paolo Bonzini
2012-05-23 15:44 ` [Qemu-devel] [PATCH 10/10] qom: Add QERR_PROPERTY_SET_AFTER_REALIZE Paolo Bonzini

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=1337787881-3579-3-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=imammedo@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).