]> err.no Git - linux-2.6/blobdiff - drivers/net/phy/phy_device.c
Merge branch 'upstream'
[linux-2.6] / drivers / net / phy / phy_device.c
index f0595af4c83718f4e0ca03590a2daecbed745bdd..16bebe7a7ce1fdf43c45334b826bb919d7cb9444 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/spinlock.h>
 #include <linux/mm.h>
 #include <linux/module.h>
-#include <linux/version.h>
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/phy.h>
 #include <asm/irq.h>
 #include <asm/uaccess.h>
 
+static struct phy_driver genphy_driver;
+extern int mdio_bus_init(void);
+extern void mdio_bus_exit(void);
+
 /* get_phy_device
  *
  * description: Reads the ID registers of the PHY at addr on the
@@ -111,7 +114,6 @@ void phy_prepare_link(struct phy_device *phydev,
        phydev->adjust_link = handler;
 }
 
-#ifdef CONFIG_PHYCONTROL
 /* phy_connect:
  *
  * description: Convenience function for connecting ethernet
@@ -156,8 +158,6 @@ void phy_disconnect(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(phy_disconnect);
 
-#endif /* CONFIG_PHYCONTROL */
-
 /* phy_attach:
  *
  *   description: Called by drivers to attach to a particular PHY
@@ -664,19 +664,29 @@ static struct phy_driver genphy_driver = {
        .features       = 0,
        .config_aneg    = genphy_config_aneg,
        .read_status    = genphy_read_status,
-       .driver =       {.owner = THIS_MODULE, },
+       .driver         = {.owner= THIS_MODULE, },
 };
 
-static int __init genphy_init(void)
+static int __init phy_init(void)
 {
-       return phy_driver_register(&genphy_driver);
+       int rc;
+
+       rc = mdio_bus_init();
+       if (rc)
+               return rc;
+
+       rc = phy_driver_register(&genphy_driver);
+       if (rc)
+               mdio_bus_exit();
 
+       return rc;
 }
 
-static void __exit genphy_exit(void)
+static void __exit phy_exit(void)
 {
        phy_driver_unregister(&genphy_driver);
+       mdio_bus_exit();
 }
 
-module_init(genphy_init);
-module_exit(genphy_exit);
+subsys_initcall(phy_init);
+module_exit(phy_exit);