From b5ea932781954355a9880e2744722cd05cc496f9 Mon Sep 17 00:00:00 2001 From: Anthony Liguori Date: Sun, 4 Dec 2011 20:39:20 -0600 Subject: 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 --- hw/tmp105.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'hw/tmp105.c') diff --git a/hw/tmp105.c b/hw/tmp105.c index ed8a0f3fc8..12fe60d019 100644 --- a/hw/tmp105.c +++ b/hw/tmp105.c @@ -226,14 +226,21 @@ static int tmp105_init(I2CSlave *i2c) return 0; } -static I2CSlaveInfo tmp105_info = { - .qdev.name = "tmp105", - .qdev.size = sizeof(TMP105State), - .qdev.vmsd = &vmstate_tmp105, - .init = tmp105_init, - .event = tmp105_event, - .recv = tmp105_rx, - .send = tmp105_tx +static void tmp105_class_init(ObjectClass *klass, void *data) +{ + I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); + + k->init = tmp105_init; + k->event = tmp105_event; + k->recv = tmp105_rx; + k->send = tmp105_tx; +} + +static DeviceInfo tmp105_info = { + .name = "tmp105", + .size = sizeof(TMP105State), + .vmsd = &vmstate_tmp105, + .class_init = tmp105_class_init, }; static void tmp105_register_devices(void) -- cgit v1.2.3