From patchwork Thu Jun 24 04:41:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 56745 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 443C3B6F0E for ; Thu, 24 Jun 2010 14:46:10 +1000 (EST) Received: from localhost ([127.0.0.1]:58276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OReKF-0005BU-1d for incoming@patchwork.ozlabs.org; Thu, 24 Jun 2010 00:46:07 -0400 Received: from [140.186.70.92] (port=37771 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OReGB-00036x-1d for qemu-devel@nongnu.org; Thu, 24 Jun 2010 00:41:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OReG9-0001Q7-3V for qemu-devel@nongnu.org; Thu, 24 Jun 2010 00:41:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38201) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OReG8-0001Q3-Qi for qemu-devel@nongnu.org; Thu, 24 Jun 2010 00:41:53 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5O4fZWr015011 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 24 Jun 2010 00:41:35 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5O4fYrC019986; Thu, 24 Jun 2010 00:41:34 -0400 From: Alex Williamson To: qemu-devel@nongnu.org Date: Wed, 23 Jun 2010 22:41:33 -0600 Message-ID: <20100624044133.16168.64385.stgit@localhost.localdomain> In-Reply-To: <20100624044046.16168.32804.stgit@localhost.localdomain> References: <20100624044046.16168.32804.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: jan.kiszka@siemens.com, armbru@redhat.com, alex.williamson@redhat.com, kraxel@redhat.com, cam@cs.ualberta.ca, paul@codesourcery.com Subject: [Qemu-devel] [PATCH 06/15] eepro100: Add a dev field to eeprom new/free functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This allows us to create a more meaningful savevm string. Signed-off-by: Alex Williamson --- hw/eepro100.c | 4 ++-- hw/eeprom93xx.c | 8 ++++---- hw/eeprom93xx.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/eepro100.c b/hw/eepro100.c index 0ddca8b..2b75c8f 100644 --- a/hw/eepro100.c +++ b/hw/eepro100.c @@ -1835,7 +1835,7 @@ static int pci_nic_uninit(PCIDevice *pci_dev) cpu_unregister_io_memory(s->mmio_index); vmstate_unregister(&pci_dev->qdev, s->vmstate, s); - eeprom93xx_free(s->eeprom); + eeprom93xx_free(&pci_dev->qdev, s->eeprom); qemu_del_vlan_client(&s->nic->nc); return 0; } @@ -1862,7 +1862,7 @@ static int e100_nic_init(PCIDevice *pci_dev) /* Add 64 * 2 EEPROM. i82557 and i82558 support a 64 word EEPROM, * i82559 and later support 64 or 256 word EEPROM. */ - s->eeprom = eeprom93xx_new(EEPROM_SIZE); + s->eeprom = eeprom93xx_new(&pci_dev->qdev, EEPROM_SIZE); /* Handler for memory-mapped I/O */ s->mmio_index = diff --git a/hw/eeprom93xx.c b/hw/eeprom93xx.c index 6ba546f..660b28f 100644 --- a/hw/eeprom93xx.c +++ b/hw/eeprom93xx.c @@ -289,7 +289,7 @@ void eeprom93xx_reset(eeprom_t *eeprom) } #endif -eeprom_t *eeprom93xx_new(uint16_t nwords) +eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwords) { /* Add a new EEPROM (with 16, 64 or 256 words). */ eeprom_t *eeprom; @@ -316,15 +316,15 @@ eeprom_t *eeprom93xx_new(uint16_t nwords) /* Output DO is tristate, read results in 1. */ eeprom->eedo = 1; logout("eeprom = 0x%p, nwords = %u\n", eeprom, nwords); - vmstate_register(NULL, 0, &vmstate_eeprom, eeprom); + vmstate_register(dev, 0, &vmstate_eeprom, eeprom); return eeprom; } -void eeprom93xx_free(eeprom_t *eeprom) +void eeprom93xx_free(DeviceState *dev, eeprom_t *eeprom) { /* Destroy EEPROM. */ logout("eeprom = 0x%p\n", eeprom); - vmstate_unregister(NULL, &vmstate_eeprom, eeprom); + vmstate_unregister(dev, &vmstate_eeprom, eeprom); qemu_free(eeprom); } diff --git a/hw/eeprom93xx.h b/hw/eeprom93xx.h index 47282d3..8ba0e28 100644 --- a/hw/eeprom93xx.h +++ b/hw/eeprom93xx.h @@ -23,10 +23,10 @@ typedef struct _eeprom_t eeprom_t; /* Create a new EEPROM with (nwords * 2) bytes. */ -eeprom_t *eeprom93xx_new(uint16_t nwords); +eeprom_t *eeprom93xx_new(DeviceState *dev, uint16_t nwords); /* Destroy an existing EEPROM. */ -void eeprom93xx_free(eeprom_t *eeprom); +void eeprom93xx_free(DeviceState *dev, eeprom_t *eeprom); /* Read from the EEPROM. */ uint16_t eeprom93xx_read(eeprom_t *eeprom);