From patchwork Thu Nov 12 05:58:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 38223 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 580D7B7B3E for ; Thu, 12 Nov 2009 18:24:50 +1100 (EST) Received: from localhost ([127.0.0.1]:40122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8U2x-0001Ou-CR for incoming@patchwork.ozlabs.org; Thu, 12 Nov 2009 02:24:47 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N8TIV-0000Vp-88 for qemu-devel@nongnu.org; Thu, 12 Nov 2009 01:36:47 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N8TIP-0000SU-SP for qemu-devel@nongnu.org; Thu, 12 Nov 2009 01:36:46 -0500 Received: from [199.232.76.173] (port=56060 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8TIP-0000Rz-JJ for qemu-devel@nongnu.org; Thu, 12 Nov 2009 01:36:41 -0500 Received: from mail.valinux.co.jp ([210.128.90.3]:57679) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N8TIP-0005Jp-1c for qemu-devel@nongnu.org; Thu, 12 Nov 2009 01:36:41 -0500 Received: from nm.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with ESMTP id 00A7F4A406; Thu, 12 Nov 2009 15:04:53 +0900 (JST) Received: from yamahata by nm.local.valinux.co.jp with local (Exim 4.69) (envelope-from ) id 1N8Shk-0006bw-Ms; Thu, 12 Nov 2009 14:58:48 +0900 From: Isaku Yamahata To: qemu-devel@nongnu.org, mst@redhat.com Date: Thu, 12 Nov 2009 14:58:32 +0900 Message-Id: <1258005528-25383-5-git-send-email-yamahata@valinux.co.jp> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1258005528-25383-1-git-send-email-yamahata@valinux.co.jp> References: <1258005528-25383-1-git-send-email-yamahata@valinux.co.jp> X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: yamahata@valinux.co.jp Subject: [Qemu-devel] [PATCH 04/20] pci: remove pci_addr_to_config() by open code 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 patch removes pci_addr_to_config() and open code it as suggested by Michael S. Tsirkin . Signed-off-by: Isaku Yamahata Acked-by: Michael S. Tsirkin --- hw/pci_host.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/hw/pci_host.c b/hw/pci_host.c index 4196ebc..93c94e8 100644 --- a/hw/pci_host.c +++ b/hw/pci_host.c @@ -47,15 +47,10 @@ static inline PCIDevice *pci_addr_to_dev(PCIBus *bus, uint32_t addr) return pci_find_device(bus, bus_num, PCI_SLOT(devfn), PCI_FUNC(devfn)); } -static inline uint32_t pci_addr_to_config(uint32_t addr) -{ - return addr & (PCI_CONFIG_SPACE_SIZE - 1); -} - void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len) { PCIDevice *pci_dev = pci_addr_to_dev(s, addr); - uint32_t config_addr = pci_addr_to_config(addr); + uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1); if (!pci_dev) return; @@ -68,7 +63,7 @@ void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len) uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len) { PCIDevice *pci_dev = pci_addr_to_dev(s, addr); - uint32_t config_addr = pci_addr_to_config(addr); + uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1); uint32_t val; assert(len == 1 || len == 2 || len == 4);