From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NzQq0-0006QU-2H for qemu-devel@nongnu.org; Wed, 07 Apr 2010 04:42:16 -0400 Received: from [140.186.70.92] (port=40718 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NzQpx-0006Ov-66 for qemu-devel@nongnu.org; Wed, 07 Apr 2010 04:42:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NzQpv-0003vm-K0 for qemu-devel@nongnu.org; Wed, 07 Apr 2010 04:42:13 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:54842) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NzQpv-0003vZ-6f for qemu-devel@nongnu.org; Wed, 07 Apr 2010 04:42:11 -0400 Message-ID: <4BBC455F.20700@mail.berlios.de> Date: Wed, 07 Apr 2010 10:42:07 +0200 From: Stefan Weil MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 2/2] eepro100: convert to new capability API List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org Michael S. Tsirkin schrieb: > Using new pci_add_capability_at_offset makes > eepro100 code cleaner. > > Signed-off-by: Michael S. Tsirkin > --- > hw/eepro100.c | 22 +++++++++------------- > 1 files changed, 9 insertions(+), 13 deletions(-) > > diff --git a/hw/eepro100.c b/hw/eepro100.c > index 785a7da..a74d834 100644 > --- a/hw/eepro100.c > +++ b/hw/eepro100.c > @@ -539,21 +539,17 @@ static void e100_pci_reset(EEPRO100State * s, > E100PCIDeviceInfo *e100_device) > > if (e100_device->power_management) { > /* Power Management Capabilities */ > - int cfg_offset; > - pci_reserve_capability(&s->dev, PCI_CONFIG_HEADER_SIZE, > - 0xdc - PCI_CONFIG_HEADER_SIZE); > - cfg_offset = pci_add_capability(&s->dev, PCI_CAP_ID_PM, PCI_PM_SIZEOF); > - assert(cfg_offset == 0xdc); > - if (cfg_offset > 0) { > - /* Power Management Capabilities */ > - pci_set_word(pci_conf + cfg_offset + PCI_PM_PMC, 0x7e21); > + int cfg_offset = 0xdc; Suggestion: uint8_t cfg_offset = 0xdc; > + int r = pci_add_capability_at_offset(&s->dev, PCI_CAP_ID_PM, > + cfg_offset, PCI_PM_SIZEOF); > + assert(r >= 0); > + pci_set_word(pci_conf + cfg_offset + PCI_PM_PMC, 0x7e21); > #if 0 /* TODO: replace dummy code for power management emulation. */ > - /* TODO: Power Management Control / Status. */ > - pci_set_word(pci_conf + cfg_offset + PCI_PM_CTRL, 0x0000); > - /* TODO: Ethernet Power Consumption Registers (i82559 and later). */ > - pci_set_byte(pci_conf + cfg_offset + PCI_PM_PPB_EXTENSIONS, 0x0000); > + /* TODO: Power Management Control / Status. */ > + pci_set_word(pci_conf + cfg_offset + PCI_PM_CTRL, 0x0000); > + /* TODO: Ethernet Power Consumption Registers (i82559 and later). */ > + pci_set_byte(pci_conf + cfg_offset + PCI_PM_PPB_EXTENSIONS, 0x0000); > #endif > - } > } > > #if EEPROM_SIZE > 0 Acked-by: Stefan Weil