diff mbox series

[21/24] vga-pci: Register "big-endian-framebuffer" as class property

Message ID 20200921221045.699690-22-ehabkost@redhat.com
State New, archived
Headers show
Series qom: Convert some properties to class properties | expand

Commit Message

Eduardo Habkost Sept. 21, 2020, 10:10 p.m. UTC
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
---
 hw/display/vga-pci.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Comments

Marc-André Lureau Oct. 8, 2020, 7 a.m. UTC | #1
On Tue, Sep 22, 2020 at 2:28 AM Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
>


Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  hw/display/vga-pci.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
> index 3b45fa3bad0..b2a7d03c5d5 100644
> --- a/hw/display/vga-pci.c
> +++ b/hw/display/vga-pci.c
> @@ -269,13 +269,6 @@ static void pci_std_vga_realize(PCIDevice *dev, Error
> **errp)
>      }
>  }
>
> -static void pci_std_vga_init(Object *obj)
> -{
> -    /* Expose framebuffer byteorder via QOM */
> -    object_property_add_bool(obj, "big-endian-framebuffer",
> -                             vga_get_big_endian_fb,
> vga_set_big_endian_fb);
> -}
> -
>  static void pci_secondary_vga_realize(PCIDevice *dev, Error **errp)
>  {
>      PCIVGAState *d = PCI_VGA(dev);
> @@ -388,6 +381,10 @@ static void vga_class_init(ObjectClass *klass, void
> *data)
>      k->class_id = PCI_CLASS_DISPLAY_VGA;
>      device_class_set_props(dc, vga_pci_properties);
>      dc->hotpluggable = false;
> +
> +    /* Expose framebuffer byteorder via QOM */
> +    object_class_property_add_bool(klass, "big-endian-framebuffer",
> +                                   vga_get_big_endian_fb,
> vga_set_big_endian_fb);
>  }
>
>  static void secondary_class_init(ObjectClass *klass, void *data)
> @@ -405,7 +402,6 @@ static void secondary_class_init(ObjectClass *klass,
> void *data)
>  static const TypeInfo vga_info = {
>      .name          = "VGA",
>      .parent        = TYPE_PCI_VGA,
> -    .instance_init = pci_std_vga_init,
>      .class_init    = vga_class_init,
>  };
>
> --
> 2.26.2
>
>
>
diff mbox series

Patch

diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index 3b45fa3bad0..b2a7d03c5d5 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -269,13 +269,6 @@  static void pci_std_vga_realize(PCIDevice *dev, Error **errp)
     }
 }
 
-static void pci_std_vga_init(Object *obj)
-{
-    /* Expose framebuffer byteorder via QOM */
-    object_property_add_bool(obj, "big-endian-framebuffer",
-                             vga_get_big_endian_fb, vga_set_big_endian_fb);
-}
-
 static void pci_secondary_vga_realize(PCIDevice *dev, Error **errp)
 {
     PCIVGAState *d = PCI_VGA(dev);
@@ -388,6 +381,10 @@  static void vga_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_DISPLAY_VGA;
     device_class_set_props(dc, vga_pci_properties);
     dc->hotpluggable = false;
+
+    /* Expose framebuffer byteorder via QOM */
+    object_class_property_add_bool(klass, "big-endian-framebuffer",
+                                   vga_get_big_endian_fb, vga_set_big_endian_fb);
 }
 
 static void secondary_class_init(ObjectClass *klass, void *data)
@@ -405,7 +402,6 @@  static void secondary_class_init(ObjectClass *klass, void *data)
 static const TypeInfo vga_info = {
     .name          = "VGA",
     .parent        = TYPE_PCI_VGA,
-    .instance_init = pci_std_vga_init,
     .class_init    = vga_class_init,
 };