Il 09/04/2013 19:28, Andreas Färber ha scritto: >> -int Adlib_init (ISABus *bus) >> +static int Adlib_initfn (ISADevice *dev) > > Hm, obviously that conflicts with my series converting ISADevices to QOM > realize that I was hoping to still get into 1.5... Just put this patch in front of your series (I attach an updated version). The patch will just disappear at the next rebase for whoever submits last. Paolo >> { >> - AdlibState *s = &glob_adlib; >> + AdlibState *s; >> struct audsettings as; >> >> + if (glob_adlib) { >> + dolog ("Cannot create more than 1 adlib device\n"); >> + return -1; >> + } >> + s = DO_UPCAST (AdlibState, dev, dev); > > No new DO_UPCAST() for QOM objects please! > >> + glob_adlib = s; >> + >> #ifdef HAS_YMF262 >> - if (YMF262Init (1, 14318180, conf.freq)) { >> - dolog ("YMF262Init %d failed\n", conf.freq); >> + if (YMF262Init (1, 14318180, s->freq)) { >> + dolog ("YMF262Init %d failed\n", s->freq); >> return -1; >> } >> else { >> @@ -290,9 +301,9 @@ int Adlib_init (ISABus *bus) >> s->enabled = 1; >> } >> #else >> - s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, conf.freq); >> + s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, s->freq); >> if (!s->opl) { >> - dolog ("OPLCreate %d failed\n", conf.freq); >> + dolog ("OPLCreate %d failed\n", s->freq); >> return -1; >> } >> else { >> @@ -301,7 +312,7 @@ int Adlib_init (ISABus *bus) >> } >> #endif >> >> - as.freq = conf.freq; >> + as.freq = s->freq; >> as.nchannels = SHIFT; >> as.fmt = AUD_FMT_S16; >> as.endianness = AUDIO_HOST_ENDIANNESS; >> @@ -327,11 +338,46 @@ int Adlib_init (ISABus *bus) >> register_ioport_read (0x388, 4, 1, adlib_read, s); >> register_ioport_write (0x388, 4, 1, adlib_write, s); >> >> - register_ioport_read (conf.port, 4, 1, adlib_read, s); >> - register_ioport_write (conf.port, 4, 1, adlib_write, s); >> + register_ioport_read (s->port, 4, 1, adlib_read, s); >> + register_ioport_write (s->port, 4, 1, adlib_write, s); >> >> - register_ioport_read (conf.port + 8, 2, 1, adlib_read, s); >> - register_ioport_write (conf.port + 8, 2, 1, adlib_write, s); >> + register_ioport_read (s->port + 8, 2, 1, adlib_read, s); >> + register_ioport_write (s->port + 8, 2, 1, adlib_write, s); >> >> return 0; >> } >> + >> +static Property adlib_properties[] = { >> + DEFINE_PROP_HEX32 ("iobase", AdlibState, port, 0x220), >> + DEFINE_PROP_UINT32 ("freq", AdlibState, freq, 44100), >> + DEFINE_PROP_END_OF_LIST (), >> +}; >> + >> +static void adlib_class_initfn (ObjectClass *klass, void *data) >> +{ >> + DeviceClass *dc = DEVICE_CLASS (klass); >> + ISADeviceClass *ic = ISA_DEVICE_CLASS (klass); >> + ic->init = Adlib_initfn; >> + dc->desc = ADLIB_DESC; >> + dc->props = adlib_properties; >> +} >> + >> +static TypeInfo adlib_info = { > > static const please. > >> + .name = "adlib", >> + .parent = TYPE_ISA_DEVICE, >> + .instance_size = sizeof (AdlibState), >> + .class_init = adlib_class_initfn, >> +}; >> + >> +int Adlib_init (ISABus *bus) >> +{ >> + isa_create_simple (bus, "adlib"); >> + return 0; >> +} >> + >> +static void adlib_register_types (void) >> +{ >> + type_register_static (&adlib_info); >> +} >> + >> +type_init (adlib_register_types) > > Andreas >