Skip to content

Commit

Permalink
xen-pciback: fix INTERRUPT_TYPE_* defines
Browse files Browse the repository at this point in the history
xen_pcibk_get_interrupt_type() assumes INTERRUPT_TYPE_NONE being 0
(initialize ret to 0 and return as INTERRUPT_TYPE_NONE).
Fix the definition to make INTERRUPT_TYPE_NONE really 0, and also shift
other values to not leave holes.
But also, do not assume INTERRUPT_TYPE_NONE being 0 anymore to avoid
similar confusions in the future.

Fixes: 476878e ("xen-pciback: optionally allow interrupt enable flag writes")
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
  • Loading branch information
Marek Marczykowski-Górecki authored and Juergen Gross committed Mar 30, 2020
1 parent b28089a commit 69086bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/xen/xen-pciback/conf_space.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ int xen_pcibk_get_interrupt_type(struct pci_dev *dev)
if (val & PCI_MSIX_FLAGS_ENABLE)
ret |= INTERRUPT_TYPE_MSIX;
}
return ret;
return ret ?: INTERRUPT_TYPE_NONE;
}

void xen_pcibk_config_free_dyn_fields(struct pci_dev *dev)
Expand Down
8 changes: 4 additions & 4 deletions drivers/xen/xen-pciback/conf_space.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ struct config_field_entry {
void *data;
};

#define INTERRUPT_TYPE_NONE (1<<0)
#define INTERRUPT_TYPE_INTX (1<<1)
#define INTERRUPT_TYPE_MSI (1<<2)
#define INTERRUPT_TYPE_MSIX (1<<3)
#define INTERRUPT_TYPE_NONE (0)
#define INTERRUPT_TYPE_INTX (1<<0)
#define INTERRUPT_TYPE_MSI (1<<1)
#define INTERRUPT_TYPE_MSIX (1<<2)

extern bool xen_pcibk_permissive;

Expand Down

0 comments on commit 69086bd

Please sign in to comment.