Commit 71b9c4a8 authored by Jongsung Kim's avatar Jongsung Kim Committed by David S. Miller

net: phy: realtek: register/unregister multiple drivers properly

Using phy_drivers_register/_unregister functions is proper way to
handle multiple PHY drivers registration. For Realtek PHY drivers
module, it fixes incomplete current error-handlings up and adds
missed unregistration for the RTL8201CP driver.
Signed-off-by: default avatarJongsung Kim <neidhard.kim@lge.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1b72a0fc
...@@ -64,65 +64,51 @@ static int rtl8211e_config_intr(struct phy_device *phydev) ...@@ -64,65 +64,51 @@ static int rtl8211e_config_intr(struct phy_device *phydev)
return err; return err;
} }
/* RTL8201CP */ static struct phy_driver realtek_drvs[] = {
static struct phy_driver rtl8201cp_driver = { {
.phy_id = 0x00008201, .phy_id = 0x00008201,
.name = "RTL8201CP Ethernet", .name = "RTL8201CP Ethernet",
.phy_id_mask = 0x0000ffff, .phy_id_mask = 0x0000ffff,
.features = PHY_BASIC_FEATURES, .features = PHY_BASIC_FEATURES,
.flags = PHY_HAS_INTERRUPT, .flags = PHY_HAS_INTERRUPT,
.config_aneg = &genphy_config_aneg, .config_aneg = &genphy_config_aneg,
.read_status = &genphy_read_status, .read_status = &genphy_read_status,
.driver = { .owner = THIS_MODULE,}, .driver = { .owner = THIS_MODULE,},
}; }, {
.phy_id = 0x001cc912,
/* RTL8211B */ .name = "RTL8211B Gigabit Ethernet",
static struct phy_driver rtl8211b_driver = { .phy_id_mask = 0x001fffff,
.phy_id = 0x001cc912, .features = PHY_GBIT_FEATURES,
.name = "RTL8211B Gigabit Ethernet", .flags = PHY_HAS_INTERRUPT,
.phy_id_mask = 0x001fffff, .config_aneg = &genphy_config_aneg,
.features = PHY_GBIT_FEATURES, .read_status = &genphy_read_status,
.flags = PHY_HAS_INTERRUPT, .ack_interrupt = &rtl821x_ack_interrupt,
.config_aneg = &genphy_config_aneg, .config_intr = &rtl8211b_config_intr,
.read_status = &genphy_read_status, .driver = { .owner = THIS_MODULE,},
.ack_interrupt = &rtl821x_ack_interrupt, }, {
.config_intr = &rtl8211b_config_intr, .phy_id = 0x001cc915,
.driver = { .owner = THIS_MODULE,}, .name = "RTL8211E Gigabit Ethernet",
}; .phy_id_mask = 0x001fffff,
.features = PHY_GBIT_FEATURES,
/* RTL8211E */ .flags = PHY_HAS_INTERRUPT,
static struct phy_driver rtl8211e_driver = { .config_aneg = &genphy_config_aneg,
.phy_id = 0x001cc915, .read_status = &genphy_read_status,
.name = "RTL8211E Gigabit Ethernet", .ack_interrupt = &rtl821x_ack_interrupt,
.phy_id_mask = 0x001fffff, .config_intr = &rtl8211e_config_intr,
.features = PHY_GBIT_FEATURES, .suspend = genphy_suspend,
.flags = PHY_HAS_INTERRUPT, .resume = genphy_resume,
.config_aneg = &genphy_config_aneg, .driver = { .owner = THIS_MODULE,},
.read_status = &genphy_read_status, },
.ack_interrupt = &rtl821x_ack_interrupt,
.config_intr = &rtl8211e_config_intr,
.suspend = genphy_suspend,
.resume = genphy_resume,
.driver = { .owner = THIS_MODULE,},
}; };
static int __init realtek_init(void) static int __init realtek_init(void)
{ {
int ret; return phy_drivers_register(realtek_drvs, ARRAY_SIZE(realtek_drvs));
ret = phy_driver_register(&rtl8201cp_driver);
if (ret < 0)
return -ENODEV;
ret = phy_driver_register(&rtl8211b_driver);
if (ret < 0)
return -ENODEV;
return phy_driver_register(&rtl8211e_driver);
} }
static void __exit realtek_exit(void) static void __exit realtek_exit(void)
{ {
phy_driver_unregister(&rtl8211b_driver); phy_drivers_unregister(realtek_drvs, ARRAY_SIZE(realtek_drvs));
phy_driver_unregister(&rtl8211e_driver);
} }
module_init(realtek_init); module_init(realtek_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment