From: Jongsung Kim <neidhard.kim@lge.com>
To: davem@davemloft.net, peppe.cavallaro@st.com,
chohnstaedt@innominate.com, heiko.carstens@de.ibm.com,
schwidefsky@de.ibm.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Jongsung Kim <neidhard.kim@lge.com>,
Francois Romieu <romieu@fr.zoreil.com>
Subject: [PATCH v3 1/4] net: phy: realtek: simplify multiple drivers registration
Date: Mon, 13 May 2013 18:58:37 +0900 [thread overview]
Message-ID: <1368439120-26322-1-git-send-email-neidhard.kim@lge.com> (raw)
In-Reply-To: <518CD784.1030709@cogentembedded.com>
Use the phy_drivers_register and phy_drivers_unregister to
simplify registration and error handling. The two existing
phy_driver structures are converted to an array of the
structures to do this.
v2: use proper way to register multiple drivers.
Signed-off-by: Jongsung Kim <neidhard.kim@lge.com>
Cc: Francois Romieu <romieu@fr.zoreil.com>
---
drivers/net/phy/realtek.c | 65 ++++++++++++++++++++-------------------------
1 files changed, 29 insertions(+), 36 deletions(-)
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 8e7af83..f902107 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -64,50 +64,43 @@ static int rtl8211e_config_intr(struct phy_device *phydev)
return err;
}
-/* RTL8211B */
-static struct phy_driver rtl8211b_driver = {
- .phy_id = 0x001cc912,
- .name = "RTL8211B Gigabit Ethernet",
- .phy_id_mask = 0x001fffff,
- .features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_INTERRUPT,
- .config_aneg = &genphy_config_aneg,
- .read_status = &genphy_read_status,
- .ack_interrupt = &rtl821x_ack_interrupt,
- .config_intr = &rtl8211b_config_intr,
- .driver = { .owner = THIS_MODULE,},
-};
-
-/* RTL8211E */
-static struct phy_driver rtl8211e_driver = {
- .phy_id = 0x001cc915,
- .name = "RTL8211E Gigabit Ethernet",
- .phy_id_mask = 0x001fffff,
- .features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_INTERRUPT,
- .config_aneg = &genphy_config_aneg,
- .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 struct phy_driver realtek_drv[] = {
+ { /* RTL8211B */
+ .phy_id = 0x001cc912,
+ .name = "RTL8211B Gigabit Ethernet",
+ .phy_id_mask = 0x001fffff,
+ .features = PHY_GBIT_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .config_aneg = &genphy_config_aneg,
+ .read_status = &genphy_read_status,
+ .ack_interrupt = &rtl821x_ack_interrupt,
+ .config_intr = &rtl8211b_config_intr,
+ .driver = { .owner = THIS_MODULE,},
+ },
+ { /* RTL8211E */
+ .phy_id = 0x001cc915,
+ .name = "RTL8211E Gigabit Ethernet",
+ .phy_id_mask = 0x001fffff,
+ .features = PHY_GBIT_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .config_aneg = &genphy_config_aneg,
+ .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)
{
- int ret;
-
- ret = phy_driver_register(&rtl8211b_driver);
- if (ret < 0)
- return -ENODEV;
- return phy_driver_register(&rtl8211e_driver);
+ return phy_drivers_register(realtek_drv, ARRAY_SIZE(realtek_drv));
}
static void __exit realtek_exit(void)
{
- phy_driver_unregister(&rtl8211b_driver);
- phy_driver_unregister(&rtl8211e_driver);
+ phy_drivers_unregister(realtek_drv, ARRAY_SIZE(realtek_drv));
}
module_init(realtek_init);
--
1.7.1
next prev parent reply other threads:[~2013-05-13 10:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-08 10:10 net: phy: realtek: add rtl8201f driver Jongsung Kim
2013-05-08 10:41 ` Francois Romieu
2013-05-09 2:26 ` Jongsung Kim
2013-05-08 15:43 ` Sergei Shtylyov
2013-05-09 2:35 ` Jongsung Kim
2013-05-09 16:58 ` Sergei Shtylyov
2013-05-10 3:44 ` Jongsung Kim
2013-05-10 7:29 ` [PATCH v2 1/4] net: phy: realtek: simplify multiple drivers registration Jongsung Kim
2013-05-10 7:29 ` [PATCH v2 2/4] net: phy: realtek: add support for the RTL8201F Jongsung Kim
2013-05-10 7:29 ` [PATCH v2 3/4] net: phy: realtek: add suspend/resume handlers for the RTL8211B Jongsung Kim
2013-05-10 7:29 ` [PATCH v2 4/4] net: phy: realtek: cleanup code Jongsung Kim
2013-05-10 11:18 ` Sergei Shtylyov
2013-05-13 2:48 ` Jongsung Kim
2013-05-13 9:58 ` Jongsung Kim [this message]
2013-05-13 9:58 ` [PATCH v3 2/4] net: phy: realtek: add support for the RTL8201F Jongsung Kim
2013-05-13 9:58 ` [PATCH v3 3/4] net: phy: realtek: add suspend/resume handlers for the RTL8211B Jongsung Kim
2013-05-13 9:58 ` [PATCH v3 4/4] net: phy: realtek: cleanup code Jongsung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1368439120-26322-1-git-send-email-neidhard.kim@lge.com \
--to=neidhard.kim@lge.com \
--cc=chohnstaedt@innominate.com \
--cc=davem@davemloft.net \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
--cc=romieu@fr.zoreil.com \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®