aboutsummaryrefslogtreecommitdiffstats
path: root/hw/max7310.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-04 20:39:20 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-01-27 10:50:47 -0600
commitb5ea932781954355a9880e2744722cd05cc496f9 (patch)
treef47482844578c1dffdae93dc3ec103a101097a71 /hw/max7310.c
parent9e07bdf816b186632cda9651ac29bba76d299c03 (diff)
i2c: smbus: convert to QEMU Object Model
This converts two types because smbus is implemented as a subclass of i2c. It's extremely difficult to convert these two independently. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/max7310.c')
-rw-r--r--hw/max7310.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/hw/max7310.c b/hw/max7310.c
index a955236cf..0cc3219e8 100644
--- a/hw/max7310.c
+++ b/hw/max7310.c
@@ -185,15 +185,22 @@ static int max7310_init(I2CSlave *i2c)
return 0;
}
-static I2CSlaveInfo max7310_info = {
- .qdev.name = "max7310",
- .qdev.size = sizeof(MAX7310State),
- .qdev.vmsd = &vmstate_max7310,
- .qdev.reset = max7310_reset,
- .init = max7310_init,
- .event = max7310_event,
- .recv = max7310_rx,
- .send = max7310_tx
+static void max7310_class_init(ObjectClass *klass, void *data)
+{
+ I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
+
+ k->init = max7310_init;
+ k->event = max7310_event;
+ k->recv = max7310_rx;
+ k->send = max7310_tx;
+}
+
+static DeviceInfo max7310_info = {
+ .name = "max7310",
+ .size = sizeof(MAX7310State),
+ .vmsd = &vmstate_max7310,
+ .reset = max7310_reset,
+ .class_init = max7310_class_init,
};
static void max7310_register_devices(void)