aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar_mii.c
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@marvell.com>2008-10-08 19:29:57 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-08 19:29:57 -0400
commit298cf9beb9679522de995e249eccbd82f7c51999 (patch)
treecabbc9c696a063982aea9a24d8caa667daa33a1a /drivers/net/gianfar_mii.c
parent18ee49ddb0d242ed1d0e273038d5e4f6de7379d3 (diff)
phylib: move to dynamic allocation of struct mii_bus
This patch introduces mdiobus_alloc() and mdiobus_free(), and makes all mdio bus drivers use these functions to allocate their struct mii_bus'es dynamically. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Andy Fleming <afleming@freescale.com>
Diffstat (limited to 'drivers/net/gianfar_mii.c')
-rw-r--r--drivers/net/gianfar_mii.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index 38895b0e376d..bf73eea98010 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -164,8 +164,7 @@ static int gfar_mdio_probe(struct device *dev)
164 if (NULL == dev) 164 if (NULL == dev)
165 return -EINVAL; 165 return -EINVAL;
166 166
167 new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL); 167 new_bus = mdiobus_alloc();
168
169 if (NULL == new_bus) 168 if (NULL == new_bus)
170 return -ENOMEM; 169 return -ENOMEM;
171 170
@@ -242,7 +241,7 @@ static int gfar_mdio_probe(struct device *dev)
242bus_register_fail: 241bus_register_fail:
243 iounmap(regs); 242 iounmap(regs);
244reg_map_fail: 243reg_map_fail:
245 kfree(new_bus); 244 mdiobus_free(new_bus);
246 245
247 return err; 246 return err;
248} 247}
@@ -258,7 +257,7 @@ static int gfar_mdio_remove(struct device *dev)
258 257
259 iounmap((void __iomem *)bus->priv); 258 iounmap((void __iomem *)bus->priv);
260 bus->priv = NULL; 259 bus->priv = NULL;
261 kfree(bus); 260 mdiobus_free(bus);
262 261
263 return 0; 262 return 0;
264} 263}