aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/phy/phy_device.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-08-11 02:07:25 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-11 02:07:25 -0400
commit67c4f3fa25502ce7ed82fb0307e09cf36f1f81da (patch)
treed368d796618d52361f6aced3dcf2c1beb26ceec3 /drivers/net/phy/phy_device.c
parent303bcb4b675d7284a1097dd1c18c995c0179883a (diff)
Fix numerous minor problems with new phy subsystem.
Includes fixes for problems noted by Adrian Bunk, Andrew Morton, and one other person lost in the annals of history (and email folders).
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r--drivers/net/phy/phy_device.c48
1 files changed, 33 insertions, 15 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index f0595af4c83..c11138330fe 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -39,6 +39,19 @@
#include <asm/irq.h>
#include <asm/uaccess.h>
+static int genphy_config_init(struct phy_device *phydev);
+
+static struct phy_driver genphy_driver = {
+ .phy_id = 0xffffffff,
+ .phy_id_mask = 0xffffffff,
+ .name = "Generic PHY",
+ .config_init = genphy_config_init,
+ .features = 0,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .driver = {.owner = THIS_MODULE, },
+};
+
/* get_phy_device
*
* description: Reads the ID registers of the PHY at addr on the
@@ -656,27 +669,32 @@ void phy_driver_unregister(struct phy_driver *drv)
}
EXPORT_SYMBOL(phy_driver_unregister);
-static struct phy_driver genphy_driver = {
- .phy_id = 0xffffffff,
- .phy_id_mask = 0xffffffff,
- .name = "Generic PHY",
- .config_init = genphy_config_init,
- .features = 0,
- .config_aneg = genphy_config_aneg,
- .read_status = genphy_read_status,
- .driver = {.owner = THIS_MODULE, },
-};
-static int __init genphy_init(void)
+static int __init phy_init(void)
{
- return phy_driver_register(&genphy_driver);
+ int rc;
+ extern int mdio_bus_init(void);
+
+ rc = phy_driver_register(&genphy_driver);
+ if (rc)
+ goto out;
+
+ rc = mdio_bus_init();
+ if (rc)
+ goto out_unreg;
+ return 0;
+
+out_unreg:
+ phy_driver_unregister(&genphy_driver);
+out:
+ return rc;
}
-static void __exit genphy_exit(void)
+static void __exit phy_exit(void)
{
phy_driver_unregister(&genphy_driver);
}
-module_init(genphy_init);
-module_exit(genphy_exit);
+module_init(phy_init);
+module_exit(phy_exit);