xen-pciback: fix INTERRUPT_TYPE_* defines
PATCH v2 1/1 xen-pciback: fix INTERRUPT_TYPE_* defines
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.
---
Changes in v2:
- don't depend on INTERRUPT_TYPE_NONE being 0
--- drivers/xen/xen-pciback/conf_space.c | 2 +- drivers/xen/xen-pciback/conf_space.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/xen/xen-pciback/conf_space.c +1 -1
@@ -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)
drivers/xen/xen-pciback/conf_space.h +4 -4
@@ -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;
Signature · 1 line
2.21.1
Quoted 9 lines · Marek Marczykowski-Górecki
xen_pcibk_get_interrupt_type()assumesINTERRUPT_TYPE_NONEbeing 0 (initialize ret to 0 and return asINTERRUPT_TYPE_NONE).
Fix the definition to makeINTERRUPT_TYPE_NONEreally 0, and also shift other values to not leave holes.
But also, do not assumeINTERRUPT_TYPE_NONEbeing 0 anymore to avoid similar confusions in the future.Fixes 476878e4b2be ("xen-pciback: optionally allow interrupt enable flag writes")Signed-off-by Marek Marczykowski-Górecki <[email protected]>
Quoted 9 lines · Marek Marczykowski-Górecki
xen_pcibk_get_interrupt_type()assumesINTERRUPT_TYPE_NONEbeing 0 (initialize ret to 0 and return asINTERRUPT_TYPE_NONE).
Fix the definition to makeINTERRUPT_TYPE_NONEreally 0, and also shift other values to not leave holes.
But also, do not assumeINTERRUPT_TYPE_NONEbeing 0 anymore to avoid similar confusions in the future.Fixes 476878e4b2be ("xen-pciback: optionally allow interrupt enable flag writes")Signed-off-by Marek Marczykowski-Górecki <[email protected]>
Thanks, Roger.