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/max7310.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'hw/max7310.c') diff --git a/hw/max7310.c b/hw/max7310.c index a955236..0cc3219 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) -- cgit v1.1