Skip to content

Commit

Permalink
sga: QOM'ify
Browse files Browse the repository at this point in the history
Introduce type constant and cast macro.

Prepares for ISA realizefn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
afaerber committed Apr 22, 2013
1 parent a50b4c0 commit d652d78
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions hw/misc/sga.c
Expand Up @@ -31,15 +31,19 @@

#define SGABIOS_FILENAME "sgabios.bin"

typedef struct ISAGAState {
ISADevice dev;
#define TYPE_SGA "sga"
#define SGA(obj) OBJECT_CHECK(ISASGAState, (obj), TYPE_SGA)

typedef struct ISASGAState {
ISADevice parent_obj;
} ISASGAState;

static int sga_initfn(ISADevice *dev)
{
rom_add_vga(SGABIOS_FILENAME);
return 0;
}

static void sga_class_initfn(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
Expand All @@ -49,7 +53,7 @@ static void sga_class_initfn(ObjectClass *klass, void *data)
}

static const TypeInfo sga_info = {
.name = "sga",
.name = TYPE_SGA,
.parent = TYPE_ISA_DEVICE,
.instance_size = sizeof(ISASGAState),
.class_init = sga_class_initfn,
Expand Down

0 comments on commit d652d78

Please sign in to comment.