mirror of
https://github.com/torvalds/linux.git
synced 2026-04-30 04:22:32 -04:00
PCI/MSI/PPC: Remove arch_msi_check_device()
Move MSI checks from arch_msi_check_device() to arch_setup_msi_irqs(). This makes the code more compact and allows removing arch_msi_check_device() from generic MSI code. Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
committed by
Bjorn Helgaas
parent
52addcf9d6
commit
6b2fd7efeb
@@ -109,14 +109,6 @@ static int fsl_msi_init_allocator(struct fsl_msi *msi_data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fsl_msi_check_device(struct pci_dev *pdev, int nvec, int type)
|
||||
{
|
||||
if (type == PCI_CAP_ID_MSIX)
|
||||
pr_debug("fslmsi: MSI-X untested, trying anyway.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void fsl_teardown_msi_irqs(struct pci_dev *pdev)
|
||||
{
|
||||
struct msi_desc *entry;
|
||||
@@ -173,6 +165,9 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
|
||||
struct msi_msg msg;
|
||||
struct fsl_msi *msi_data;
|
||||
|
||||
if (type == PCI_CAP_ID_MSIX)
|
||||
pr_debug("fslmsi: MSI-X untested, trying anyway.\n");
|
||||
|
||||
/*
|
||||
* If the PCI node has an fsl,msi property, then we need to use it
|
||||
* to find the specific MSI.
|
||||
@@ -527,7 +522,6 @@ static int fsl_of_msi_probe(struct platform_device *dev)
|
||||
if (!ppc_md.setup_msi_irqs) {
|
||||
ppc_md.setup_msi_irqs = fsl_setup_msi_irqs;
|
||||
ppc_md.teardown_msi_irqs = fsl_teardown_msi_irqs;
|
||||
ppc_md.msi_check_device = fsl_msi_check_device;
|
||||
} else if (ppc_md.setup_msi_irqs != fsl_setup_msi_irqs) {
|
||||
dev_err(&dev->dev, "Different MSI driver already installed!\n");
|
||||
err = -ENODEV;
|
||||
|
||||
@@ -63,14 +63,6 @@ static struct irq_chip mpic_pasemi_msi_chip = {
|
||||
.name = "PASEMI-MSI",
|
||||
};
|
||||
|
||||
static int pasemi_msi_check_device(struct pci_dev *pdev, int nvec, int type)
|
||||
{
|
||||
if (type == PCI_CAP_ID_MSIX)
|
||||
pr_debug("pasemi_msi: MSI-X untested, trying anyway\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev)
|
||||
{
|
||||
struct msi_desc *entry;
|
||||
@@ -97,6 +89,8 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
|
||||
struct msi_msg msg;
|
||||
int hwirq;
|
||||
|
||||
if (type == PCI_CAP_ID_MSIX)
|
||||
pr_debug("pasemi_msi: MSI-X untested, trying anyway\n");
|
||||
pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n",
|
||||
pdev, nvec, type);
|
||||
|
||||
@@ -169,7 +163,6 @@ int mpic_pasemi_msi_init(struct mpic *mpic)
|
||||
WARN_ON(ppc_md.setup_msi_irqs);
|
||||
ppc_md.setup_msi_irqs = pasemi_msi_setup_msi_irqs;
|
||||
ppc_md.teardown_msi_irqs = pasemi_msi_teardown_msi_irqs;
|
||||
ppc_md.msi_check_device = pasemi_msi_check_device;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -105,22 +105,6 @@ static u64 find_u4_magic_addr(struct pci_dev *pdev, unsigned int hwirq)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int u3msi_msi_check_device(struct pci_dev *pdev, int nvec, int type)
|
||||
{
|
||||
if (type == PCI_CAP_ID_MSIX)
|
||||
pr_debug("u3msi: MSI-X untested, trying anyway.\n");
|
||||
|
||||
/* If we can't find a magic address then MSI ain't gonna work */
|
||||
if (find_ht_magic_addr(pdev, 0) == 0 &&
|
||||
find_u4_magic_addr(pdev, 0) == 0) {
|
||||
pr_debug("u3msi: no magic address found for %s\n",
|
||||
pci_name(pdev));
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void u3msi_teardown_msi_irqs(struct pci_dev *pdev)
|
||||
{
|
||||
struct msi_desc *entry;
|
||||
@@ -146,6 +130,17 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
|
||||
u64 addr;
|
||||
int hwirq;
|
||||
|
||||
if (type == PCI_CAP_ID_MSIX)
|
||||
pr_debug("u3msi: MSI-X untested, trying anyway.\n");
|
||||
|
||||
/* If we can't find a magic address then MSI ain't gonna work */
|
||||
if (find_ht_magic_addr(pdev, 0) == 0 &&
|
||||
find_u4_magic_addr(pdev, 0) == 0) {
|
||||
pr_debug("u3msi: no magic address found for %s\n",
|
||||
pci_name(pdev));
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
list_for_each_entry(entry, &pdev->msi_list, list) {
|
||||
hwirq = msi_bitmap_alloc_hwirqs(&msi_mpic->msi_bitmap, 1);
|
||||
if (hwirq < 0) {
|
||||
@@ -202,7 +197,6 @@ int mpic_u3msi_init(struct mpic *mpic)
|
||||
WARN_ON(ppc_md.setup_msi_irqs);
|
||||
ppc_md.setup_msi_irqs = u3msi_setup_msi_irqs;
|
||||
ppc_md.teardown_msi_irqs = u3msi_teardown_msi_irqs;
|
||||
ppc_md.msi_check_device = u3msi_msi_check_device;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,12 @@ static int hsta_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
|
||||
int irq, hwirq;
|
||||
u64 addr;
|
||||
|
||||
/* We don't support MSI-X */
|
||||
if (type == PCI_CAP_ID_MSIX) {
|
||||
pr_debug("%s: MSI-X not supported.\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
list_for_each_entry(entry, &dev->msi_list, list) {
|
||||
irq = msi_bitmap_alloc_hwirqs(&ppc4xx_hsta_msi.bmp, 1);
|
||||
if (irq < 0) {
|
||||
@@ -117,17 +123,6 @@ static void hsta_teardown_msi_irqs(struct pci_dev *dev)
|
||||
}
|
||||
}
|
||||
|
||||
static int hsta_msi_check_device(struct pci_dev *pdev, int nvec, int type)
|
||||
{
|
||||
/* We don't support MSI-X */
|
||||
if (type == PCI_CAP_ID_MSIX) {
|
||||
pr_debug("%s: MSI-X not supported.\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hsta_msi_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
@@ -178,7 +173,6 @@ static int hsta_msi_probe(struct platform_device *pdev)
|
||||
|
||||
ppc_md.setup_msi_irqs = hsta_setup_msi_irqs;
|
||||
ppc_md.teardown_msi_irqs = hsta_teardown_msi_irqs;
|
||||
ppc_md.msi_check_device = hsta_msi_check_device;
|
||||
return 0;
|
||||
|
||||
out2:
|
||||
|
||||
@@ -85,8 +85,12 @@ static int ppc4xx_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
|
||||
struct msi_desc *entry;
|
||||
struct ppc4xx_msi *msi_data = &ppc4xx_msi;
|
||||
|
||||
msi_data->msi_virqs = kmalloc((msi_irqs) * sizeof(int),
|
||||
GFP_KERNEL);
|
||||
dev_dbg(&dev->dev, "PCIE-MSI:%s called. vec %x type %d\n",
|
||||
__func__, nvec, type);
|
||||
if (type == PCI_CAP_ID_MSIX)
|
||||
pr_debug("ppc4xx msi: MSI-X untested, trying anyway.\n");
|
||||
|
||||
msi_data->msi_virqs = kmalloc((msi_irqs) * sizeof(int), GFP_KERNEL);
|
||||
if (!msi_data->msi_virqs)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -134,16 +138,6 @@ void ppc4xx_teardown_msi_irqs(struct pci_dev *dev)
|
||||
}
|
||||
}
|
||||
|
||||
static int ppc4xx_msi_check_device(struct pci_dev *pdev, int nvec, int type)
|
||||
{
|
||||
dev_dbg(&pdev->dev, "PCIE-MSI:%s called. vec %x type %d\n",
|
||||
__func__, nvec, type);
|
||||
if (type == PCI_CAP_ID_MSIX)
|
||||
pr_debug("ppc4xx msi: MSI-X untested, trying anyway.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ppc4xx_setup_pcieh_hw(struct platform_device *dev,
|
||||
struct resource res, struct ppc4xx_msi *msi)
|
||||
{
|
||||
@@ -259,7 +253,6 @@ static int ppc4xx_msi_probe(struct platform_device *dev)
|
||||
|
||||
ppc_md.setup_msi_irqs = ppc4xx_setup_msi_irqs;
|
||||
ppc_md.teardown_msi_irqs = ppc4xx_teardown_msi_irqs;
|
||||
ppc_md.msi_check_device = ppc4xx_msi_check_device;
|
||||
return err;
|
||||
|
||||
error_out:
|
||||
|
||||
Reference in New Issue
Block a user