diff mbox series

[3/9] hw/i2c/bitbang_i2c: Convert TYPE_GPIO_I2C from SysBus to QDev

Message ID 20230109092617.80224-4-philmd@linaro.org
State New
Headers show
Series hw: Convert simple devices from SysBus to QDev | expand

Commit Message

Philippe Mathieu-Daudé Jan. 9, 2023, 9:26 a.m. UTC
Nothing in TYPE_GPIO_I2C access the SysBus API,
convert it to a plain QDev.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/arm/musicpal.c    | 2 +-
 hw/i2c/bitbang_i2c.c | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 23359a6ac3..13f4dbdbc3 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -1297,7 +1297,7 @@  static void musicpal_init(MachineState *machine)
 
     dev = sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE,
                                qdev_get_gpio_in(pic, MP_GPIO_IRQ));
-    i2c_dev = sysbus_create_simple(TYPE_GPIO_I2C, -1, NULL);
+    i2c_dev = qdev_create_simple(TYPE_GPIO_I2C, &error_fatal);
     i2c = (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c");
 
     lcd_dev = sysbus_create_simple(TYPE_MUSICPAL_LCD, MP_LCD_BASE, NULL);
diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
index ffc5b95410..58503f2b27 100644
--- a/hw/i2c/bitbang_i2c.c
+++ b/hw/i2c/bitbang_i2c.c
@@ -13,7 +13,6 @@ 
 #include "qemu/osdep.h"
 #include "hw/irq.h"
 #include "hw/i2c/bitbang_i2c.h"
-#include "hw/sysbus.h"
 #include "qemu/module.h"
 #include "qom/object.h"
 #include "trace.h"
@@ -191,7 +190,7 @@  OBJECT_DECLARE_SIMPLE_TYPE(GPIOI2CState, GPIO_I2C)
 
 struct GPIOI2CState {
     /*< private >*/
-    SysBusDevice parent_obj;
+    DeviceState parent_obj;
     /*< public >*/
 
     bitbang_i2c_interface bitbang;
@@ -233,7 +232,7 @@  static void gpio_i2c_class_init(ObjectClass *klass, void *data)
 
 static const TypeInfo gpio_i2c_info = {
     .name          = TYPE_GPIO_I2C,
-    .parent        = TYPE_SYS_BUS_DEVICE,
+    .parent        = TYPE_DEVICE,
     .instance_size = sizeof(GPIOI2CState),
     .instance_init = gpio_i2c_init,
     .class_init    = gpio_i2c_class_init,