aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/msi.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 44f15ff70c1d..baba2eb5367d 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -103,14 +103,12 @@ static void msix_set_enable(struct pci_dev *dev, int enable)
103 } 103 }
104} 104}
105 105
106/*
107 * Essentially, this is ((1 << (1 << x)) - 1), but without the
108 * undefinedness of a << 32.
109 */
110static inline __attribute_const__ u32 msi_mask(unsigned x) 106static inline __attribute_const__ u32 msi_mask(unsigned x)
111{ 107{
112 static const u32 mask[] = { 1, 2, 4, 0xf, 0xff, 0xffff, 0xffffffff }; 108 /* Don't shift by >= width of type */
113 return mask[x]; 109 if (x >= 5)
110 return 0xffffffff;
111 return (1 << (1 << x)) - 1;
114} 112}
115 113
116static void msix_flush_writes(struct irq_desc *desc) 114static void msix_flush_writes(struct irq_desc *desc)