qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v3 058/197] fixup type registration


From: Anthony Liguori
Subject: [Qemu-devel] [PATCH v3 058/197] fixup type registration
Date: Mon, 12 Dec 2011 14:18:54 -0600

---
 hw/i2c.c   |    9 +++++++--
 hw/i2c.h   |    1 +
 hw/smbus.c |    2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/hw/i2c.c b/hw/i2c.c
index cdf88f2..fcb7269 100644
--- a/hw/i2c.c
+++ b/hw/i2c.c
@@ -177,12 +177,17 @@ static int i2c_slave_qdev_init(DeviceState *dev, 
DeviceInfo *base)
     return info->init(s);
 }
 
-void i2c_register_slave(I2CSlaveInfo *info)
+void i2c_register_slave_subclass(I2CSlaveInfo *info, const char *parent)
 {
     assert(info->qdev.size >= sizeof(I2CSlave));
     info->qdev.init = i2c_slave_qdev_init;
     info->qdev.bus_info = &i2c_bus_info;
-    qdev_register(&info->qdev);
+    qdev_register_subclass(&info->qdev, parent);
+}
+
+void i2c_register_slave(I2CSlaveInfo *info)
+{
+    i2c_register_slave_subclass(info, TYPE_I2C_SLAVE);
 }
 
 DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr)
diff --git a/hw/i2c.h b/hw/i2c.h
index cc4d76b..0c6f2ac 100644
--- a/hw/i2c.h
+++ b/hw/i2c.h
@@ -71,6 +71,7 @@ int i2c_recv(i2c_bus *bus);
 #define FROM_I2C_SLAVE(type, dev) DO_UPCAST(type, i2c, dev)
 
 void i2c_register_slave(I2CSlaveInfo *type);
+void i2c_register_slave_subclass(I2CSlaveInfo *info, const char *parent);
 
 DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr);
 
diff --git a/hw/smbus.c b/hw/smbus.c
index a75d404..2711229 100644
--- a/hw/smbus.c
+++ b/hw/smbus.c
@@ -213,7 +213,7 @@ void smbus_register_device(SMBusDeviceInfo *info)
     info->i2c.event = smbus_i2c_event;
     info->i2c.recv = smbus_i2c_recv;
     info->i2c.send = smbus_i2c_send;
-    i2c_register_slave(&info->i2c);
+    i2c_register_slave_subclass(&info->i2c, TYPE_SMBUS_DEVICE);
 }
 
 /* Master device commands.  */
-- 
1.7.4.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]