From patchwork Mon Feb 11 09:10:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 2778 Return-Path: Received: from nm40-vm7.bullet.mail.sg3.yahoo.com (nm40-vm7.bullet.mail.sg3.yahoo.com [106.10.151.222]) by open-mesh.org (Postfix) with ESMTPS id 3FB84601509 for ; Mon, 11 Feb 2013 10:10:54 +0100 (CET) Received: from [106.10.166.127] by nm40.bullet.mail.sg3.yahoo.com with NNFMP; 11 Feb 2013 09:10:50 -0000 Received: from [106.10.167.184] by tm16.bullet.mail.sg3.yahoo.com with NNFMP; 11 Feb 2013 09:10:49 -0000 Received: from [127.0.0.1] by smtp157.mail.sg3.yahoo.com with NNFMP; 11 Feb 2013 09:10:49 -0000 X-Yahoo-Newman-Id: 937402.44612.bm@smtp157.mail.sg3.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: Bgx9_VwVM1nhGL5FTR78vMK._4o7N870n7mPSF9FXKbtacv ROfL18aX8ITmxmvqQbHEW0Mo7x2YIsOfhHisETwDVZLol5Xm6RA.hl7VPCYQ RBjaGqATmrFJDMU0SzExS9rLVf_ZQ_JK8RVAbdMvNK.D0h7130p_8F2ZdEmy ieBj3g_ZeRPHLRBDCzgl3S142pwkVaC2rbeNGYhP.1ARVnlQu_RG1OrNx1C4 yNR3pupQiIfm0ukGwGfWCR2HwsUHKGDnsmx4SC518OusXa_0PpMAfm8oj8bX UnXLyKfAFyVdWA08tJQyBgXexU7uXAYiuiBowG7SFyW73J_ElRgNR2gvFo_H 1iixRrPhcIYVH6h8MBdqco3FxdFq2OKyUFz07Hdf.5DPPwQ31.7WKSdJ_UQO G5RZvAqEa1Buimw2BMI5QQv1cviuaP3PpznWGUlyuRfuh X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@1.36.145.66 with plain) by smtp157.mail.sg3.yahoo.com with SMTP; 11 Feb 2013 01:10:49 -0800 PST From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 11 Feb 2013 17:10:23 +0800 Message-Id: <1360573828-24399-2-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360573828-24399-1-git-send-email-lindner_marek@yahoo.de> References: <201302111710.04911.lindner_marek@yahoo.de> <1360573828-24399-1-git-send-email-lindner_marek@yahoo.de> Cc: Sven Eckelmann Subject: [B.A.T.M.A.N.] [PATCHv3 2/6] batman-adv: Move deinitialization of soft-interface to destructor X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list 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: , X-List-Received-Date: Mon, 11 Feb 2013 09:10:56 -0000 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 c5cb0a7..e889bfb 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -417,7 +417,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(); @@ -522,6 +521,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 */ @@ -532,7 +542,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 @@ -575,7 +585,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); }