[PATCH] edac: Don't call mpc85xx_pci_err_probe() from fsl_pci_probe()

Johannes Thumshirn
2015-12-09T15:59:29Z

Don't call mpc85xx_pci_err_probe() from fsl_pci_probe() but instantiate the
PCI EDAC driver via the OpenFirmware interface.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---

Patch is untested due to lack of hardware and against Boris' for-next branch,
please test.
Thanks,
Johannes

arch/powerpc/sysdev/fsl_pci.c | 2 --
arch/powerpc/sysdev/fsl_pci.h | 9 ---------
drivers/edac/mpc85xx_edac.c | 35 +++++++++++++++++++++++++++++++++--
3 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 610f472..5c59037 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -1263,8 +1263,6 @@ static int fsl_pci_probe(struct platform_device *pdev)
node = pdev->dev.of_node;
ret = fsl_add_bridge(pdev, fsl_pci_primary == node);

- mpc85xx_pci_err_probe(pdev);
-
return 0;
}

diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
index c1cec77..1515885 100644
--- a/arch/powerpc/sysdev/fsl_pci.h
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -130,15 +130,6 @@ void fsl_pci_assign_primary(void);
static inline void fsl_pci_assign_primary(void) {}
#endif

-#ifdef CONFIG_EDAC_MPC85XX
-int mpc85xx_pci_err_probe(struct platform_device *op);
-#else
-static inline int mpc85xx_pci_err_probe(struct platform_device *op)
-{
- return -ENOTSUPP;
-}
-#endif
-
#ifdef CONFIG_FSL_PCI
extern int fsl_pci_mcheck_exception(struct pt_regs *);
#else
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 3eab063..c6fc8d5 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -238,7 +238,7 @@ static irqreturn_t mpc85xx_pci_isr(int irq, void *dev_id)
return IRQ_HANDLED;
}

-int mpc85xx_pci_err_probe(struct platform_device *op)
+static int mpc85xx_pci_err_probe(struct platform_device *op)
{
struct edac_pci_ctl_info *pci;
struct mpc85xx_pci_pdata *pdata;
@@ -386,7 +386,37 @@ err:
devres_release_group(&op->dev, mpc85xx_pci_err_probe);
return res;
}
-EXPORT_SYMBOL(mpc85xx_pci_err_probe);
+
+static const struct of_device_id mpc85xx_pci_err_of_match[] = {
+ { .compatible = "fsl,mpc8540-pci", },
+ { .compatible = "fsl,mpc8548-pcie", },
+ { .compatible = "fsl,mpc8610-pci", },
+ { .compatible = "fsl,mpc8641-pcie", },
+ { .compatible = "fsl,qoriq-pcie", },
+ { .compatible = "fsl,qoriq-pcie-v2.1", },
+ { .compatible = "fsl,qoriq-pcie-v2.2", },
+ { .compatible = "fsl,qoriq-pcie-v2.3", },
+ { .compatible = "fsl,qoriq-pcie-v2.4", },
+ { .compatible = "fsl,qoriq-pcie-v3.0", },
+
+ /*
+ * The following entries are for compatibility with older device
+ * trees.
+ */
+ { .compatible = "fsl,p1022-pcie", },
+ { .compatible = "fsl,p4080-pcie", },
+
+ {},
+};
+MODULE_DEVICE_TABLE(of, mpc85xx_pci_err_of_match);
+
+static struct platform_driver mpc85xx_pci_err_driver = {
+ .driver = {
+ .name = "mpc85xx_edac_pci",
+ .of_match_table = mpc85xx_pci_err_of_match,
+ },
+ .probe = mpc85xx_pci_err_probe,
+};

#endif /* CONFIG_PCI */

@@ -1211,6 +1241,7 @@ static void __init mpc85xx_mc_clear_rfxe(void *data)
static struct platform_driver * const drivers[] = {
&mpc85xx_mc_err_driver,
&mpc85xx_l2_err_driver,
+ &mpc85xx_pci_err_driver,
};

static int __init mpc85xx_mc_init(void)
--
2.6.3