Skip to content

Commit 7b50f62

Browse files
Ahmed S. DarwishKAGA-KOKO
authored andcommitted
PCI/MSI: Move pci_msix_vec_count() to api.c
To disentangle the maze in msi.c, all exported device-driver MSI APIs are now to be grouped in one file, api.c. Move pci_msix_vec_count() and make its kernel-doc comprehensive. Signed-off-by: Ahmed S. Darwish <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 059f778 commit 7b50f62

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

drivers/pci/msi/api.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,26 @@ void pci_disable_msi(struct pci_dev *dev)
5959
}
6060
EXPORT_SYMBOL(pci_disable_msi);
6161

62+
/**
63+
* pci_msix_vec_count() - Get number of MSI-X interrupt vectors on device
64+
* @dev: the PCI device to operate on
65+
*
66+
* Return: number of MSI-X interrupt vectors available on this device
67+
* (i.e., the device's MSI-X capability structure "table size"), -EINVAL
68+
* if the device is not MSI-X capable, other errnos otherwise.
69+
*/
70+
int pci_msix_vec_count(struct pci_dev *dev)
71+
{
72+
u16 control;
73+
74+
if (!dev->msix_cap)
75+
return -EINVAL;
76+
77+
pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control);
78+
return msix_table_size(control);
79+
}
80+
EXPORT_SYMBOL(pci_msix_vec_count);
81+
6282
/**
6383
* pci_enable_msix_range() - Enable MSI-X interrupt mode on device
6484
* @dev: the PCI device to operate on

drivers/pci/msi/msi.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -701,26 +701,6 @@ void pci_msi_shutdown(struct pci_dev *dev)
701701
pcibios_alloc_irq(dev);
702702
}
703703

704-
/**
705-
* pci_msix_vec_count - return the number of device's MSI-X table entries
706-
* @dev: pointer to the pci_dev data structure of MSI-X device function
707-
* This function returns the number of device's MSI-X table entries and
708-
* therefore the number of MSI-X vectors device is capable of sending.
709-
* It returns a negative errno if the device is not capable of sending MSI-X
710-
* interrupts.
711-
**/
712-
int pci_msix_vec_count(struct pci_dev *dev)
713-
{
714-
u16 control;
715-
716-
if (!dev->msix_cap)
717-
return -EINVAL;
718-
719-
pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control);
720-
return msix_table_size(control);
721-
}
722-
EXPORT_SYMBOL(pci_msix_vec_count);
723-
724704
static int __pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries,
725705
int nvec, struct irq_affinity *affd, int flags)
726706
{

0 commit comments

Comments
 (0)