All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Gordeev <agordeev@redhat.com>
To: kvm@vger.kernel.org
Cc: Alexander Gordeev <agordeev@redhat.com>,
	Thomas Huth <thuth@redhat.com>, Andrew Jones <drjones@redhat.com>
Subject: [kvm-unit-tests PATCH v3 5/6] pci: Rework pci_bar_is_valid()
Date: Mon, 27 Feb 2017 15:12:36 +0100	[thread overview]
Message-ID: <c7fe6cf294a23e33dd4700ed6a4e0a6fd7281195.1488204259.git.agordeev@redhat.com> (raw)
In-Reply-To: <cover.1488204259.git.agordeev@redhat.com>
In-Reply-To: <cover.1488204259.git.agordeev@redhat.com>

Cc: Thomas Huth <thuth@redhat.com>
Cc: Andrew Jones <drjones@redhat.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
---
 lib/pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/pci.c b/lib/pci.c
index aded1b1ddb77..d9e3dfaa3726 100644
--- a/lib/pci.c
+++ b/lib/pci.c
@@ -206,7 +206,7 @@ bool pci_bar_is_memory(struct pci_dev *dev, int bar_num)
 
 bool pci_bar_is_valid(struct pci_dev *dev, int bar_num)
 {
-	return pci_bar_get(dev, bar_num);
+	return dev->resource[bar_num] != INVALID_PHYS_ADDR;
 }
 
 bool pci_bar_is64(struct pci_dev *dev, int bar_num)
@@ -225,11 +225,11 @@ void pci_bar_print(struct pci_dev *dev, int bar_num)
 	phys_addr_t size, start, end;
 	uint32_t bar;
 
-	size = pci_bar_size(dev, bar_num);
-	if (!size)
+	if (!pci_bar_is_valid(dev, bar_num))
 		return;
 
 	bar = pci_bar_get(dev, bar_num);
+	size = pci_bar_size(dev, bar_num);
 	start = pci_bar_get_addr(dev, bar_num);
 	end = start + size - 1;
 
@@ -309,7 +309,7 @@ void pci_dev_print(pcidevaddr_t dev)
 		return;
 
 	for (i = 0; i < PCI_BAR_NUM; i++) {
-		if (pci_bar_size(&pci_dev, i)) {
+		if (pci_bar_is_valid(&pci_dev, i)) {
 			printf("\t");
 			pci_bar_print(&pci_dev, i);
 			printf("\n");
-- 
1.8.3.1

  parent reply	other threads:[~2017-02-27 14:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27 14:12 [kvm-unit-tests PATCH v3 0/6] pci: Complete conversion of PCI API to struct pci_dev Alexander Gordeev
2017-02-27 14:12 ` [kvm-unit-tests PATCH v3 1/6] pci: pci-host-generic: Use INVALID_PHYS_ADDR instead of ~0 Alexander Gordeev
2017-02-27 14:12 ` [kvm-unit-tests PATCH v3 2/6] pci: Do not use 0 for unimplemented BARs in pci_dev::resource[] Alexander Gordeev
2017-02-27 14:12 ` [kvm-unit-tests PATCH v3 3/6] pci: Accomodate 64 bit " Alexander Gordeev
2017-02-28  7:02   ` Peter Xu
2017-02-28  9:02     ` Andrew Jones
2017-02-28  9:31       ` Peter Xu
2017-02-28  9:48         ` Andrew Jones
2017-02-28  9:51     ` Alexander Gordeev
2017-02-28  9:55       ` Peter Xu
2017-02-28 10:22         ` Alexander Gordeev
2017-02-28 10:40           ` Peter Xu
2017-02-28 10:41           ` Peter Xu
2017-02-28 11:11             ` Alexander Gordeev
2017-02-28 11:56               ` Andrew Jones
2017-02-27 14:12 ` [kvm-unit-tests PATCH v3 4/6] pci: Turn struct pci_dev into device handle for PCI functions Alexander Gordeev
2017-02-27 18:35   ` Andrew Jones
2017-02-27 14:12 ` Alexander Gordeev [this message]
2017-02-27 14:12 ` [kvm-unit-tests PATCH v3 6/6] pci: Make PCI API consistent wrt using struct pci_dev Alexander Gordeev
2017-02-27 18:37 ` [kvm-unit-tests PATCH v3 0/6] pci: Complete conversion of PCI API to " Andrew Jones

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=c7fe6cf294a23e33dd4700ed6a4e0a6fd7281195.1488204259.git.agordeev@redhat.com \
    --to=agordeev@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=thuth@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.