Skip to contentSkip to conversation

usb-bsd: convert to QOM

PATCH In review Anthony Liguori 3 participants 5 messages Feb 3, 2012 – Feb 4, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb-bsd: convert to QOM

Untested but simple enough.

---
 usb-bsd.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
usb-bsd.c +6 -5
index 2c6afc8..43fd1a1 100644
@@ -410,15 +410,16 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_host_handle_destroy;
 }
 
-static struct DeviceInfo usb_host_dev_info = {
-    .name      = "usb-host",
-    .size      = sizeof(USBHostDevice),
-    .class_init= usb_host_initfn,
+static TypeInfo usb_host_dev_info = {
+    .name          = "usb-host",
+    .parent        = TYPE_USB_DEVICE,
+    .instance_size = sizeof(USBHostDevice),
+    .class_init    = usb_host_initfn,
 };
 
 static void usb_host_register_devices(void)
 {
-    usb_qdev_register(&usb_host_dev_info, NULL, NULL);
+    type_register_static(&usb_host_dev_info);
 }
 device_init(usb_host_register_devices)
 
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 3 lines · Anthony Liguori

Untested but simple enough.

There are still some problems, though build does not fail anymore:
CC usb-bsd.o
/src/qemu/usb-bsd.c:417: warning: initialization from incompatible pointer type /src/qemu/usb-bsd.c:401: warning: 'usb_host_class_initfn' defined but not used

Quoted 34 lines

---
 usb-bsd.c |   11 ++++++-----

 1 files changed, 6 insertions(+), 5 deletions(-)
usb-bsd.c +6 -6
index 2c6afc8..43fd1a1 100644
@@ -410,15 +410,16 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_host_handle_destroy;
  }
 
-static struct DeviceInfo usb_host_dev_info = {
-    .name      = "usb-host",
-    .size      = sizeof(USBHostDevice),
-    .class_init= usb_host_initfn,
+static TypeInfo usb_host_dev_info = {
+    .name          = "usb-host",
+    .parent        = TYPE_USB_DEVICE,
+    .instance_size = sizeof(USBHostDevice),
+    .class_init    = usb_host_initfn,
  };
 
  static void usb_host_register_devices(void)
  {
-    usb_qdev_register(&usb_host_dev_info, NULL, NULL);
+    type_register_static(&usb_host_dev_info);
  }
  device_init(usb_host_register_devices)
 
--

1.7.4.1

#2 lore raw
Quoted 22 lines · Blue Swirl
Quoted 3 lines · Anthony Liguori

Untested but simple enough.

There are still some problems, though build does not fail anymore:
CC usb-bsd.o
/src/qemu/usb-bsd.c:417: warning: initialization from incompatible pointer type /src/qemu/usb-bsd.c:401: warning: 'usb_host_class_initfn' defined but not used

Quoted 12 lines
---
  usb-bsd.c |   11 ++++++-----
  1 files changed, 6 insertions(+), 5 deletions(-)
usb-bsd.c +0 -0
index 2c6afc8..43fd1a1 100644
@@ -410,15 +410,16 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
     uc->handle_destroy = usb_host_handle_destroy;
  }
 
Quoted 9 lines

usb-bsd.c static void usb_host_class_initfn(ObjectClass *klass, void *data) · line 417

Quoted 9 lines
usb-bsd.c +5 -4
-static struct DeviceInfo usb_host_dev_info = {
-    .name      = "usb-host",
-    .size      = sizeof(USBHostDevice),
-    .class_init= usb_host_initfn,
+static TypeInfo usb_host_dev_info = {
+    .name          = "usb-host",
+    .parent        = TYPE_USB_DEVICE,
+    .instance_size = sizeof(USBHostDevice),
+    .class_init    = usb_host_initfn,

That's a typo. It should be usb_host_class_initfn.

We don't do -Werror on BSD which is a I guess why the build wasn't failing before.

Can you make the change and commit? I can also provide another patch if you'd prefer that approach.

Regards,

Anthony Liguori

Quoted 14 lines
Quoted 13 lines
usb-bsd.c +1 -2
  };
 
  static void usb_host_register_devices(void)
  {
-    usb_qdev_register(&usb_host_dev_info, NULL, NULL);
+    type_register_static(&usb_host_dev_info);
  }
  device_init(usb_host_register_devices)
 
--

1.7.4.1

#3 lore raw
Quoted 42 lines · Anthony Liguori
Quoted 28 lines · Blue Swirl
Quoted 4 lines · Anthony Liguori

Untested but simple enough.

There are still some problems, though build does not fail anymore:
  CC    usb-bsd.o
/src/qemu/usb-bsd.c:417: warning: initialization from incompatible pointer type
/src/qemu/usb-bsd.c:401: warning: 'usb_host_class_initfn' defined but not used

Quoted 13 lines

---
 usb-bsd.c |   11 ++++++-----

 1 files changed, 6 insertions(+), 5 deletions(-)
usb-bsd.c +0 -0
index 2c6afc8..43fd1a1 100644
@@ -410,15 +410,16 @@ static void usb_host_class_initfn(ObjectClass
 *klass, void *data)
     uc->handle_destroy = usb_host_handle_destroy;
  }
 
Quoted 9 lines

usb-bsd.c static void usb_host_class_initfn(ObjectClass *klass, void *data) · line 417

Quoted 9 lines
usb-bsd.c +5 -4
-static struct DeviceInfo usb_host_dev_info = {
-    .name      = "usb-host",
-    .size      = sizeof(USBHostDevice),
-    .class_init= usb_host_initfn,
+static TypeInfo usb_host_dev_info = {
+    .name          = "usb-host",
+    .parent        = TYPE_USB_DEVICE,
+    .instance_size = sizeof(USBHostDevice),
+    .class_init    = usb_host_initfn,

That's a typo.  It should be usb_host_class_initfn.

Quoted 5 lines

We don't do -Werror on BSD which is a I guess why the build wasn't failing before.

Can you make the change and commit?  I can also provide another patch if you'd prefer that approach.

OK, fixed and pushed.

Quoted 20 lines

Regards,

Anthony Liguori

Quoted 14 lines
Quoted 13 lines
usb-bsd.c +1 -2
  };
 
  static void usb_host_register_devices(void)
  {
-    usb_qdev_register(&usb_host_dev_info, NULL, NULL);
+    type_register_static(&usb_host_dev_info);
  }
  device_init(usb_host_register_devices)
 
--

1.7.4.1

#4 lore raw
Quoted 43 lines · Blue Swirl
Quoted 42 lines · Anthony Liguori
Quoted 28 lines · Blue Swirl
Quoted 4 lines · Anthony Liguori

Untested but simple enough.

There are still some problems, though build does not fail anymore:
  CC    usb-bsd.o
/src/qemu/usb-bsd.c:417: warning: initialization from incompatible pointer type
/src/qemu/usb-bsd.c:401: warning: 'usb_host_class_initfn' defined but not used

Quoted 13 lines

---
 usb-bsd.c |   11 ++++++-----

 1 files changed, 6 insertions(+), 5 deletions(-)
usb-bsd.c +0 -0
index 2c6afc8..43fd1a1 100644
@@ -410,15 +410,16 @@ static void usb_host_class_initfn(ObjectClass
 *klass, void *data)
     uc->handle_destroy = usb_host_handle_destroy;
  }
 
Quoted 9 lines

usb-bsd.c static void usb_host_class_initfn(ObjectClass *klass, void *data) · line 417

Quoted 9 lines
usb-bsd.c +5 -4
-static struct DeviceInfo usb_host_dev_info = {
-    .name      = "usb-host",
-    .size      = sizeof(USBHostDevice),
-    .class_init= usb_host_initfn,
+static TypeInfo usb_host_dev_info = {
+    .name          = "usb-host",
+    .parent        = TYPE_USB_DEVICE,
+    .instance_size = sizeof(USBHostDevice),
+    .class_init    = usb_host_initfn,

That's a typo.  It should be usb_host_class_initfn.

Quoted 7 lines
Quoted 5 lines

We don't do -Werror on BSD which is a I guess why the build wasn't failing before.

Can you make the change and commit?  I can also provide another patch if you'd prefer that approach.

OK, fixed and pushed.

Except I forgot to 'git add' before 'git commit --amend'. Pushed the fix instead.

Quoted 20 lines
Quoted 20 lines

Regards,

Anthony Liguori

Quoted 14 lines
Quoted 13 lines
usb-bsd.c +1 -2
  };
 
  static void usb_host_register_devices(void)
  {
-    usb_qdev_register(&usb_host_dev_info, NULL, NULL);
+    type_register_static(&usb_host_dev_info);
  }
  device_init(usb_host_register_devices)
 
--

1.7.4.1