Skip to content

Commit 6a25f5e

Browse files
mstsirkinbjorn-helgaas
authored andcommitted
PCI/MSI: Export pci_msi_set_enable(), pci_msix_clear_and_set_ctrl()
Move pci_msi_set_enable() and pci_msix_clear_and_set_ctrl() to drivers/pci/pci.h so they're available even when MSI isn't configured into the kernel. No functional change. [bhelgaas: changelog, split into separate patch] Signed-off-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Fam Zheng <[email protected]>
1 parent 61b64ab commit 6a25f5e

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

drivers/pci/msi.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -185,27 +185,6 @@ void __weak arch_restore_msi_irqs(struct pci_dev *dev)
185185
return default_restore_msi_irqs(dev);
186186
}
187187

188-
static void pci_msi_set_enable(struct pci_dev *dev, int enable)
189-
{
190-
u16 control;
191-
192-
pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
193-
control &= ~PCI_MSI_FLAGS_ENABLE;
194-
if (enable)
195-
control |= PCI_MSI_FLAGS_ENABLE;
196-
pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control);
197-
}
198-
199-
static void pci_msix_clear_and_set_ctrl(struct pci_dev *dev, u16 clear, u16 set)
200-
{
201-
u16 ctrl;
202-
203-
pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &ctrl);
204-
ctrl &= ~clear;
205-
ctrl |= set;
206-
pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, ctrl);
207-
}
208-
209188
static inline __attribute_const__ u32 msi_mask(unsigned x)
210189
{
211190
/* Don't shift by >= width of type */

drivers/pci/pci.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,27 @@ static inline void pci_no_msi(void) { }
146146
static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { }
147147
#endif
148148

149+
static inline void pci_msi_set_enable(struct pci_dev *dev, int enable)
150+
{
151+
u16 control;
152+
153+
pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
154+
control &= ~PCI_MSI_FLAGS_ENABLE;
155+
if (enable)
156+
control |= PCI_MSI_FLAGS_ENABLE;
157+
pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control);
158+
}
159+
160+
static inline void pci_msix_clear_and_set_ctrl(struct pci_dev *dev, u16 clear, u16 set)
161+
{
162+
u16 ctrl;
163+
164+
pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &ctrl);
165+
ctrl &= ~clear;
166+
ctrl |= set;
167+
pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, ctrl);
168+
}
169+
149170
void pci_realloc_get_opt(char *);
150171

151172
static inline int pci_no_d1d2(struct pci_dev *dev)

0 commit comments

Comments
 (0)