Skip to content

Commit 264d9ca

Browse files
Matthew Wilcoxjbarnes993
authored andcommitted
PCI MSI: Use mask_pos instead of mask_base when appropriate
MSI interrupts have a mask_pos where MSI-X have a mask_base. Use a transparent union to get rid of some ugly casts. Signed-off-by: Matthew Wilcox <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
1 parent 379f532 commit 264d9ca

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

drivers/pci/msi.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static int msi_set_mask_bits(struct irq_desc *desc, u32 mask, u32 flag)
145145
if (!entry->msi_attrib.maskbit)
146146
return 0;
147147

148-
pos = (long)entry->mask_base;
148+
pos = entry->mask_pos;
149149
pci_read_config_dword(entry->dev, pos, &mask_bits);
150150
mask_bits &= ~mask;
151151
mask_bits |= flag & mask;
@@ -363,8 +363,7 @@ static int msi_capability_init(struct pci_dev *dev)
363363
unsigned int base, maskbits, temp;
364364

365365
base = msi_mask_bits_reg(pos, entry->msi_attrib.is_64);
366-
entry->mask_base = (void __iomem *)(long)base;
367-
366+
entry->mask_pos = base;
368367
/* All MSIs are unmasked by default, Mask them all */
369368
pci_read_config_dword(dev, base, &maskbits);
370369
temp = msi_mask((control & PCI_MSI_FLAGS_QMASK) >> 1);

include/linux/msi.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ struct msi_desc {
3333
unsigned int irq;
3434
struct list_head list;
3535

36-
void __iomem *mask_base;
36+
union {
37+
void __iomem *mask_base;
38+
u8 mask_pos;
39+
};
3740
struct pci_dev *dev;
3841

3942
/* Last set MSI message */

0 commit comments

Comments
 (0)