[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [v2][PATCH] xen/pci: make pci_device_detect() return as bool_t



This function should better return as bool_t and
remove that pointless comment.

Signed-off-by: Tiejun Chen <tiejun.chen@xxxxxxxxx>
---
v2:

* Instead of correcting that comment directly, we make this function
  return as bool_t.

 xen/drivers/passthrough/pci.c      | 7 ++-----
 xen/drivers/passthrough/vtd/dmar.c | 4 ++--
 xen/include/xen/pci.h              | 2 +-
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 862e20f..e30be43 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -904,10 +904,7 @@ out:
     return ret;
 }
 
-/*
- * detect pci device, return 0 if it exists, or return 0
- */
-int __init pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func)
+bool_t __init pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func)
 {
     u32 vendor;
 
@@ -965,7 +962,7 @@ static int __init _scan_pci_devices(struct pci_seg *pseg, 
void *arg)
         {
             for ( func = 0; func < 8; func++ )
             {
-                if ( pci_device_detect(pseg->nr, bus, dev, func) == 0 )
+                if ( !pci_device_detect(pseg->nr, bus, dev, func) )
                 {
                     if ( !func )
                         break;
diff --git a/xen/drivers/passthrough/vtd/dmar.c 
b/xen/drivers/passthrough/vtd/dmar.c
index 18d7903..2b07be9 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -524,7 +524,7 @@ acpi_parse_one_drhd(struct acpi_dmar_header *header)
             d = PCI_SLOT(dmaru->scope.devices[i]);
             f = PCI_FUNC(dmaru->scope.devices[i]);
 
-            if ( pci_device_detect(drhd->segment, b, d, f) == 0 )
+            if ( !pci_device_detect(drhd->segment, b, d, f) )
             {
                 dprintk(XENLOG_WARNING VTDPREFIX,
                         " Non-existent device (%04x:%02x:%02x.%u) is reported"
@@ -636,7 +636,7 @@ acpi_parse_one_rmrr(struct acpi_dmar_header *header)
             d = PCI_SLOT(rmrru->scope.devices[i]);
             f = PCI_FUNC(rmrru->scope.devices[i]);
 
-            if ( pci_device_detect(rmrr->segment, b, d, f) == 0 )
+            if ( !pci_device_detect(rmrr->segment, b, d, f) )
             {
                 dprintk(XENLOG_WARNING VTDPREFIX,
                         " Non-existent device (%04x:%02x:%02x.%u) is reported"
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 4377f3e..3908146 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -93,7 +93,7 @@ struct pci_dev {
 extern spinlock_t pcidevs_lock;
 
 bool_t pci_known_segment(u16 seg);
-int pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func);
+bool_t pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func);
 int scan_pci_devices(void);
 enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn);
 int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus);
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.