bmips: pci: use standard module functions
[openwrt/staging/dedeckeh.git] / target / linux / bmips / files / drivers / pci / controller / pcie-bcm6328.c
index 4c032cf3d987a871d554328d10b3891f2b673ff7..e0950ba439f49ff11b872c370bc19f45d5004dbb 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/mfd/syscon.h>
 #include <linux/mm.h>
+#include <linux/module.h>
 #include <linux/of_gpio.h>
 #include <linux/of_irq.h>
 #include <linux/of_pci.h>
@@ -210,9 +211,6 @@ static struct pci_controller bcm6328_pcie_controller = {
        .pci_ops = &bcm6328_pcie_ops,
        .io_resource = &bcm6328_pcie_io_resource,
        .mem_resource = &bcm6328_pcie_mem_resource,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5,13,0)
-       .busn_resource = &bcm6328_pcie_busn_resource,
-#endif
 };
 
 static void bcm6328_pcie_reset(struct bcm6328_pcie *priv)
@@ -297,9 +295,7 @@ static int bcm6328_pcie_probe(struct platform_device *pdev)
        struct resource *res;
        unsigned int i;
        int ret;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,13,0)
        LIST_HEAD(resources);
-#endif
 
        pm_runtime_enable(dev);
        pm_runtime_no_callbacks(dev);
@@ -386,9 +382,7 @@ static int bcm6328_pcie_probe(struct platform_device *pdev)
                return -EINVAL;
 
        of_pci_parse_bus_range(np, &bcm6328_pcie_busn_resource);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,13,0)
        pci_add_resource(&resources, &bcm6328_pcie_busn_resource);
-#endif
 
        bcm6328_pcie_reset(priv);
        bcm6328_pcie_setup(priv);
@@ -402,6 +396,7 @@ static const struct of_device_id bcm6328_pcie_of_match[] = {
        { .compatible = "brcm,bcm6328-pcie", },
        { /* sentinel */ }
 };
+MODULE_DEVICE_TABLE(of, bcm6328_pcie_of_match);
 
 static struct platform_driver bcm6328_pcie_driver = {
        .probe = bcm6328_pcie_probe,
@@ -410,12 +405,9 @@ static struct platform_driver bcm6328_pcie_driver = {
                .of_match_table = bcm6328_pcie_of_match,
        },
 };
+module_platform_driver(bcm6328_pcie_driver);
 
-int __init bcm6328_pcie_init(void)
-{
-       int ret = platform_driver_register(&bcm6328_pcie_driver);
-       if (ret)
-               pr_err("pci-bcm6328: Error registering platform driver!\n");
-       return ret;
-}
-late_initcall_sync(bcm6328_pcie_init);
+MODULE_AUTHOR("Álvaro Fernández Rojas <noltari@gmail.com>");
+MODULE_DESCRIPTION("BCM6328 PCIe Controller Driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:bcm6328-pcie");