@@ -27,8 +27,8 @@ static int get_reserved_device_memory(xen_pfn_t start, xen_ulong_t nr,
u32 id, void *ctxt)
{
struct get_reserved_device_memory *grdm = ctxt;
- u32 sbdf = PCI_SBDF3(grdm->map.dev.pci.seg, grdm->map.dev.pci.bus,
- grdm->map.dev.pci.devfn);
+ uint32_t sbdf = PCI_SBDF3(grdm->map.dev.pci.seg, grdm->map.dev.pci.bus,
+ grdm->map.dev.pci.devfn).sbdf;
if ( !(grdm->map.flags & XENMEM_RDM_ALL) && (sbdf != id) )
return 0;
@@ -968,8 +968,8 @@ static int get_reserved_device_memory(xen_pfn_t start, xen_ulong_t nr,
u32 id, void *ctxt)
{
struct get_reserved_device_memory *grdm = ctxt;
- u32 sbdf = PCI_SBDF3(grdm->map.dev.pci.seg, grdm->map.dev.pci.bus,
- grdm->map.dev.pci.devfn);
+ uint32_t sbdf = PCI_SBDF3(grdm->map.dev.pci.seg, grdm->map.dev.pci.bus,
+ grdm->map.dev.pci.devfn).sbdf;
if ( !(grdm->map.flags & XENMEM_RDM_ALL) && (sbdf != id) )
return 0;
@@ -762,9 +762,7 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
{
unsigned int idx = pos + PCI_SRIOV_BAR + i * 4;
u32 bar = pci_conf_read32(seg, bus, slot, func, idx);
- pci_sbdf_t sbdf = {
- .sbdf = PCI_SBDF3(seg, bus, devfn),
- };
+ pci_sbdf_t sbdf = PCI_SBDF3(seg, bus, devfn);
if ( (bar & PCI_BASE_ADDRESS_SPACE) ==
PCI_BASE_ADDRESS_SPACE_IO )
@@ -38,7 +38,8 @@
((pci_sbdf_t) { .sbdf = (((s) & 0xffff) << 16) | PCI_BDF(b,d,f) })
#define PCI_SBDF2(s,bdf) \
((pci_sbdf_t) { .sbdf = (((s) & 0xffff) << 16) | ((bdf) & 0xffff) })
-#define PCI_SBDF3(s,b,df) ((((s) & 0xffff) << 16) | PCI_BDF2(b, df))
+#define PCI_SBDF3(s,b,df) \
+ ((pci_sbdf_t) { .sbdf = (((s) & 0xffff) << 16) | PCI_BDF2(b, df) })
typedef union {
uint32_t sbdf;
And fix it's callers. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: George Dunlap <George.Dunlap@eu.citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Jan Beulich <jbeulich@suse.com> Cc: Julien Grall <julien.grall@arm.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Stefano Stabellini <sstabellini@kernel.org> Cc: Tim Deegan <tim@xen.org> Cc: Wei Liu <wl@xen.org> --- xen/common/compat/memory.c | 4 ++-- xen/common/memory.c | 4 ++-- xen/drivers/passthrough/pci.c | 4 +--- xen/include/xen/pci.h | 3 ++- 4 files changed, 7 insertions(+), 8 deletions(-)