Patchwork pcnet: Drop unused recv_pos field

login
register
mail settings
Submitter Jan Kiszka
Date Oct. 7, 2009, 4:19 p.m.
Message ID <4ACCBF9C.2020002@siemens.com>
Download mbox | patch
Permalink /patch/35314/
State Accepted
Commit efb56cf7c2e8c21d6c00a2f14b3e780bdba344a6
Headers show

Comments

Jan Kiszka - Oct. 7, 2009, 4:19 p.m.
This state field was never used, simply remained 0. Drop it from the
PCNetState and update the save/restore code accordingly, keeping
backward compatibility.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 hw/pcnet.c |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

Patch

diff --git a/hw/pcnet.c b/hw/pcnet.c
index 69d4406..afeaca7 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;
@@ -1068,9 +1068,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;
 }
 
@@ -1897,7 +1894,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);
@@ -1906,9 +1902,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);
@@ -1923,7 +1919,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);
@@ -1944,9 +1942,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;
@@ -2072,7 +2067,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);
 }
 
@@ -2149,7 +2144,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);
 }