]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc/fsl_msi: Move MSI-related ops to pci_controller_ops
authorDaniel Axtens <dja@axtens.net>
Tue, 14 Apr 2015 04:27:58 +0000 (14:27 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 2 Jun 2015 01:47:42 +0000 (11:47 +1000)
Move the fsl_msi subsystem to use the pci_controller_ops structure
rather than ppc_md for MSI related PCI controller operations.

Previously, MSI ops were added to ppc_md at the subsys level. However,
in fsl_pci.c, PCI controllers are created at the at arch level. So,
unlike in e.g. PowerNV/pSeries/Cell, we can't simply populate a
platform-level controller ops structure and have it copied into the
controllers when they are created.

Instead, walk every phb, and attempt to populate it with the MSI ops.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/sysdev/fsl_msi.c

index f086c6f22dc963dcc008033d01dd4f10247be7b1..5236e5427c38c2c922a2266a16ea4d172db3ef21 100644 (file)
@@ -405,6 +405,7 @@ static int fsl_of_msi_probe(struct platform_device *dev)
        const struct fsl_msi_feature *features;
        int len;
        u32 offset;
+       struct pci_controller *phb;
 
        match = of_match_device(fsl_of_msi_ids, &dev->dev);
        if (!match)
@@ -541,14 +542,20 @@ static int fsl_of_msi_probe(struct platform_device *dev)
 
        list_add_tail(&msi->list, &msi_head);
 
-       /* The multiple setting ppc_md.setup_msi_irqs will not harm things */
-       if (!ppc_md.setup_msi_irqs) {
-               ppc_md.setup_msi_irqs = fsl_setup_msi_irqs;
-               ppc_md.teardown_msi_irqs = fsl_teardown_msi_irqs;
-       } else if (ppc_md.setup_msi_irqs != fsl_setup_msi_irqs) {
-               dev_err(&dev->dev, "Different MSI driver already installed!\n");
-               err = -ENODEV;
-               goto error_out;
+       /*
+        * Apply the MSI ops to all the controllers.
+        * It doesn't hurt to reassign the same ops,
+        * but bail out if we find another MSI driver.
+        */
+       list_for_each_entry(phb, &hose_list, list_node) {
+               if (!phb->controller_ops.setup_msi_irqs) {
+                       phb->controller_ops.setup_msi_irqs = fsl_setup_msi_irqs;
+                       phb->controller_ops.teardown_msi_irqs = fsl_teardown_msi_irqs;
+               } else if (phb->controller_ops.setup_msi_irqs != fsl_setup_msi_irqs) {
+                       dev_err(&dev->dev, "Different MSI driver already installed!\n");
+                       err = -ENODEV;
+                       goto error_out;
+               }
        }
        return 0;
 error_out: