aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/net_kern.c
diff options
context:
space:
mode:
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 = {
341}; 341};
342static int driver_registered; 342static int driver_registered;
343 343
344static void net_device_release(struct device *dev)
345{
346 struct uml_net *device = dev->driver_data;
347 struct net_device *netdev = device->dev;
348 struct uml_net_private *lp = netdev->priv;
349
350 if(lp->remove != NULL)
351 (*lp->remove)(&lp->user);
352 list_del(&device->list);
353 kfree(device);
354 free_netdev(netdev);
355}
356
344static void eth_configure(int n, void *init, char *mac, 357static void eth_configure(int n, void *init, char *mac,
345 struct transport *transport) 358 struct transport *transport)
346{ 359{
@@ -396,6 +409,8 @@ static void eth_configure(int n, void *init, char *mac,
396 } 409 }
397 device->pdev.id = n; 410 device->pdev.id = n;
398 device->pdev.name = DRIVER_NAME; 411 device->pdev.name = DRIVER_NAME;
412 device->pdev.dev.release = net_device_release;
413 device->pdev.dev.driver_data = device;
399 if(platform_device_register(&device->pdev)) 414 if(platform_device_register(&device->pdev))
400 goto out_free_netdev; 415 goto out_free_netdev;
401 SET_NETDEV_DEV(dev,&device->pdev.dev); 416 SET_NETDEV_DEV(dev,&device->pdev.dev);
@@ -689,13 +704,9 @@ static int net_remove(int n, char **error_out)
689 lp = dev->priv; 704 lp = dev->priv;
690 if(lp->fd > 0) 705 if(lp->fd > 0)
691 return -EBUSY; 706 return -EBUSY;
692 if(lp->remove != NULL) (*lp->remove)(&lp->user);
693 unregister_netdev(dev); 707 unregister_netdev(dev);
694 platform_device_unregister(&device->pdev); 708 platform_device_unregister(&device->pdev);
695 709
696 list_del(&device->list);
697 kfree(device);
698 free_netdev(dev);
699 return 0; 710 return 0;
700} 711}
701 712