提交 e5944641 编写于 作者: J Juan Quintela 提交者: malc

es1370: Remove unused indirection of PCIES1370State and ES1370State

Signed-off-by: NJuan Quintela <quintela@redhat.com>
上级 2a1704a7
...@@ -266,8 +266,7 @@ struct chan { ...@@ -266,8 +266,7 @@ struct chan {
}; };
typedef struct ES1370State { typedef struct ES1370State {
PCIDevice *pci_dev; PCIDevice dev;
QEMUSoundCard card; QEMUSoundCard card;
struct chan chan[NB_CHANNELS]; struct chan chan[NB_CHANNELS];
SWVoiceOut *dac_voice[2]; SWVoiceOut *dac_voice[2];
...@@ -280,11 +279,6 @@ typedef struct ES1370State { ...@@ -280,11 +279,6 @@ typedef struct ES1370State {
uint32_t sctl; uint32_t sctl;
} ES1370State; } ES1370State;
typedef struct PCIES1370State {
PCIDevice dev;
ES1370State es1370;
} PCIES1370State;
struct chan_bits { struct chan_bits {
uint32_t ctl_en; uint32_t ctl_en;
uint32_t stat_int; uint32_t stat_int;
...@@ -327,7 +321,7 @@ static void es1370_update_status (ES1370State *s, uint32_t new_status) ...@@ -327,7 +321,7 @@ static void es1370_update_status (ES1370State *s, uint32_t new_status)
else { else {
s->status = new_status & ~STAT_INTR; s->status = new_status & ~STAT_INTR;
} }
qemu_set_irq (s->pci_dev->irq[0], !!level); qemu_set_irq (s->dev.irq[0], !!level);
} }
static void es1370_reset (ES1370State *s) static void es1370_reset (ES1370State *s)
...@@ -353,7 +347,7 @@ static void es1370_reset (ES1370State *s) ...@@ -353,7 +347,7 @@ static void es1370_reset (ES1370State *s)
s->dac_voice[i] = NULL; s->dac_voice[i] = NULL;
} }
} }
qemu_irq_lower (s->pci_dev->irq[0]); qemu_irq_lower (s->dev.irq[0]);
} }
static void es1370_maybe_lower_irq (ES1370State *s, uint32_t sctl) static void es1370_maybe_lower_irq (ES1370State *s, uint32_t sctl)
...@@ -915,8 +909,7 @@ static void es1370_adc_callback (void *opaque, int avail) ...@@ -915,8 +909,7 @@ static void es1370_adc_callback (void *opaque, int avail)
static void es1370_map (PCIDevice *pci_dev, int region_num, static void es1370_map (PCIDevice *pci_dev, int region_num,
uint32_t addr, uint32_t size, int type) uint32_t addr, uint32_t size, int type)
{ {
PCIES1370State *d = (PCIES1370State *) pci_dev; ES1370State *s = DO_UPCAST(ES1370State, dev, pci_dev);
ES1370State *s = &d->es1370;
(void) region_num; (void) region_num;
(void) size; (void) size;
...@@ -936,7 +929,7 @@ static void es1370_save (QEMUFile *f, void *opaque) ...@@ -936,7 +929,7 @@ static void es1370_save (QEMUFile *f, void *opaque)
ES1370State *s = opaque; ES1370State *s = opaque;
size_t i; size_t i;
pci_device_save (s->pci_dev, f); pci_device_save (&s->dev, f);
for (i = 0; i < NB_CHANNELS; ++i) { for (i = 0; i < NB_CHANNELS; ++i) {
struct chan *d = &s->chan[i]; struct chan *d = &s->chan[i];
qemu_put_be32s (f, &d->shift); qemu_put_be32s (f, &d->shift);
...@@ -962,7 +955,7 @@ static int es1370_load (QEMUFile *f, void *opaque, int version_id) ...@@ -962,7 +955,7 @@ static int es1370_load (QEMUFile *f, void *opaque, int version_id)
if (version_id != 2) if (version_id != 2)
return -EINVAL; return -EINVAL;
ret = pci_device_load (s->pci_dev, f); ret = pci_device_load (&s->dev, f);
if (ret) if (ret)
return ret; return ret;
...@@ -1007,9 +1000,8 @@ static void es1370_on_reset (void *opaque) ...@@ -1007,9 +1000,8 @@ static void es1370_on_reset (void *opaque)
static void es1370_initfn(PCIDevice *dev) static void es1370_initfn(PCIDevice *dev)
{ {
PCIES1370State *d = DO_UPCAST(PCIES1370State, dev, dev); ES1370State *s = DO_UPCAST(ES1370State, dev, dev);
ES1370State *s = &d->es1370; uint8_t *c = s->dev.config;
uint8_t *c = d->dev.config;
pci_config_set_vendor_id (c, PCI_VENDOR_ID_ENSONIQ); pci_config_set_vendor_id (c, PCI_VENDOR_ID_ENSONIQ);
pci_config_set_device_id (c, PCI_DEVICE_ID_ENSONIQ_ES1370); pci_config_set_device_id (c, PCI_DEVICE_ID_ENSONIQ_ES1370);
...@@ -1035,10 +1027,7 @@ static void es1370_initfn(PCIDevice *dev) ...@@ -1035,10 +1027,7 @@ static void es1370_initfn(PCIDevice *dev)
c[0x3e] = 0x0c; c[0x3e] = 0x0c;
c[0x3f] = 0x80; c[0x3f] = 0x80;
s = &d->es1370; pci_register_bar (&s->dev, 0, 256, PCI_ADDRESS_SPACE_IO, es1370_map);
s->pci_dev = &d->dev;
pci_register_bar (&d->dev, 0, 256, PCI_ADDRESS_SPACE_IO, es1370_map);
register_savevm ("es1370", 0, 2, es1370_save, es1370_load, s); register_savevm ("es1370", 0, 2, es1370_save, es1370_load, s);
qemu_register_reset (es1370_on_reset, s); qemu_register_reset (es1370_on_reset, s);
...@@ -1055,7 +1044,7 @@ int es1370_init (PCIBus *bus) ...@@ -1055,7 +1044,7 @@ int es1370_init (PCIBus *bus)
static PCIDeviceInfo es1370_info = { static PCIDeviceInfo es1370_info = {
.qdev.name = "ES1370", .qdev.name = "ES1370",
.qdev.desc = "ENSONIQ AudioPCI ES1370", .qdev.desc = "ENSONIQ AudioPCI ES1370",
.qdev.size = sizeof (PCIES1370State), .qdev.size = sizeof (ES1370State),
.init = es1370_initfn, .init = es1370_initfn,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册