summaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/net_kern.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-05-06 14:51:29 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 12:13:02 -0700
commit2e3f5251ac716879df6b6271f243f657c6e02e9a (patch)
tree2395a370a84775541aa9c4a05b51b1d3c46eeae3 /arch/um/drivers/net_kern.c
parentd8839354a04181b4cc95cebf7f7622cf336bd58e (diff)
downloadblackbird-obmc-linux-2e3f5251ac716879df6b6271f243f657c6e02e9a.tar.gz
blackbird-obmc-linux-2e3f5251ac716879df6b6271f243f657c6e02e9a.zip
uml: drivers get release methods
Define release methods for the ubd and net drivers. They contain as much of the remove methods as make sense. All error checking must have already been done as well as anything else that might be holding a reference on the device kobject. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/drivers/net_kern.c')
-rw-r--r--arch/um/drivers/net_kern.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index b2c292a66218..baac4ad5e68e 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -341,6 +341,19 @@ static struct platform_driver uml_net_driver = {
};
static int driver_registered;
+static void net_device_release(struct device *dev)
+{
+ struct uml_net *device = dev->driver_data;
+ struct net_device *netdev = device->dev;
+ struct uml_net_private *lp = netdev->priv;
+
+ if(lp->remove != NULL)
+ (*lp->remove)(&lp->user);
+ list_del(&device->list);
+ kfree(device);
+ free_netdev(netdev);
+}
+
static void eth_configure(int n, void *init, char *mac,
struct transport *transport)
{
@@ -396,6 +409,8 @@ static void eth_configure(int n, void *init, char *mac,
}
device->pdev.id = n;
device->pdev.name = DRIVER_NAME;
+ device->pdev.dev.release = net_device_release;
+ device->pdev.dev.driver_data = device;
if(platform_device_register(&device->pdev))
goto out_free_netdev;
SET_NETDEV_DEV(dev,&device->pdev.dev);
@@ -689,13 +704,9 @@ static int net_remove(int n, char **error_out)
lp = dev->priv;
if(lp->fd > 0)
return -EBUSY;
- if(lp->remove != NULL) (*lp->remove)(&lp->user);
unregister_netdev(dev);
platform_device_unregister(&device->pdev);
- list_del(&device->list);
- kfree(device);
- free_netdev(dev);
return 0;
}
OpenPOWER on IntegriCloud