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/ds1338.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'hw/ds1338.c') diff --git a/hw/ds1338.c b/hw/ds1338.c index 1c4ba9fcd0..4e09efe123 100644 --- a/hw/ds1338.c +++ b/hw/ds1338.c @@ -118,13 +118,20 @@ static int ds1338_init(I2CSlave *i2c) return 0; } -static I2CSlaveInfo ds1338_info = { - .qdev.name = "ds1338", - .qdev.size = sizeof(DS1338State), - .init = ds1338_init, - .event = ds1338_event, - .recv = ds1338_recv, - .send = ds1338_send, +static void ds1338_class_init(ObjectClass *klass, void *data) +{ + I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); + + k->init = ds1338_init; + k->event = ds1338_event; + k->recv = ds1338_recv; + k->send = ds1338_send; +} + +static DeviceInfo ds1338_info = { + .name = "ds1338", + .size = sizeof(DS1338State), + .class_init = ds1338_class_init, }; static void ds1338_register_devices(void) -- cgit v1.2.3