xen-pciback: fix INTERRUPT_TYPE_* defines
PATCH 1/1 xen-pciback: fix INTERRUPT_TYPE_* defines
INTERRUPT_TYPE_NONE should be 0, as it is assumed in xen_pcibk_get_interrupt_type(). Fix the definition, and also shift other values to not leave holes.
But also use INTERRUPT_TYPE_NONE in xen_pcibk_get_interrupt_type() to avoid similar confusions in the future.
--- 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
@@ -290,7 +290,7 @@ int xen_pcibk_get_interrupt_type(struct pci_dev *dev) {int err;u16 val; -int ret =0 ; +int ret =INTERRUPT_TYPE_NONE ; err =pci_read_config_word (dev,PCI_COMMAND , &val);if (err)
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.0
Quoted 1 line · Marek Marczykowski-Górecki
INTERRUPT_TYPE_NONEshould be 0,
Would
return ret ?: INTERRUPT_TYPE_NONE
in xen_pcibk_get_interrupt_type() work?
I think it's better not to tie macro name to a particular value.
-boris
Quoted 10 lines
as it is assumed in
xen_pcibk_get_interrupt_type(). Fix the definition, and also shift other values to not leave holes.
But also useINTERRUPT_TYPE_NONEinxen_pcibk_get_interrupt_type()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 5 lines · Boris Ostrovsky
Quoted 1 line · Marek Marczykowski-Górecki
INTERRUPT_TYPE_NONEshould be 0,
Quoted 8 lines
Would
return ret ?:
INTERRUPT_TYPE_NONEin
xen_pcibk_get_interrupt_type()work?I think it's better not to tie macro name to a particular value.
I can do that too. But I'd change INTERRUPT_TYPE_NONE to 0 anyway, as more logical value (as the value is a bitmask).
Quoted 12 lines
-boris
Quoted 9 lines
as it is assumed in
xen_pcibk_get_interrupt_type(). Fix the definition, and also shift other values to not leave holes.
But also useINTERRUPT_TYPE_NONEinxen_pcibk_get_interrupt_type()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]>
Signature · 5 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?