aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/soft-interface.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2013-02-11 04:10:23 -0500
committerAntonio Quartulli <ordex@autistici.org>2013-03-27 05:27:32 -0400
commitb3246020e27ecc7c50cc77535936987d6eb6c869 (patch)
treec5cfaead0cd4d195d026c5f0f9c83ce0081e1554 /net/batman-adv/soft-interface.c
parent37130293fd50918c5498bafafd18735a24229cb9 (diff)
batman-adv: Move deinitialization of soft-interface to destructor
The deinitialization of the soft-interface created in ndo_init/constructor should be done in the destructor and not directly before calling unregister_netdevice Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de> Acked-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/soft-interface.c')
-rw-r--r--net/batman-adv/soft-interface.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index c5cb0a7f8349..e889bfb1bfc3 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -417,7 +417,6 @@ static void batadv_softif_destroy_finish(struct work_struct *work)
417 cleanup_work); 417 cleanup_work);
418 soft_iface = bat_priv->soft_iface; 418 soft_iface = bat_priv->soft_iface;
419 419
420 batadv_debugfs_del_meshif(soft_iface);
421 batadv_sysfs_del_meshif(soft_iface); 420 batadv_sysfs_del_meshif(soft_iface);
422 421
423 rtnl_lock(); 422 rtnl_lock();
@@ -522,6 +521,17 @@ static const struct net_device_ops batadv_netdev_ops = {
522}; 521};
523 522
524/** 523/**
524 * batadv_softif_free - Deconstructor of batadv_soft_interface
525 * @dev: Device to cleanup and remove
526 */
527static void batadv_softif_free(struct net_device *dev)
528{
529 batadv_debugfs_del_meshif(dev);
530 batadv_mesh_free(dev);
531 free_netdev(dev);
532}
533
534/**
525 * batadv_softif_init_early - early stage initialization of soft interface 535 * batadv_softif_init_early - early stage initialization of soft interface
526 * @dev: registered network device to modify 536 * @dev: registered network device to modify
527 */ 537 */
@@ -532,7 +542,7 @@ static void batadv_softif_init_early(struct net_device *dev)
532 ether_setup(dev); 542 ether_setup(dev);
533 543
534 dev->netdev_ops = &batadv_netdev_ops; 544 dev->netdev_ops = &batadv_netdev_ops;
535 dev->destructor = free_netdev; 545 dev->destructor = batadv_softif_free;
536 dev->tx_queue_len = 0; 546 dev->tx_queue_len = 0;
537 547
538 /* can't call min_mtu, because the needed variables 548 /* can't call min_mtu, because the needed variables
@@ -575,7 +585,6 @@ void batadv_softif_destroy(struct net_device *soft_iface)
575{ 585{
576 struct batadv_priv *bat_priv = netdev_priv(soft_iface); 586 struct batadv_priv *bat_priv = netdev_priv(soft_iface);
577 587
578 batadv_mesh_free(soft_iface);
579 queue_work(batadv_event_workqueue, &bat_priv->cleanup_work); 588 queue_work(batadv_event_workqueue, &bat_priv->cleanup_work);
580} 589}
581 590