Commit 6806e59567ab7f6bda3e369468518089a8822b57

Authored by Gerd Hoffmann
Committed by Paul Brook
1 parent 16eaedf2

qdev: convert es1370.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Showing 1 changed file with 22 additions and 19 deletions
hw/es1370.c
... ... @@ -1005,27 +1005,12 @@ static void es1370_on_reset (void *opaque)
1005 1005 es1370_reset (s);
1006 1006 }
1007 1007  
1008   -int es1370_init (PCIBus *bus)
  1008 +static void es1370_initfn(PCIDevice *dev)
1009 1009 {
1010   - PCIES1370State *d;
1011   - ES1370State *s;
1012   - uint8_t *c;
1013   -
1014   - if (!bus) {
1015   - dolog ("No PCI bus\n");
1016   - return -1;
1017   - }
1018   -
1019   - d = (PCIES1370State *) pci_register_device (bus, "ES1370",
1020   - sizeof (PCIES1370State),
1021   - -1, NULL, NULL);
1022   -
1023   - if (!d) {
1024   - AUD_log (NULL, "Failed to register PCI device for ES1370\n");
1025   - return -1;
1026   - }
  1010 + PCIES1370State *d = DO_UPCAST(PCIES1370State, dev, dev);
  1011 + ES1370State *s = &d->es1370;
  1012 + uint8_t *c = d->dev.config;
1027 1013  
1028   - c = d->dev.config;
1029 1014 pci_config_set_vendor_id (c, PCI_VENDOR_ID_ENSONIQ);
1030 1015 pci_config_set_device_id (c, PCI_DEVICE_ID_ENSONIQ_ES1370);
1031 1016 c[0x07] = 2 << 1;
... ... @@ -1059,5 +1044,23 @@ int es1370_init (PCIBus *bus)
1059 1044  
1060 1045 AUD_register_card ("es1370", &s->card);
1061 1046 es1370_reset (s);
  1047 +}
  1048 +
  1049 +int es1370_init (PCIBus *bus)
  1050 +{
  1051 + pci_create_simple(bus, -1, "ES1370");
1062 1052 return 0;
1063 1053 }
  1054 +
  1055 +static PCIDeviceInfo es1370_info = {
  1056 + .qdev.name = "ES1370",
  1057 + .qdev.size = sizeof(PCIES1370State),
  1058 + .init = es1370_initfn,
  1059 +};
  1060 +
  1061 +static void es1370_register(void)
  1062 +{
  1063 + pci_qdev_register(&es1370_info);
  1064 +}
  1065 +device_init(es1370_register);
  1066 +
... ...