From: Jan Kiszka <jan.kiszka@siemens.com>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH] pcnet: Drop unused recv_pos field
Date: Wed, 07 Oct 2009 18:19:40 +0200 [thread overview]
Message-ID: <4ACCBF9C.2020002@siemens.com> (raw)
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(-)
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);
}
reply other threads:[~2009-10-07 16:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ACCBF9C.2020002@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).