Skip to contentSkip to conversation

fix multi_msi_enable()

PATCH New Jan Beulich 1 participant 1 message Nov 11, 2008 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 fix multi_msi_enable()

And isn't multi_msi_enable(), though unused (since msi_{en,dis}able() are unused), broken altogether (shifting num right by 1 instead of taking the binary log)?

---
 drivers/pci/msi.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/msi.h +1 -1
@@ -23,7 +23,7 @@
 #define multi_msi_capable(control) \
 	(1 << ((control & PCI_MSI_FLAGS_QMASK) >> 1))
 #define multi_msi_enable(control, num) \
-	control |= (((num >> 1) << 4) & PCI_MSI_FLAGS_QSIZE);
+	control |= ((fls((num) - 1) << 4) & PCI_MSI_FLAGS_QSIZE)
 #define is_64bit_address(control)	(!!(control & PCI_MSI_FLAGS_64BIT))
 #define is_mask_bit_support(control)	(!!(control & PCI_MSI_FLAGS_MASKBIT))
 #define msi_enable(control, num) multi_msi_enable(control, num); \