summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO2012-06-04 21:22:57 +0200
committerDavid S. Miller2012-06-06 18:34:56 +0200
commitba27ec66ffeb78cbf9f85e168b32551a9aaf2a34 (patch)
treebc15e2b419088346d9265507c2d3e5b1604a2e7e /drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
parentstmmac: update driver's doc (diff)
downloadkernel-qcow2-linux-ba27ec66ffeb78cbf9f85e168b32551a9aaf2a34.tar.gz
kernel-qcow2-linux-ba27ec66ffeb78cbf9f85e168b32551a9aaf2a34.tar.xz
kernel-qcow2-linux-ba27ec66ffeb78cbf9f85e168b32551a9aaf2a34.zip
stmmac: fix driver Kconfig when built as module
This patches fixes the driver when built as dynamic module. In fact, the platform part cannot be built and the probe fails (thanks to Bob Liu that reported this bug). v2: as D. Miller suggested, it is not necessary to make the pci and the platform code mutually exclusive. Having both could also help, at built time ,to verify that all the code is validated and compiles fine. v3: removed wrong Reviewed-by from the patch Reported-by: Bob Liu <lliubbo@gmail.com> cc: Rayagond Kokatanur <rayagond@vayavyalabs.com> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/stmmac_main.c')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index ea33eae22eeb..363856951412 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -42,6 +42,7 @@
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/prefetch.h>
+#include <linux/pci.h>
#ifdef CONFIG_STMMAC_DEBUG_FS
#include <linux/debugfs.h>
#include <linux/seq_file.h>
@@ -2093,6 +2094,30 @@ int stmmac_restore(struct net_device *ndev)
}
#endif /* CONFIG_PM */
+static int __init stmmac_init(void)
+{
+ int err = 0;
+
+ err = platform_driver_register(&stmmac_pltfr_driver);
+
+ if (!err) {
+ err = pci_register_driver(&stmmac_pci_driver);
+ if (err)
+ platform_driver_unregister(&stmmac_pltfr_driver);
+ }
+
+ return err;
+}
+
+static void __exit stmmac_exit(void)
+{
+ pci_unregister_driver(&stmmac_pci_driver);
+ platform_driver_unregister(&stmmac_pltfr_driver);
+}
+
+module_init(stmmac_init);
+module_exit(stmmac_exit);
+
#ifndef MODULE
static int __init stmmac_cmdline_opt(char *str)
{