Return-Path: From: Marek Lindner Date: Sun, 13 Jan 2013 17:50:59 +0800 Message-Id: <1358070663-8226-2-git-send-email-lindner_marek@yahoo.de> In-Reply-To: <1358070663-8226-1-git-send-email-lindner_marek@yahoo.de> References: <201301131750.39338.lindner_marek@yahoo.de> <1358070663-8226-1-git-send-email-lindner_marek@yahoo.de> Subject: [B.A.T.M.A.N.] [PATCHv2 2/6] batman-adv: Move deinitialization of soft-interface to destructor Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: b.a.t.m.a.n@lists.open-mesh.org Cc: Sven Eckelmann From: Sven Eckelmann 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 --- soft-interface.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/soft-interface.c b/soft-interface.c index 1389c10..d905719 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -416,7 +416,6 @@ static void batadv_softif_destroy_finish(struct work_struct *work) cleanup_work); soft_iface = bat_priv->soft_iface; - batadv_debugfs_del_meshif(soft_iface); batadv_sysfs_del_meshif(soft_iface); rtnl_lock(); @@ -519,6 +518,17 @@ static const struct net_device_ops batadv_netdev_ops = { }; /** + * batadv_softif_free - Deconstructor of batadv_soft_interface + * @dev: Device to cleanup and remove + */ +static void batadv_softif_free(struct net_device *dev) +{ + batadv_debugfs_del_meshif(dev); + batadv_mesh_free(dev); + free_netdev(dev); +} + +/** * batadv_softif_init_early - early stage initialization of soft interface * @dev: registered network device to modify */ @@ -529,7 +539,7 @@ static void batadv_softif_init_early(struct net_device *dev) ether_setup(dev); dev->netdev_ops = &batadv_netdev_ops; - dev->destructor = free_netdev; + dev->destructor = batadv_softif_free; dev->tx_queue_len = 0; /* can't call min_mtu, because the needed variables @@ -572,7 +582,6 @@ void batadv_softif_destroy(struct net_device *soft_iface) { struct batadv_priv *bat_priv = netdev_priv(soft_iface); - batadv_mesh_free(soft_iface); queue_work(batadv_event_workqueue, &bat_priv->cleanup_work); } -- 1.7.10.4