All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhou Yuan" <zhouyuan.fnst@cn.fujitsu.com>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH] hw/i2c/core.c: add the id property of i2c_slaver when created in the QEMUMachine's initialization
Date: Fri, 15 Nov 2013 17:01:38 +0800	[thread overview]
Message-ID: <201311151701366579617@cn.fujitsu.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 2223 bytes --]

From: zhouy <zhouyuan.fnst@cn.fujitsu.com>
Date: Fri, 15 Nov 2013 15:50:52 -0500
Subject: [PATCH] add the id property of i2c_slaver when created in the
 QEMUMachine's initialization

Signed-off-by: zhouy <zhouyuan.fnst@cn.fujitsu.com>
---
 qemu-master/hw/i2c/core.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/qemu-master/hw/i2c/core.c b/qemu-master/hw/i2c/core.c
index c97e7f7..ea3e59d 100644
--- a/qemu-master/hw/i2c/core.c
+++ b/qemu-master/hw/i2c/core.c
@@ -213,10 +213,16 @@ static int i2c_slave_qdev_init(DeviceState *dev)
 DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr)
 {
     DeviceState *dev;
-
+    static unsigned int seq_num;
+    char *id = g_malloc0(20);
+    snprintf(id, 20, "%s-%d", name, seq_num);
     dev = qdev_create(&bus->qbus, name);
     qdev_prop_set_uint8(dev, "address", addr);
+    dev->id = id;
+    object_property_add_child(container_get(qdev_get_machine(), "/peripheral"),
+                              dev->id, OBJECT(dev), NULL);
     qdev_init_nofail(dev);
+    seq_num++;
     return dev;
 }
 
-- 
1.7.6

ÒÔÉÏ¡¢¤è¤í¤·¤¯¤ªîФ¤¤¤¤¿¤·¤Þ¤¹¡£    
--------------
A new email address of FJWAN is launched from Apr.1 2007.
The updated address is: zhouyuan.fnst@cn.fujitsu.com 
--------------------------------------------------
Zhou Yuan
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
No. 6 Wenzhu Road, Nanjing, 210012, China
TEL£º+86+25-86630566-9555
FUJITSU INTERNAL£º7998-9555
FAX£º+86+25-83317685
EMail£ºzhouyuan.fnst@cn.fujitsu.com
--------------------------------------------------
This communication is for use by the intended recipient(s) only and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not an intended recipient of this communication, you are hereby notified that any dissemination, distribution or copying hereof is strictly prohibited.  If you have received this communication in error, please notify me by reply e-mail, permanently delete this communication from your system, and destroy any hard copies you may have printed.
 
zhouyuan.fnst@cn.fujitsu.com
16:54:53
qemu-devel

             reply	other threads:[~2013-11-15  9:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-15  9:01 Zhou Yuan [this message]
2013-11-15  9:28 ` [Qemu-devel] [PATCH] hw/i2c/core.c: add the id property of i2c_slaver when created in the QEMUMachine's initialization Markus Armbruster

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=201311151701366579617@cn.fujitsu.com \
    --to=zhouyuan.fnst@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.