Skip to contentSkip to conversation

xen/pci: make pci_device_detect() return as bool_t

PATCH New Tiejun Chen 1 participant 1 message May 20, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen/pci: make pci_device_detect() return as bool_t

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

---
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(-)
xen/drivers/passthrough/pci.c +2 -5
index 862e20f..e30be43 100644
@@ -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;
xen/drivers/passthrough/vtd/dmar.c +2 -2
index 18d7903..2b07be9 100644
@@ -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"
xen/include/xen/pci.h +1 -1
index 4377f3e..3908146 100644
@@ -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);
Signature · 1 line
1.9.1