]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/msi.c
i2c: Document the different ways to instantiate i2c devices
[linux-2.6-omap-h63xx.git] / drivers / pci / msi.c
index 896a15d70f5b3060a587b52ca2ecbb9dbaadcd9e..baba2eb5367df54bcc947333beda7e56332f3785 100644 (file)
@@ -103,6 +103,14 @@ static void msix_set_enable(struct pci_dev *dev, int enable)
        }
 }
 
+static inline __attribute_const__ u32 msi_mask(unsigned x)
+{
+       /* Don't shift by >= width of type */
+       if (x >= 5)
+               return 0xffffffff;
+       return (1 << (1 << x)) - 1;
+}
+
 static void msix_flush_writes(struct irq_desc *desc)
 {
        struct msi_desc *entry;
@@ -407,8 +415,7 @@ static int msi_capability_init(struct pci_dev *dev)
 
                /* All MSIs are unmasked by default, Mask them all */
                pci_read_config_dword(dev, base, &maskbits);
-               temp = (1 << multi_msi_capable(control));
-               temp = ((temp - 1) & ~temp);
+               temp = msi_mask((control & PCI_MSI_FLAGS_QMASK) >> 1);
                maskbits |= temp;
                pci_write_config_dword(dev, base, maskbits);
                entry->msi_attrib.maskbits_mask = temp;