|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v3 14/18] pci: Use pci_sbdf_t in _scan_pci_devices
Avoid creating pci_sbdf_t objects each time we need it.
Signed-off-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
---
xen/drivers/passthrough/pci.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index e8c9dd9b26..621537f3cc 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -1218,6 +1218,8 @@ static int __init cf_check _scan_pci_devices(struct
pci_seg *pseg, void *arg)
{
for ( func = 0; func < 8; func++ )
{
+ pci_sbdf_t sbdf = PCI_SBDF(pseg->nr, bus, dev, func);
+
if ( !pci_device_detect(PCI_SBDF(pseg->nr, bus, dev, func)) )
{
if ( !func )
@@ -1225,17 +1227,15 @@ static int __init cf_check _scan_pci_devices(struct
pci_seg *pseg, void *arg)
continue;
}
- pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
+ pdev = alloc_pdev(pseg, bus, sbdf.devfn);
if ( !pdev )
{
printk(XENLOG_WARNING "%pp: alloc_pdev failed\n",
- &PCI_SBDF(pseg->nr, bus, dev, func));
+ &sbdf);
return -ENOMEM;
}
- if ( !func && !(pci_conf_read8(PCI_SBDF(pseg->nr, bus, dev,
- func),
- PCI_HEADER_TYPE) & 0x80) )
+ if ( !func && !(pci_conf_read8(sbdf, PCI_HEADER_TYPE) & 0x80) )
break;
}
}
--
2.54.0
--
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |