Skip to content

Commit 69086bd

Browse files
marmarekjgross1
authored andcommitted
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. Fixes: 476878e ("xen-pciback: optionally allow interrupt enable flag writes") Signed-off-by: Marek Marczykowski-Górecki <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Reviewed-by: Roger Pau Monné <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent b28089a commit 69086bd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

drivers/xen/xen-pciback/conf_space.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ int xen_pcibk_get_interrupt_type(struct pci_dev *dev)
320320
if (val & PCI_MSIX_FLAGS_ENABLE)
321321
ret |= INTERRUPT_TYPE_MSIX;
322322
}
323-
return ret;
323+
return ret ?: INTERRUPT_TYPE_NONE;
324324
}
325325

326326
void xen_pcibk_config_free_dyn_fields(struct pci_dev *dev)

drivers/xen/xen-pciback/conf_space.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ struct config_field_entry {
6565
void *data;
6666
};
6767

68-
#define INTERRUPT_TYPE_NONE (1<<0)
69-
#define INTERRUPT_TYPE_INTX (1<<1)
70-
#define INTERRUPT_TYPE_MSI (1<<2)
71-
#define INTERRUPT_TYPE_MSIX (1<<3)
68+
#define INTERRUPT_TYPE_NONE (0)
69+
#define INTERRUPT_TYPE_INTX (1<<0)
70+
#define INTERRUPT_TYPE_MSI (1<<1)
71+
#define INTERRUPT_TYPE_MSIX (1<<2)
7272

7373
extern bool xen_pcibk_permissive;
7474

0 commit comments

Comments
 (0)