diff options
author | Christian Hohnstaedt <chohnstaedt@innominate.com> | 2012-07-04 01:44:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-09 03:10:56 -0400 |
commit | d5bf9071e71a4db85a0eea6236ef94a29fc3eec9 (patch) | |
tree | cf91cd107a5eda19dc8a1024b0c9b2115edf4988 /drivers/net/phy/bcm87xx.c | |
parent | 567990cfccafc580b03b1fb501adf63132c12dcc (diff) |
phylib: Support registering a bunch of drivers
If registering of one of them fails, all already registered drivers
of this module will be unregistered.
Use the new register/unregister functions in all drivers
registering more than one driver.
amd.c, realtek.c: Simplify: directly return registration result.
Tested with broadcom.c
All others compile-tested.
Signed-off-by: Christian Hohnstaedt <chohnstaedt@innominate.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/bcm87xx.c')
-rw-r--r-- | drivers/net/phy/bcm87xx.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c index 9a90dcf31156..2167ce51818e 100644 --- a/drivers/net/phy/bcm87xx.c +++ b/drivers/net/phy/bcm87xx.c | |||
@@ -187,7 +187,8 @@ static int bcm8727_match_phy_device(struct phy_device *phydev) | |||
187 | return phydev->c45_ids.device_ids[4] == PHY_ID_BCM8727; | 187 | return phydev->c45_ids.device_ids[4] == PHY_ID_BCM8727; |
188 | } | 188 | } |
189 | 189 | ||
190 | static struct phy_driver bcm8706_driver = { | 190 | static struct phy_driver bcm87xx_driver[] = { |
191 | { | ||
191 | .phy_id = PHY_ID_BCM8706, | 192 | .phy_id = PHY_ID_BCM8706, |
192 | .phy_id_mask = 0xffffffff, | 193 | .phy_id_mask = 0xffffffff, |
193 | .name = "Broadcom BCM8706", | 194 | .name = "Broadcom BCM8706", |
@@ -200,9 +201,7 @@ static struct phy_driver bcm8706_driver = { | |||
200 | .did_interrupt = bcm87xx_did_interrupt, | 201 | .did_interrupt = bcm87xx_did_interrupt, |
201 | .match_phy_device = bcm8706_match_phy_device, | 202 | .match_phy_device = bcm8706_match_phy_device, |
202 | .driver = { .owner = THIS_MODULE }, | 203 | .driver = { .owner = THIS_MODULE }, |
203 | }; | 204 | }, { |
204 | |||
205 | static struct phy_driver bcm8727_driver = { | ||
206 | .phy_id = PHY_ID_BCM8727, | 205 | .phy_id = PHY_ID_BCM8727, |
207 | .phy_id_mask = 0xffffffff, | 206 | .phy_id_mask = 0xffffffff, |
208 | .name = "Broadcom BCM8727", | 207 | .name = "Broadcom BCM8727", |
@@ -215,25 +214,18 @@ static struct phy_driver bcm8727_driver = { | |||
215 | .did_interrupt = bcm87xx_did_interrupt, | 214 | .did_interrupt = bcm87xx_did_interrupt, |
216 | .match_phy_device = bcm8727_match_phy_device, | 215 | .match_phy_device = bcm8727_match_phy_device, |
217 | .driver = { .owner = THIS_MODULE }, | 216 | .driver = { .owner = THIS_MODULE }, |
218 | }; | 217 | } }; |
219 | 218 | ||
220 | static int __init bcm87xx_init(void) | 219 | static int __init bcm87xx_init(void) |
221 | { | 220 | { |
222 | int ret; | 221 | return phy_drivers_register(bcm87xx_driver, |
223 | 222 | ARRAY_SIZE(bcm87xx_driver)); | |
224 | ret = phy_driver_register(&bcm8706_driver); | ||
225 | if (ret) | ||
226 | goto err; | ||
227 | |||
228 | ret = phy_driver_register(&bcm8727_driver); | ||
229 | err: | ||
230 | return ret; | ||
231 | } | 223 | } |
232 | module_init(bcm87xx_init); | 224 | module_init(bcm87xx_init); |
233 | 225 | ||
234 | static void __exit bcm87xx_exit(void) | 226 | static void __exit bcm87xx_exit(void) |
235 | { | 227 | { |
236 | phy_driver_unregister(&bcm8706_driver); | 228 | phy_drivers_unregister(bcm87xx_driver, |
237 | phy_driver_unregister(&bcm8727_driver); | 229 | ARRAY_SIZE(bcm87xx_driver)); |
238 | } | 230 | } |
239 | module_exit(bcm87xx_exit); | 231 | module_exit(bcm87xx_exit); |