From efb56cf7c2e8c21d6c00a2f14b3e780bdba344a6 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Wed, 7 Oct 2009 18:19:40 +0200 Subject: [PATCH] pcnet: Drop unused recv_pos field This state field was never used, simply remained 0. Drop it from the PCNetState and update the save/restore code accordingly, keeping backward compatibility. Patchworks-ID: 35314 Signed-off-by: Jan Kiszka Signed-off-by: Anthony Liguori --- hw/pcnet.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/hw/pcnet.c b/hw/pcnet.c index ee0c98cc72..4ba1dcc8ae 100644 --- a/hw/pcnet.c +++ b/hw/pcnet.c @@ -69,7 +69,7 @@ struct PCNetState_st { uint16_t csr[128]; uint16_t bcr[32]; uint64_t timer; - int mmio_index, xmit_pos, recv_pos; + int mmio_index, xmit_pos; uint8_t buffer[4096]; int tx_busy; qemu_irq irq; @@ -1067,9 +1067,6 @@ static int pcnet_can_receive(VLANClientState *vc) if (CSR_STOP(s) || CSR_SPND(s)) return 0; - if (s->recv_pos > 0) - return 0; - return sizeof(s->buffer)-16; } @@ -1896,7 +1893,6 @@ static void pcnet_save(QEMUFile *f, void *opaque) qemu_put_be16s(f, &s->bcr[i]); qemu_put_be64s(f, &s->timer); qemu_put_sbe32(f, s->xmit_pos); - qemu_put_sbe32(f, s->recv_pos); qemu_put_buffer(f, s->buffer, 4096); qemu_put_sbe32(f, s->tx_busy); qemu_put_timer(f, s->poll_timer); @@ -1905,9 +1901,9 @@ static void pcnet_save(QEMUFile *f, void *opaque) static int pcnet_load(QEMUFile *f, void *opaque, int version_id) { PCNetState *s = opaque; - int i; + int i, dummy; - if (version_id != 2) + if (version_id < 2 || version_id > 3) return -EINVAL; qemu_get_sbe32s(f, &s->rap); @@ -1922,7 +1918,9 @@ static int pcnet_load(QEMUFile *f, void *opaque, int version_id) qemu_get_be16s(f, &s->bcr[i]); qemu_get_be64s(f, &s->timer); qemu_get_sbe32s(f, &s->xmit_pos); - qemu_get_sbe32s(f, &s->recv_pos); + if (version_id == 2) { + qemu_get_sbe32s(f, &dummy); + } qemu_get_buffer(f, s->buffer, 4096); qemu_get_sbe32s(f, &s->tx_busy); qemu_get_timer(f, s->poll_timer); @@ -1943,9 +1941,6 @@ static int pci_pcnet_load(QEMUFile *f, void *opaque, int version_id) PCIPCNetState *s = opaque; int ret; - if (version_id != 2) - return -EINVAL; - ret = pci_device_load(&s->pci_dev, f); if (ret < 0) return ret; @@ -2071,7 +2066,7 @@ static int pci_pcnet_init(PCIDevice *pci_dev) s->phys_mem_read = pci_physical_memory_read; s->phys_mem_write = pci_physical_memory_write; - register_savevm("pcnet", -1, 2, pci_pcnet_save, pci_pcnet_load, d); + register_savevm("pcnet", -1, 3, pci_pcnet_save, pci_pcnet_load, d); return pcnet_common_init(&pci_dev->qdev, s, pci_pcnet_cleanup); } @@ -2148,7 +2143,7 @@ static int lance_init(SysBusDevice *dev) s->phys_mem_read = ledma_memory_read; s->phys_mem_write = ledma_memory_write; - register_savevm("pcnet", -1, 2, pcnet_save, pcnet_load, s); + register_savevm("pcnet", -1, 3, pcnet_save, pcnet_load, s); return pcnet_common_init(&dev->qdev, s, lance_cleanup); }