aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fs_enet
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/fs_enet
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/fs_enet')
-rw-r--r--drivers/net/fs_enet/mii-bitbang.c7
-rw-r--r--drivers/net/fs_enet/mii-fec.c6
2 files changed, 6 insertions, 7 deletions
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c
index 2774252c2352..49b6645d7e0c 100644
--- a/drivers/net/fs_enet/mii-bitbang.c
+++ b/drivers/net/fs_enet/mii-bitbang.c
@@ -218,9 +218,9 @@ out_free_irqs:
218out_unmap_regs: 218out_unmap_regs:
219 iounmap(bitbang->dir); 219 iounmap(bitbang->dir);
220out_free_bus: 220out_free_bus:
221 kfree(new_bus);
222out_free_priv:
223 free_mdio_bitbang(new_bus); 221 free_mdio_bitbang(new_bus);
222out_free_priv:
223 kfree(bitbang);
224out: 224out:
225 return ret; 225 return ret;
226} 226}
@@ -231,12 +231,11 @@ static int fs_enet_mdio_remove(struct of_device *ofdev)
231 struct bb_info *bitbang = bus->priv; 231 struct bb_info *bitbang = bus->priv;
232 232
233 mdiobus_unregister(bus); 233 mdiobus_unregister(bus);
234 free_mdio_bitbang(bus);
235 dev_set_drvdata(&ofdev->dev, NULL); 234 dev_set_drvdata(&ofdev->dev, NULL);
236 kfree(bus->irq); 235 kfree(bus->irq);
236 free_mdio_bitbang(bus);
237 iounmap(bitbang->dir); 237 iounmap(bitbang->dir);
238 kfree(bitbang); 238 kfree(bitbang);
239 kfree(bus);
240 239
241 return 0; 240 return 0;
242} 241}
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index 4d89a22317ac..28077cc1b949 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -128,7 +128,7 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev,
128 struct fec_info *fec; 128 struct fec_info *fec;
129 int ret = -ENOMEM, i; 129 int ret = -ENOMEM, i;
130 130
131 new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL); 131 new_bus = mdiobus_alloc();
132 if (!new_bus) 132 if (!new_bus)
133 goto out; 133 goto out;
134 134
@@ -190,7 +190,7 @@ out_res:
190out_fec: 190out_fec:
191 kfree(fec); 191 kfree(fec);
192out_mii: 192out_mii:
193 kfree(new_bus); 193 mdiobus_free(new_bus);
194out: 194out:
195 return ret; 195 return ret;
196} 196}
@@ -205,7 +205,7 @@ static int fs_enet_mdio_remove(struct of_device *ofdev)
205 kfree(bus->irq); 205 kfree(bus->irq);
206 iounmap(fec->fecp); 206 iounmap(fec->fecp);
207 kfree(fec); 207 kfree(fec);
208 kfree(bus); 208 mdiobus_free(bus);
209 209
210 return 0; 210 return 0;
211} 211}